org.encog.ml.data.basic
Class BasicMLData
- java.lang.Object
-
- org.encog.ml.data.basic.BasicMLData
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, MLData, CentroidFactory<MLData>
- Direct Known Subclasses:
- BasicNeuralData, ImageMLData
public class BasicMLData extends java.lang.Object implements MLData, java.io.Serializable, java.lang.Cloneable
Basic implementation of the MLData interface that stores the data in an array.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BasicMLData(double[] d)Construct this object with the specified data.BasicMLData(int size)Construct this object with blank data and a specified size.BasicMLData(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()double[]getData()doublegetData(int index)Get the element specified index value.MLDataminus(MLData o)Subtract one data element from another.MLDataplus(MLData o)Add one data element to another.voidsetData(double[] theData)Set all of the data as an array of doubles.voidsetData(int index, double d)Set the specified element.intsize()MLDatathreshold(double thresholdValue, double lowValue, double highValue)Apply a thresholding function to the data elements.MLDatatimes(double d)Multiply one data element with another.java.lang.StringtoString()
-
-
-
Constructor Detail
-
BasicMLData
public BasicMLData(double[] d)
Construct this object with the specified data.- Parameters:
d- The data to construct this object with.
-
BasicMLData
public BasicMLData(int size)
Construct this object with blank data and a specified size.- Parameters:
size- The amount of data to store.
-
BasicMLData
public BasicMLData(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
-
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
-
createCentroid
public Centroid<MLData> createCentroid()
- Specified by:
createCentroidin interfaceCentroidFactory<MLData>- Returns:
- The centroid.
-
plus
public MLData plus(MLData o)
Add one data element to another. This does not modify the object.- Parameters:
o- The other data element- Returns:
- The result.
-
times
public MLData times(double d)
Multiply one data element with another. This does not modify the object.- Parameters:
d- The other data element- Returns:
- The result.
-
minus
public MLData minus(MLData o)
Subtract one data element from another. This does not modify the object.- Parameters:
o- The other data element- Returns:
- The result.
-
threshold
public MLData threshold(double thresholdValue, double lowValue, double highValue)
Apply a thresholding function to the data elements. This does not modify the object.- Parameters:
thresholdValue- the value to which elements are comparedlowValue- the value to use if ≤ thresholdhighValue- the value to use if ≥ threshold- Returns:
- The result.
-
-
DMelt 3.0 © DataMelt by jWork.ORG