public class FeatureVector extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FeatureVector.FeatureType |
| Modifier and Type | Field and Description |
|---|---|
byte[] |
byteValuedDiscreteFeatures |
float[] |
continuousFeatures |
short[] |
shortValuedDiscreteFeatures |
int |
unitIndex |
| Constructor and Description |
|---|
FeatureVector(byte[] byteValuedDiscreteFeatures,
short[] shortValuedDiscreteFeatures,
float[] continuousFeatures,
int setUnitIndex) |
| Modifier and Type | Method and Description |
|---|---|
byte |
getByteFeature(int index)
An efficient way to access byte-valued features in this feature vector.
|
byte[] |
getByteValuedDiscreteFeatures() |
float |
getContinuousFeature(int index)
An efficient way to access continuous features in this feature vector.
|
float[] |
getContinuousFeatures() |
Number |
getFeature(int index)
A uniform way to access features in this feature vector.
|
int |
getFeatureAsInt(int index)
A wrapper to getFeature(), to get the result as an int value, e.g., for subsequent array indexing.
|
String |
getFeatureAsString(int index,
FeatureDefinition feaDef)
A wrapper to getFeature(), to get the result as an String value, e.g., for subsequent System.out output.
|
FeatureVector.FeatureType |
getFeatureType(int featureIndex) |
int |
getLength()
Get the total number of features in this feature vector.
|
int |
getNumberOfByteFeatures()
The number of byte features in this feature vector.
|
int |
getNumberOfContinuousFeatures()
The number of continuous features in this feature vector.
|
int |
getNumberOfShortFeatures()
The number of short features in this feature vector.
|
short |
getShortFeature(int index)
An efficient way to access short-valued features in this feature vector.
|
short[] |
getShortValuedDiscreteFeatures() |
int |
getUnitIndex()
Get the index of the unit to which the current feature vector applies.
|
boolean |
isByteFeature(int index)
Test whether the feature with the given index number is a byte feature.
|
boolean |
isContinuousFeature(int index)
Test whether the feature with the given index number is a continuous feature.
|
boolean |
isEdgeVector(int edgeIndex)
Is this an edge vector?
|
boolean |
isShortFeature(int index)
Test whether the feature with the given index number is a short feature.
|
String |
toString()
Return a string representation of this set of target features; feature values separated by spaces.
|
void |
writeTo(DataOutput out)
Write a binary representation of this feature vector to the given data output.
|
public final int unitIndex
public final byte[] byteValuedDiscreteFeatures
public final short[] shortValuedDiscreteFeatures
public final float[] continuousFeatures
public FeatureVector(byte[] byteValuedDiscreteFeatures,
short[] shortValuedDiscreteFeatures,
float[] continuousFeatures,
int setUnitIndex)
public boolean isEdgeVector(int edgeIndex)
edgeIndex - edge indexpublic FeatureVector.FeatureType getFeatureType(int featureIndex)
public int getLength()
public int getUnitIndex()
public int getNumberOfByteFeatures()
public int getNumberOfShortFeatures()
public int getNumberOfContinuousFeatures()
public Number getFeature(int index)
index - a feature index between 0 and getLength()-1public int getFeatureAsInt(int index)
index - A feature index between 0 and getLength()-1.getFeature(int)public String getFeatureAsString(int index, FeatureDefinition feaDef)
index - A feature index between 0 and getLength()-1.feaDef - A FeatureDefinition object allowing to decode the feature value.getFeature(int)public final byte getByteFeature(int index)
index - the index number of the byte-valued feature in this feature vector.IndexOutOfBoundsException - if index<0 or index ≥ getNumberOfByteFeatures(). check getNumberOfByteFeatures() . check
isByteFeature(int index) .public final short getShortFeature(int index)
index - the index number of the short-valued feature in this feature vector.IndexOutOfBoundsException - if index<getNumberOfByteFeatures() or index ≥ getNumberOfByteFeatures()+getNumberOfShortFeatures().getNumberOfByteFeatures(),
getNumberOfShortFeatures(),
isShortFeature(int index)public final float getContinuousFeature(int index)
index - the index number of the continuous feature in this feature vector.IndexOutOfBoundsException - if index<getNumberOfByteFeatures()+getNumberOfShortFeatures() or index ≥ getLength().getNumberOfByteFeatures(),
getNumberOfShortFeatures(),
getNumberOfContinuousFeatures(),
getLength(),
isContinuousFeature(int index)public boolean isByteFeature(int index)
index - indexpublic boolean isShortFeature(int index)
index - indexpublic boolean isContinuousFeature(int index)
index - indexpublic byte[] getByteValuedDiscreteFeatures()
public short[] getShortValuedDiscreteFeatures()
public float[] getContinuousFeatures()
public void writeTo(DataOutput out) throws IOException
out - the DataOutputStream or RandomAccessFile in which to write the binary representation of the feature vector.IOException - IOExceptionCopyright © 2000–2016 DFKI GmbH. All rights reserved.