public class LearningData extends java.lang.Object implements LearningDataModel
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList |
dataKeys
ArrayList contains node or data key names.
|
protected java.util.ArrayList |
dataList
ArrayList contains learning data
|
Constructor and Description |
---|
LearningData(java.util.ArrayList dataSets)
Creates a new instance of LearningData.
|
LearningData(java.lang.String fileName,
java.lang.String separator)
Creates a new instance of LearningData.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getData(int index)
Return a data row as a double array.
|
java.lang.String |
getDataKey(int index)
Return the unique keys for the specified data row.
|
java.util.ArrayList |
getDataKeys()
Return the list of unique keys, one for each data row.
|
java.util.ArrayList |
getDataset()
Return the full dataset.
|
int |
getDataSize()
Return numbers of data
|
int |
getVectorSize()
Return length of the vector
|
java.lang.String |
toString()
Return a string representation of the data.
|
protected java.util.ArrayList dataKeys
protected java.util.ArrayList dataList
public LearningData(java.util.ArrayList dataSets) throws java.lang.Exception
dataSets
- the data to read as lists of key-value pair Hashtables. Each nodes therefore
stores a keyed data value to other nodes and the input must be constant this way at the moment.
The key defines the relating node name and value is a single data value, that should currently
be of type double. The value are then made into a data row and stored in the knn dataset, where the
first time a list is read, the node names are also stored, so that a new set of data can be added
in the same order.java.lang.Exception
- any error.public LearningData(java.lang.String fileName, java.lang.String separator) throws java.lang.Exception
fileName
- path to the file with dataseparator
- the data value separator.java.lang.Exception
- any error.public java.util.ArrayList getDataKeys()
getDataKeys
in interface LearningDataModel
public java.lang.String getDataKey(int index)
getDataKey
in interface LearningDataModel
index
- the row index, starting at 0.public java.util.ArrayList getDataset()
getDataset
in interface LearningDataModel
public double[] getData(int index)
getData
in interface LearningDataModel
index
- the row index, starting at 0.public java.lang.String toString()
toString
in interface LearningDataModel
toString
in class java.lang.Object
public int getDataSize()
getDataSize
in interface LearningDataModel
public int getVectorSize()