public class myDataset
extends java.lang.Object
Title: Dataset
Description: It contains the methods to read a Classification/Regression Dataset
Company: KEEL
Modifier and Type | Field and Description |
---|---|
static int |
INTEGER
Number to represent type of variable integer.
|
static int |
NOMINAL
Number to represent type of variable nominal.
|
static int |
REAL
Number to represent type of variable real or double.
|
Constructor and Description |
---|
myDataset()
Init a new set of instances
|
Modifier and Type | Method and Description |
---|---|
double |
average(int position)
It return the average of an specific attribute
|
java.lang.String |
claseMasFrecuente()
It returns the most frequent class in the dataset
|
void |
computeInstancesPerClass()
Counts and stores the number of instances that belong to each class.
|
java.lang.String |
copyHeader()
It copies the header of the dataset
|
double[][] |
devuelveRangos()
Returns the minimum and maximum values of every attributes as a matrix.
|
void |
discretize(int intervalos)
Discretizacion en anchura uniforme
|
double[] |
getemax()
It returns an array with the maximum values of the attributes
|
double[] |
getemin()
It returns an array with the minimum values of the attributes
|
double[] |
getExample(int pos)
Output a specific example
|
double |
getMax(int variable)
Gets the maximum value of the variable as argument.
|
double |
getMin(int variable)
Gets the minimum value of the variable as argument.
|
int |
getnClasses()
It gets the number of output attributes of the data-set (for example number of classes in classification)
|
int |
getnData()
It gets the size of the data-set
|
int |
getnInputs()
It gets the number of input attributes of the data-set
|
int |
getnVars()
It gets the number of variables of the data-set (including the output)
|
int[] |
getOutputAsInteger()
Returns the output of the data-set as integer values
|
int |
getOutputAsInteger(int pos)
It returns the output value of the example "pos"
|
double[] |
getOutputAsReal()
Returns the output of the data-set as real values
|
double |
getOutputAsReal(int pos)
It returns the output value of the example "pos"
|
java.lang.String[] |
getOutputAsString()
Returns the output of the data-set as nominal values
|
java.lang.String |
getOutputAsString(int pos)
It returns the output value of the example "pos"
|
java.lang.String |
getOutputValue(int intValue)
Returns the nominal output value which corresponds to the integer passed as argument.
|
int |
getTipo(int variable)
Returns the type of the attribute with index passed as argument.
|
double[][] |
getX()
Outputs an array of examples with their corresponding attribute values.
|
boolean |
hasMissingAttributes()
It checks if the data-set has any missing value
|
boolean |
hasNumericalAttributes()
Checks if the data-set has any numeric value.
|
boolean |
hasRealAttributes()
It checks if the data-set has any real value
|
boolean |
isMissing(int i,
int j)
This function checks if the attribute value is missing
|
java.lang.String |
nombreClase(int clase)
Returns the nominal value for a class represented by the integer given.
|
java.lang.String[] |
nombres()
It returns the names for all input variables
|
java.lang.String |
nombreVar(int pos)
It returns the attribute name of a given variable
|
void |
normalize()
It transform the input space into the [0,1] range
|
int |
numberInstances(int clas)
Returns the number of instances of the class with index passed as argument ("clas").
|
int |
numberValues(int attribute)
Returns the number of different values of the attribute with index passed as argument.
|
int |
numEjemplos(int clase)
It returns the number of instances in the data set for a given class.
|
void |
readClassificationSet(java.lang.String datasetFile,
boolean train)
It reads the whole input data-set and it stores each example and its associated output value in
local arrays to ease their use.
|
void |
readRegressionSet(java.lang.String datasetFile,
boolean train)
It reads the whole input data-set and it stores each example and its associated output value in
local arrays to ease their use.
|
int |
size()
Returns the total number of instances in the data-set.
|
int |
sizeWithoutMissing()
It return the size of the data-set without having account the missing values
|
double |
stdDev(int position)
It return the standard deviation of an specific attribute
|
int |
totalNominales(int atributo)
It returns the number of nominal values for a given variable
|
static java.lang.String |
valorNominal(int atributo,
double valorReal)
Returns a nominal representation of a attribute's real value given as argument.
|
static double |
valorReal(int atributo,
java.lang.String valorNominal)
Returns a real representation of a attribute's nominal value given as argument.
|
public static final int REAL
public static final int INTEGER
public static final int NOMINAL
public double[][] getX()
public double[] getExample(int pos)
pos
- int position (id) of the example in the data-setpublic int[] getOutputAsInteger()
public double[] getOutputAsReal()
public java.lang.String[] getOutputAsString()
public java.lang.String getOutputAsString(int pos)
pos
- int the position (id) of the examplepublic int getOutputAsInteger(int pos)
pos
- int the position (id) of the examplepublic double getOutputAsReal(int pos)
pos
- int the position (id) of the examplepublic double[] getemax()
public double[] getemin()
public double getMax(int variable)
variable
- index of the attribute/variable is being asked forpublic double getMin(int variable)
variable
- index of the attribute/variable is being asked forpublic int getnData()
public int getnVars()
public int getnInputs()
public int getnClasses()
public boolean isMissing(int i, int j)
i
- int Example idj
- int Variable idpublic void readClassificationSet(java.lang.String datasetFile, boolean train) throws java.io.IOException
datasetFile
- String name of the file containing the datasettrain
- boolean It must have the value "true" if we are reading the training data-setjava.io.IOException
- If there ocurs any problem with the reading of the data-setpublic void readRegressionSet(java.lang.String datasetFile, boolean train) throws java.io.IOException
datasetFile
- String name of the file containing the datasettrain
- boolean It must have the value "true" if we are reading the training data-setjava.io.IOException
- If there ocurs any problem with the reading of the data-setpublic java.lang.String copyHeader()
public void normalize()
public boolean hasRealAttributes()
public boolean hasNumericalAttributes()
public boolean hasMissingAttributes()
public int sizeWithoutMissing()
public int size()
public double stdDev(int position)
position
- int attribute id (position of the attribute)public double average(int position)
position
- int attribute id (position of the attribute)public void computeInstancesPerClass()
public int numberInstances(int clas)
clas
- Index of the class being asked.public int numberValues(int attribute)
attribute
- Index of the attribute being asked.public java.lang.String getOutputValue(int intValue)
intValue
- Integer value which determinate the nominal output.public int getTipo(int variable)
variable
- Index of the attribute.public double[][] devuelveRangos()
public java.lang.String nombreVar(int pos)
pos
- variable id.public java.lang.String nombreClase(int clase)
clase
- integer representation of the class.public void discretize(int intervalos)
intervalos
- int Numero de intervalos a discretizarpublic java.lang.String[] nombres()
public static double valorReal(int atributo, java.lang.String valorNominal)
atributo
- Attribute given.valorNominal
- Nominal value of the attribute given.public static java.lang.String valorNominal(int atributo, double valorReal)
atributo
- Attribute given.valorReal
- Real value of the attribute given.public int totalNominales(int atributo)
atributo
- variable idpublic java.lang.String claseMasFrecuente()
public int numEjemplos(int clase)
clase
- int Given class.