org.encog.ml.data.sparse
Class SparseMLData
- java.lang.Object
-
- org.encog.ml.data.sparse.SparseMLData
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, MLData, CentroidFactory<MLData>
public class SparseMLData extends java.lang.Object implements MLData, java.io.Serializable, java.lang.Cloneable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SparseMLData(double[] d)Construct this object with the specified data.SparseMLData(double[] d, int[] i)Construct this object with the specified data.SparseMLData(int size)Construct this object with blank data and a specified size.SparseMLData(MLData d)Construct a new BasicMLData object from an existing one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int index, double value)Add a value to the specified index.voidclear()Clear any data to zero.MLDataclone()Clone this object.Centroid<MLData>createCentroid()intfindIndex(int index)double[]getData()doublegetData(int index)Get the element specified index value.double[]getSparseData()int[]getSparseIndex()voidsetData(double[] theData)Set all of the data as an array of doubles.voidsetData(int index, double d)Set the specified element.intsize()java.lang.StringtoString()
-
-
-
Constructor Detail
-
SparseMLData
public SparseMLData(double[] d)
Construct this object with the specified data.- Parameters:
d- The data to construct this object with.
-
SparseMLData
public SparseMLData(double[] d, int[] i)Construct this object with the specified data.- Parameters:
d- The data to construct this object with.i- The index.
-
SparseMLData
public SparseMLData(int size)
Construct this object with blank data and a specified size.- Parameters:
size- The amount of data to store.
-
SparseMLData
public SparseMLData(MLData d)
Construct a new BasicMLData object from an existing one. This makes a copy of an array.- Parameters:
d- The object to be copied.
-
-
Method Detail
-
findIndex
public int findIndex(int index)
-
add
public void add(int index, double value)Add a value to the specified index.
-
clone
public MLData clone()
Clone this object.
-
getData
public double[] getData()
-
getData
public double getData(int index)
Get the element specified index value.
-
setData
public void setData(double[] theData)
Set all of the data as an array of doubles.
-
setData
public void setData(int index, double d)Set the specified element.
-
size
public int size()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getSparseIndex
public int[] getSparseIndex()
-
getSparseData
public double[] getSparseData()
-
createCentroid
public Centroid<MLData> createCentroid()
- Specified by:
createCentroidin interfaceCentroidFactory<MLData>- Returns:
- The centroid.
-
-
DMelt 3.0 © DataMelt by jWork.ORG