cc.mallet.types
Class AugmentableFeatureVector

java.lang.Object
  extended by cc.mallet.types.SparseVector
      extended by cc.mallet.types.FeatureVector
          extended by cc.mallet.types.AugmentableFeatureVector
All Implemented Interfaces:
AlphabetCarrying, ConstantMatrix, Vector, java.io.Serializable

public class AugmentableFeatureVector
extends FeatureVector
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class cc.mallet.types.SparseVector
hasInfinite, indices, values
 
Constructor Summary
AugmentableFeatureVector(Alphabet dict)
           
AugmentableFeatureVector(Alphabet dict, boolean binary)
           
AugmentableFeatureVector(Alphabet dict, double[] values)
           
AugmentableFeatureVector(Alphabet dict, double[] values, int capacity)
           
AugmentableFeatureVector(Alphabet dict, int[] indices, double[] values, int capacity)
           
AugmentableFeatureVector(Alphabet dict, int[] indices, double[] values, int capacity, boolean copy)
           
AugmentableFeatureVector(Alphabet dict, int[] indices, double[] values, int capacity, boolean copy, boolean checkIndicesSorted)
           
AugmentableFeatureVector(Alphabet dict, int[] indices, double[] values, int capacity, int size, boolean copy, boolean checkIndicesSorted, boolean removeDuplicates)
          To make a binary vector, pass null for "values"
AugmentableFeatureVector(Alphabet dict, int capacity, boolean binary)
           
AugmentableFeatureVector(Alphabet dict, PropertyList pl, boolean binary)
           
AugmentableFeatureVector(Alphabet dict, PropertyList pl, boolean binary, boolean growAlphabet)
           
AugmentableFeatureVector(FeatureSequence fs, boolean binary)
           
AugmentableFeatureVector(FeatureVector fv)
           
 
Method Summary
 void add(FeatureVector fv)
          Adds all indices that are present in some other feature vector with value 1.0.
 void add(FeatureVector fv, java.lang.String prefix)
          Adds all features from some other feature vector with weight 1.0.
 void add(FeatureVector fv, java.lang.String prefix, boolean binary)
          Adds all features from some other feature vector with weight 1.0.
 void add(int index)
           
 void add(int index, double value)
           
 void add(java.lang.Object key, double value)
           
 void addTo(double[] accumulator)
           
 void addTo(double[] accumulator, double scale)
           
 ConstantMatrix cloneMatrix()
          CLONING
 ConstantMatrix cloneMatrixZeroed()
           
 double dotProduct(AugmentableFeatureVector v)
           
 double dotProduct(DenseVector v)
           
 double dotProduct(SparseVector v)
           
 int indexAtLocation(int location)
           
 double infinityNorm()
           
 int location(int index)
           
 int numLocations()
           
 double oneNorm()
           
 void plusEquals(AugmentableFeatureVector v, double factor)
           
 void plusEquals(SparseVector v)
           
 void plusEquals(SparseVector v, double factor)
           
 void print()
           
protected  void removeDuplicates(int numDuplicates)
           
 void setAll(double v)
          Sets every present index in the vector to v.
 void setValue(int index, double value)
          Sets the value at the given index.
 void setValueAtLocation(int location, double value)
          Sets the value at the given location.
 int singleSize()
           
protected  void sortIndices()
           
 FeatureVector toFeatureVector()
           
 SparseVector toSparseVector()
           
 double twoNorm()
           
 double value(int index)
           
 double valueAtLocation(int location)
           
 
Methods inherited from class cc.mallet.types.FeatureVector
alphabetsMatch, contains, getAlphabet, getAlphabets, getObjectIndices, location, newFeatureVector, toSimpFile, toString, toString, value
 
Methods inherited from class cc.mallet.types.SparseVector
absNorm, arrayCopyFrom, arrayCopyFrom, arrayCopyInto, dotProduct, dotProduct, extendedDotProduct, extendedDotProduct, getDimensions, getIndices, getNumDimensions, getValues, incrementValue, isBinary, isInfinite, isNaN, isNaNOrInfinite, makeBinary, makeNonBinary, map, plusEqualsSparse, plusEqualsSparse, singleIndex, singleToIndices, singleValue, timesEquals, timesEqualsSparse, timesEqualsSparse, timesEqualsSparseZero, value, vectorAdd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                int[] indices,
                                double[] values,
                                int capacity,
                                int size,
                                boolean copy,
                                boolean checkIndicesSorted,
                                boolean removeDuplicates)
To make a binary vector, pass null for "values"


AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                int[] indices,
                                double[] values,
                                int capacity,
                                boolean copy,
                                boolean checkIndicesSorted)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                int[] indices,
                                double[] values,
                                int capacity,
                                boolean copy)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                int[] indices,
                                double[] values,
                                int capacity)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                double[] values,
                                int capacity)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                double[] values)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                int capacity,
                                boolean binary)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                boolean binary)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict)

AugmentableFeatureVector

public AugmentableFeatureVector(FeatureVector fv)

AugmentableFeatureVector

public AugmentableFeatureVector(FeatureSequence fs,
                                boolean binary)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                PropertyList pl,
                                boolean binary,
                                boolean growAlphabet)

AugmentableFeatureVector

public AugmentableFeatureVector(Alphabet dict,
                                PropertyList pl,
                                boolean binary)
Method Detail

add

public void add(FeatureVector fv)
Adds all indices that are present in some other feature vector with value 1.0. Beware that this may have unintended effects if fv.dictionary != this.dictionary


add

public void add(FeatureVector fv,
                java.lang.String prefix)
Adds all features from some other feature vector with weight 1.0. The names of the added features are generated by adding a prefix to their names in the original feature vector. This does not require that fv.dictionary equal this.dictionary.

Parameters:
fv - A feature vector to add from. Its feature names must be Strings.
prefix - String to add when generating new feature names

add

public void add(FeatureVector fv,
                java.lang.String prefix,
                boolean binary)
Adds all features from some other feature vector with weight 1.0. The names of the added features are generated by adding a prefix to their names in the original feature vector. This does not require that fv.dictionary equal this.dictionary.

Parameters:
fv - A feature vector to add from. Its feature names must be Strings.
prefix - String to add when generating new feature names
binary - true if fv is binary

add

public void add(int index,
                double value)

add

public void add(java.lang.Object key,
                double value)

add

public void add(int index)

numLocations

public final int numLocations()
Specified by:
numLocations in interface ConstantMatrix
Overrides:
numLocations in class SparseVector

location

public final int location(int index)
Specified by:
location in interface ConstantMatrix
Overrides:
location in class SparseVector

valueAtLocation

public final double valueAtLocation(int location)
Specified by:
valueAtLocation in interface ConstantMatrix
Overrides:
valueAtLocation in class SparseVector

indexAtLocation

public final int indexAtLocation(int location)
Specified by:
indexAtLocation in interface ConstantMatrix
Overrides:
indexAtLocation in class SparseVector

value

public final double value(int index)
Specified by:
value in interface Vector
Overrides:
value in class SparseVector

addTo

public final void addTo(double[] accumulator,
                        double scale)
Overrides:
addTo in class SparseVector

addTo

public final void addTo(double[] accumulator)
Overrides:
addTo in class SparseVector

setValue

public final void setValue(int index,
                           double value)
Description copied from class: SparseVector
Sets the value at the given index.

Overrides:
setValue in class SparseVector

setValueAtLocation

public final void setValueAtLocation(int location,
                                     double value)
Description copied from class: SparseVector
Sets the value at the given location.

Overrides:
setValueAtLocation in class SparseVector

cloneMatrix

public ConstantMatrix cloneMatrix()
Description copied from class: SparseVector
CLONING

Specified by:
cloneMatrix in interface ConstantMatrix
Overrides:
cloneMatrix in class FeatureVector

cloneMatrixZeroed

public ConstantMatrix cloneMatrixZeroed()
Overrides:
cloneMatrixZeroed in class FeatureVector

singleSize

public int singleSize()
Specified by:
singleSize in interface ConstantMatrix
Overrides:
singleSize in class SparseVector

toSparseVector

public SparseVector toSparseVector()

toFeatureVector

public FeatureVector toFeatureVector()

dotProduct

public double dotProduct(DenseVector v)
Overrides:
dotProduct in class SparseVector

dotProduct

public final double dotProduct(SparseVector v)
Overrides:
dotProduct in class SparseVector

dotProduct

public final double dotProduct(AugmentableFeatureVector v)

plusEquals

public void plusEquals(AugmentableFeatureVector v,
                       double factor)

plusEquals

public void plusEquals(SparseVector v,
                       double factor)

plusEquals

public void plusEquals(SparseVector v)

setAll

public void setAll(double v)
Description copied from class: SparseVector
Sets every present index in the vector to v.

Overrides:
setAll in class SparseVector

oneNorm

public double oneNorm()
Specified by:
oneNorm in interface ConstantMatrix
Overrides:
oneNorm in class SparseVector

twoNorm

public double twoNorm()
Specified by:
twoNorm in interface ConstantMatrix
Overrides:
twoNorm in class SparseVector

infinityNorm

public double infinityNorm()
Specified by:
infinityNorm in interface ConstantMatrix
Overrides:
infinityNorm in class SparseVector

print

public void print()
Specified by:
print in interface ConstantMatrix
Overrides:
print in class SparseVector

sortIndices

protected void sortIndices()
Overrides:
sortIndices in class SparseVector

removeDuplicates

protected void removeDuplicates(int numDuplicates)
Overrides:
removeDuplicates in class SparseVector