public class IntFV extends ArrayFeatureVector<int[]> implements Concatenatable<IntFV,IntFV>, Cloneable
values| Constructor and Description |
|---|
IntFV()
Construct an empty feature vector
|
IntFV(int nbins)
Construct empty FV with given number of bins
|
IntFV(int[] values)
Construct from flattened values array and dimensions
|
| 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.
|
IntFV |
clone() |
double |
compare(IntFV h,
IntFVComparison method)
Compare this FV to another with the given method.
|
IntFV |
concatenate(IntFV... ins)
Concatenate all the inputs with this, returning a new object that is the
result of the concatenation.
|
IntFV |
concatenate(List<IntFV> ins)
Concatenate all the inputs with this, returning a new object that is the
result of the concatenation.
|
boolean |
equals(Object obj) |
int |
get(int x)
Get the element at the given flat index
|
double |
getAsDouble(int i)
Get an element of the feature as a double value
|
int |
hashCode() |
int |
length()
Get the length of this vector
|
IntFV |
newInstance()
Construct a new instance of this featurevector.
|
DoubleFV |
normaliseFV()
Normalise the FV to unit area.
|
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
|
IntFV |
subvector(int beginIndex)
Returns a new featurevector that is a subsequence of this vector.
|
IntFV |
subvector(int beginIndex,
int endIndex)
Returns a new string that is a subvector of this vector.
|
String |
toString() |
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.
|
getVectorpublic IntFV()
public IntFV(int nbins)
nbins - the number of bins in each dimensionpublic IntFV(int[] values)
values - the flat array of valuespublic int get(int x)
x - the flattened element indexpublic DoubleFV normaliseFV(double[] min, double[] max)
normaliseFV in interface FeatureVectormin - an array containing the minimum expected valuesmax - an array containing the maximum expected valuespublic DoubleFV normaliseFV(double min, double max)
normaliseFV in interface FeatureVectormin - the minimum expected valuemax - the maximum expected valuepublic DoubleFV normaliseFV()
normaliseFV in interface FeatureVectorpublic DoubleFV normaliseFV(double p)
normaliseFV in interface FeatureVectorp - the norm to computepublic DoubleFV asDoubleFV()
asDoubleFV in interface FeatureVectorpublic double[] asDoubleVector()
asDoubleVector in interface FeatureVectorpublic double compare(IntFV h, IntFVComparison method)
h - the feature to compare against.method - the method to compare with.public int length()
FeatureVectorlength in interface FeatureVectorpublic 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 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 IntFV concatenate(IntFV... ins)
Concatenatableconcatenate in interface Concatenatable<IntFV,IntFV>ins - the inputspublic IntFV concatenate(List<IntFV> ins)
Concatenatableconcatenate in interface Concatenatable<IntFV,IntFV>ins - the inputspublic IntFV subvector(int beginIndex)
ArrayFeatureVectorsubvector in class ArrayFeatureVector<int[]>beginIndex - the beginning index, inclusive.public IntFV subvector(int beginIndex, int endIndex)
ArrayFeatureVectorbeginIndex and extends to the
element at index endIndex - 1. Thus the length of the
subvector is endIndex-beginIndex.subvector in class ArrayFeatureVector<int[]>beginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.public 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 IntFV newInstance()
FeatureVectornewInstance in interface FeatureVector