jminhep.cluster
Class DataHolder
- java.lang.Object
-
- jminhep.cluster.DataHolder
-
- All Implemented Interfaces:
- java.io.Serializable
public class DataHolder extends java.lang.Object implements java.io.SerializableRepresents an abstraction for a data holder in many dimensional space. All cluster operations are done using this holder- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DataHolder()Creates a new empty instance of data holderDataHolder(DataPoint xMin, DataPoint xMax, int Dim, int Size)Creates data holder with random number Input:DataHolder(int dim)Creates a new empty instance of data pointDataHolder(java.lang.String name)Creates a new empty instance of data point
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(DataPoint p)Add a data point to the holdervoidadd(double[] xx)Add a new instance to data holder in form of arrayvoidanalyseSet()Analyse the data holder by calculating min and max.voidclear()Clear current data holdervoidfillRandom(DataPoint xMin, DataPoint xMax, int Dim, int Size)Fill an existing data holder with random numbersDataPoint[]getArray()Get the data in form of Arrayjava.util.ArrayListgetArrayList()Get all elements of the data holder in form of an ArrayListintgetDimention()Get the dimension of the datadouble[]getElement(int n)Get array of elements at position n of the data holderDataPointgetMax()Get Max values of the dataDataPointgetMin()Get Min values of the data holderjava.lang.StringgetName(int i)Get name of the i-th attributejava.lang.StringgetRelation()Get name of the data holder (i.e.DataPointgetRow(int n)Get DataPoint at the position nintgetSize()Get size of the data holderstatic voidmain(java.lang.String[] args)Main method -- to test the DataPoint classvoidprint()Print all entries of the data holdervoidread(java.lang.String file)Reads the input data from the ARFF file and stores in the data holdervoidsetDimention(int Dim)Set the dimension of the datavoidsetName(int i, java.lang.String title)Set the title for ith componentvoidsetRelation(java.lang.String s)Set relation (name) of the data holderjava.lang.StringtoString()Convert to string all entries of the data holder
-
-
-
Constructor Detail
-
DataHolder
public DataHolder()
Creates a new empty instance of data holder
-
DataHolder
public DataHolder(int dim)
Creates a new empty instance of data point- Parameters:
dim- dimension
-
DataHolder
public DataHolder(java.lang.String name)
Creates a new empty instance of data point- Parameters:
name- Name of this data holder
-
-
Method Detail
-
fillRandom
public void fillRandom(DataPoint xMin, DataPoint xMax, int Dim, int Size)
Fill an existing data holder with random numbers- Parameters:
xMin- Min DataPointxMax- Max DataPointDim- Dimension of DataPointSize- Number of rows
-
getArrayList
public java.util.ArrayList getArrayList()
Get all elements of the data holder in form of an ArrayList- Returns:
- ArrayList
-
getArray
public DataPoint[] getArray()
Get the data in form of Array- Returns:
- DataPoint[]
-
clear
public void clear()
Clear current data holder
-
add
public void add(DataPoint p)
Add a data point to the holder- Parameters:
p- New point
-
setRelation
public void setRelation(java.lang.String s)
Set relation (name) of the data holder- Parameters:
s- name to be set
-
add
public void add(double[] xx)
Add a new instance to data holder in form of array- Parameters:
xx- array
-
read
public void read(java.lang.String file)
Reads the input data from the ARFF file and stores in the data holder
-
getDimention
public int getDimention()
Get the dimension of the data- Returns:
- dimension (int)
-
setDimention
public void setDimention(int Dim)
Set the dimension of the data- Parameters:
Dim- dimension
-
analyseSet
public void analyseSet()
Analyse the data holder by calculating min and max. You can access these values by calling GetMin() anf GetMax()
-
getMin
public DataPoint getMin()
Get Min values of the data holder- Returns:
- DataPoint
-
getMax
public DataPoint getMax()
Get Max values of the data- Returns:
- DataPoint
-
getSize
public int getSize()
Get size of the data holder- Returns:
- Size of the data holder (int)
-
getRelation
public java.lang.String getRelation()
Get name of the data holder (i.e. relation)- Returns:
- name of the data holder
-
getName
public java.lang.String getName(int i)
Get name of the i-th attribute- Returns:
- Name of the attribute
-
setName
public void setName(int i, java.lang.String title)Set the title for ith component- Parameters:
i- Index of a componenttitle- New title
-
getElement
public double[] getElement(int n)
Get array of elements at position n of the data holder- Returns:
- array with the data at a position n (double[])
-
getRow
public DataPoint getRow(int n)
Get DataPoint at the position n- Returns:
- DataPoint
-
print
public void print()
Print all entries of the data holder
-
toString
public java.lang.String toString()
Convert to string all entries of the data holder- Overrides:
toStringin classjava.lang.Object
-
main
public static void main(java.lang.String[] args)
Main method -- to test the DataPoint class- Parameters:
args- command line arguments
-
-
DMelt 3.0 © DataMelt by jWork.ORG