public class InputDatum
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
dim |
private java.lang.String |
label |
private int |
nonZeros |
private java.util.HashMap<java.lang.Object,java.lang.Object> |
properties |
private cern.colt.matrix.DoubleMatrix1D |
vector |
Constructor and Description |
---|
InputDatum(java.lang.String label,
double[] vector)
Constructs a new InputDatum.
|
InputDatum(java.lang.String label,
cern.colt.matrix.DoubleMatrix1D vector)
Constructs a new InputDatum.
|
InputDatum(java.lang.String label,
cern.colt.matrix.DoubleMatrix1D vector,
int nonZeros) |
Modifier and Type | Method and Description |
---|---|
void |
addProperty(java.lang.Object key,
java.lang.Object value)
Adds an arbitrary key/value property to the InputDatum.
|
(package private) void |
calculateFeatureDensity() |
boolean |
equals(java.lang.Object obj)
Compares two
InputDatum by both comparing the labels and vectors. |
int |
getDim()
Returns the dimensionality of the vector.
|
int |
getFeatureDensity() |
java.lang.String |
getLabel()
Returns the label of the InputDatum.
|
java.lang.Object |
getProperty(java.lang.Object key)
Returns the value of a property specified by the key or
null if the key does not exist. |
cern.colt.matrix.DoubleMatrix1D |
getVector()
Returns the vector of the InputDatum.
|
java.lang.String |
toString()
Returns a String representation of this
InputDatum as labelName[vector] . |
private java.lang.String label
private cern.colt.matrix.DoubleMatrix1D vector
private int dim
private java.util.HashMap<java.lang.Object,java.lang.Object> properties
private int nonZeros
public InputDatum(java.lang.String label, cern.colt.matrix.DoubleMatrix1D vector)
label
- The label of the input datum. Basically this should be a sort of unique id.vector
- The vector holding the values.public InputDatum(java.lang.String label, double[] vector)
label
- The label of the input datum. Basically this should be a sort of unique id.vector
- The vector holding the values, this time as a double[].public InputDatum(java.lang.String label, cern.colt.matrix.DoubleMatrix1D vector, int nonZeros)
public java.lang.String getLabel()
public cern.colt.matrix.DoubleMatrix1D getVector()
public int getDim()
public java.lang.Object getProperty(java.lang.Object key)
null
if the key does not exist.key
- The property key.public void addProperty(java.lang.Object key, java.lang.Object value)
null
, the property is removed.key
- The property key.value
- The property value.public java.lang.String toString()
InputDatum
as labelName[vector]
.toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
InputDatum
by both comparing the labels and vectors.equals
in class java.lang.Object
public int getFeatureDensity()
void calculateFeatureDensity()