public class Dataset
extends java.lang.Object
Class to manage data sets
, 1.1
Constructor and Description |
---|
Dataset()
Constructor, creates a new set of instances
|
Modifier and Type | Method and Description |
---|---|
void |
computeMostComon()
Calculate the values most commons for each column or attribute
|
java.lang.String |
copyHeaderTest()
Returns a string with the header of the file
|
int[][][] |
createCount()
Creates a matrix training set, stored for each class, each attribute, and each value
the number of examples of class C that have value V for the attribute A COUNT[C,V,A]
|
java.lang.String |
findNominalValue(int atr,
double valor)
Returns the nominal value of the double value of the attribute
|
int[] |
getC()
Returns the values for the out-put(class)
|
int |
getC(int pos)
Returns the value of the output attribute (class) for the example with the given index.
|
java.lang.String[] |
getC2()
Returns the values for the out-put(class)
|
InstanceSet |
getInstanceSet()
Returns the instance set
|
double[][] |
getListValues()
Gets for each attribute the sorted list of its possible values
|
int |
getMax(double[] num,
long seed)
Returns the index where is the maximum in an array of doubles
|
double[] |
getMaximum()
Returns an array with the maximum values of the in-put attributes
|
double[] |
getMinimum()
Returns an array with the minimum values of the in-put values
|
java.lang.String[] |
getNames()
Returns the name of the problem's variables
|
int |
getNClasses()
Returns the total number of classes
|
int |
getNData()
Return the number of examples
|
int |
getNInPuts()
Return the number of in-put variables
|
int[] |
getNumValues()
Returns for each attribute the number of different values
|
int[] |
getNumValues2()
Returns for each attribute the number of different values
|
int |
getNVariables()
Returns the number of variables
|
int[][] |
getOptimumClass(int[][][] Count,
long seed)
Returns a vector with the optimum class for each pair attribute-value
|
double[][] |
getX()
Return the values of the in-put attributes
|
double[] |
getX(int pos)
Return the values of the in-put attributes for an instance
|
java.lang.String[][] |
getX2()
Return the values of the in-put attributes
|
double[] |
getXNor(int pos)
Return the normalized values of the in-put attributes for an instance
|
java.lang.String[] |
giveClasses()
Returns teh value of the classes
|
boolean |
hayAtributosContinuos()
Checks if in the data base there is a in-put type real or continous
|
boolean |
isMissing(int i,
int j)
Checks if one attribute is lost or not
|
int |
mostCommon(int i)
Return the value most common of the attribute 'i'
|
void |
normalize()
Convert all the values of the set of values in the inetrval[0,1]
|
void |
readSet(java.lang.String nfejemplos,
boolean train)
Reads the file of examples(Train&Test)
|
boolean |
thereInstancesOfClass(int whichClass)
Checks if in the instances set left instances of a determined class
|
int[] |
typesVariable()
Return the types of each in-put(NOMINAL[0] o NUMERIC[1])
|
public double[][] getX()
Return the values of the in-put attributes
public java.lang.String[][] getX2()
Return the values of the in-put attributes
public double[] getX(int pos)
Return the values of the in-put attributes for an instance
pos
- The position of the instance in the set of valuespublic double[] getXNor(int pos)
Return the normalized values of the in-put attributes for an instance
pos
- The position of the instance in the set of valuespublic InstanceSet getInstanceSet()
public java.lang.String findNominalValue(int atr, double valor)
Returns the nominal value of the double value of the attribute
atr
- attribute id.valor
- attribute id.public boolean thereInstancesOfClass(int whichClass) throws java.lang.ArrayIndexOutOfBoundsException
Checks if in the instances set left instances of a determined class
whichClass
- The classjava.lang.ArrayIndexOutOfBoundsException
public double[][] getListValues()
Gets for each attribute the sorted list of its possible values
public int[][][] createCount()
Creates a matrix training set, stored for each class, each attribute, and each value the number of examples of class C that have value V for the attribute A COUNT[C,V,A]
public int[][] getOptimumClass(int[][][] Count, long seed)
Returns a vector with the optimum class for each pair attribute-value
Count
- each pair attribute-valueseed
- seed.public int getMax(double[] num, long seed)
Returns the index where is the maximum in an array of doubles
num
- array of doubles given.seed
- seedpublic int[] getNumValues()
Returns for each attribute the number of different values
public int[] getNumValues2()
Returns for each attribute the number of different values
public int[] getC()
Returns the values for the out-put(class)
public java.lang.String[] getC2()
Returns the values for the out-put(class)
public int getC(int pos)
pos
- index/position of the asked examplepublic double[] getMaximum()
Returns an array with the maximum values of the in-put attributes
public double[] getMinimum()
Returns an array with the minimum values of the in-put values
public int getNData()
Return the number of examples
public int getNVariables()
Returns the number of variables
public int getNInPuts()
Return the number of in-put variables
public int getNClasses()
Returns the total number of classes
public boolean isMissing(int i, int j)
Checks if one attribute is lost or not
i
- int Number of examplej
- int Number of attribuepublic void readSet(java.lang.String nfejemplos, boolean train) throws java.io.IOException
Reads the file of examples(Train&Test)
nfejemplos
- String Nom of the examples filetrain
- boolean True if Train set. False is test set.java.io.IOException
- A possible I/O errorpublic java.lang.String copyHeaderTest()
Returns a string with the header of the file
public void normalize()
Convert all the values of the set of values in the inetrval[0,1]
public int[] typesVariable()
Return the types of each in-put(NOMINAL[0] o NUMERIC[1])
public void computeMostComon()
Calculate the values most commons for each column or attribute
public int mostCommon(int i)
Return the value most common of the attribute 'i'
i
- int Number of the attributepublic java.lang.String[] getNames()
Returns the name of the problem's variables
public java.lang.String[] giveClasses()
Returns teh value of the classes
public boolean hayAtributosContinuos()
Checks if in the data base there is a in-put type real or continous