edu.umass.cs.mallet.base.pipe
Class Array2FeatureVector
java.lang.Object
edu.umass.cs.mallet.base.pipe.Pipe
edu.umass.cs.mallet.base.pipe.Array2FeatureVector
- All Implemented Interfaces:
- java.io.Serializable
- public class Array2FeatureVector
- extends Pipe
Converts a Java array of numerical types to a FeatureVector, where the
Alphabet is the data array index wrapped in an Integer object.
- See Also:
- Serialized Form
Method Summary |
Instance |
pipe(Instance carrier)
Convert the data in an Instance from an array to a
FeatureVector leaving other fields unchanged. |
int |
size()
Current size of the Vocabulary |
Methods inherited from class edu.umass.cs.mallet.base.pipe.Pipe |
getDataAlphabet, getInstanceId, getParent, getParentRoot, getTargetAlphabet, isDataAlphabetSet, isTargetProcessing, pipe, readResolve, resolveDataAlphabet, resolveTargetAlphabet, setDataAlphabet, setParent, setTargetAlphabet, setTargetProcessing |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Array2FeatureVector
public Array2FeatureVector(int capacity)
Array2FeatureVector
public Array2FeatureVector()
Array2FeatureVector
public Array2FeatureVector(Alphabet dataDict,
Alphabet targetDict)
- Construct a pipe based on the dimensions of the data and target.
pipe
public Instance pipe(Instance carrier)
throws java.lang.IllegalStateException
- Convert the data in an
Instance
from an array to a
FeatureVector
leaving other fields unchanged.
Instance.getData()
must return a numeric array, and it is
cast to double[]
- Specified by:
pipe
in class Pipe
- Parameters:
carrier
- Instance to be processed.
- Throws:
java.lang.IllegalStateException
- If Instance.getTarget()
is
not a Labeling
size
public int size()
- Current size of the Vocabulary