T - type of underlying enumerationpublic class EnumFV<T extends Enum<T>> extends Object implements FeatureVector
| Constructor and Description |
|---|
EnumFV(T value)
Construct the feature with the given value
|
| Modifier and Type | Method and Description |
|---|---|
String |
asciiHeader()
Header for ascii input.
|
DoubleFV |
asDoubleFV()
Convert the FV to a DoubleFV representation
|
double[] |
asDoubleVector()
Convert the FV to a 1-dimensional double array representation
|
byte[] |
binaryHeader()
Header for binary input.
|
double |
getAsDouble(int i)
Get an element of the feature as a double value
|
Enum<T> |
getVector()
Get the underlying data array.
|
int |
length()
Get the length of this vector
|
EnumFV<T> |
newInstance()
Construct a new instance of this featurevector.
|
DoubleFV |
normaliseFV()
Normalise the FV to unit length
|
DoubleFV |
normaliseFV(double p)
Lp Norm of the FV.
|
DoubleFV |
normaliseFV(double[] min,
double[] max)
Element-wise normalisation to 0..1 using separated expected minimum and
maximum values for each element of the underlying feature vector.
|
DoubleFV |
normaliseFV(double min,
double max)
Min-Max normalisation of the FV.
|
void |
readASCII(Scanner in)
Read internal state from in.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
setFromDouble(int i,
double v)
Set an element of the feature from a double value
|
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
public void readBinary(DataInput in) throws IOException
ReadableBinaryreadBinary in interface ReadableBinaryin - source to read from.IOException - an error reading inputpublic void readASCII(Scanner in) throws IOException
ReadableASCIIreadASCII in interface ReadableASCIIin - source to read from.IOException - an error reading inputpublic byte[] binaryHeader()
ReadableBinarybinaryHeader in interface ReadableBinarybinaryHeader in interface WriteableBinarypublic String asciiHeader()
ReadableASCIIasciiHeader in interface ReadableASCIIasciiHeader in interface WriteableASCIIpublic void writeBinary(DataOutput out) throws IOException
WriteableBinarywriteBinary in interface WriteableBinaryout - sink to write toIOException - an error writing to outpublic void writeASCII(PrintWriter out) throws IOException
WriteableASCIIwriteASCII in interface WriteableASCIIout - sink to write toIOException - an error writing to outpublic Enum<T> getVector()
FeatureVectorgetVector in interface FeatureVectorpublic int length()
FeatureVectorlength in interface FeatureVectorpublic DoubleFV normaliseFV(double[] min, double[] max)
FeatureVectornormaliseFV in interface FeatureVectormin - an array containing the minimum expected valuesmax - an array containing the maximum expected valuespublic DoubleFV normaliseFV(double min, double max)
FeatureVectornormaliseFV in interface FeatureVectormin - the minimum expected valuemax - the maximum expected valuepublic DoubleFV normaliseFV()
FeatureVectornormaliseFV in interface FeatureVectorpublic DoubleFV normaliseFV(double p)
FeatureVectornormaliseFV in interface FeatureVectorp - the norm to computepublic DoubleFV asDoubleFV()
FeatureVectorasDoubleFV in interface FeatureVectorpublic double[] asDoubleVector()
FeatureVectorasDoubleVector in interface FeatureVectorpublic double getAsDouble(int i)
FeatureVectorgetAsDouble in interface FeatureVectori - the element indexpublic void setFromDouble(int i, double v)
FeatureVectorsetFromDouble in interface FeatureVectori - the element indexv - the valuepublic EnumFV<T> newInstance()
FeatureVectornewInstance in interface FeatureVector