public class DoubleFV extends ArrayFeatureVector<double[]> implements Concatenatable<DoubleFV,DoubleFV>, Cloneable
values| Constructor and Description |
|---|
DoubleFV()
Construct an empty feature vector
|
DoubleFV(double[] values)
Construct from flattened values array and dimensions
|
DoubleFV(int nbins)
Construct empty FV with given number of bins
|
| 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.
|
DoubleFV |
clone() |
double |
compare(DoubleFV h,
DoubleFVComparison method)
Compare this FV to another with the given method.
|
DoubleFV |
concatenate(DoubleFV... ins)
Concatenate all the inputs with this, returning a new object that is the
result of the concatenation.
|
DoubleFV |
concatenate(List<DoubleFV> ins)
Concatenate all the inputs with this, returning a new object that is the
result of the concatenation.
|
boolean |
equals(Object obj) |
double |
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
|
DoubleFV |
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
|
DoubleFV |
subvector(int beginIndex)
Returns a new featurevector that is a subsequence of this vector.
|
DoubleFV |
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 DoubleFV()
public DoubleFV(int nbins)
nbins - the number of bins in each dimensionpublic DoubleFV(double[] values)
values - the flat array of valuespublic double 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(DoubleFV h, DoubleFVComparison 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 DoubleFV concatenate(DoubleFV... ins)
Concatenatableconcatenate in interface Concatenatable<DoubleFV,DoubleFV>ins - the inputspublic DoubleFV concatenate(List<DoubleFV> ins)
Concatenatableconcatenate in interface Concatenatable<DoubleFV,DoubleFV>ins - the inputspublic DoubleFV subvector(int beginIndex)
ArrayFeatureVectorsubvector in class ArrayFeatureVector<double[]>beginIndex - the beginning index, inclusive.public DoubleFV 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<double[]>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 DoubleFV newInstance()
FeatureVectornewInstance in interface FeatureVector