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.
|
protected double[][] |
X
examples array.
|
Constructor and Description |
---|
myDataset()
Init a new set of instances
|
myDataset(myDataset copia,
int positiva)
It generates a new binary dataset for the OVA scheme
|
myDataset(myDataset copy,
int class_1,
int class_2)
It generates a new binary dataset for the OVO scheme
|
myDataset(myDataset copy,
int class_1,
int class_2,
int[] ties)
It generates a new binary dataset for the OVO scheme (NESTING)
|
Modifier and Type | Method and Description |
---|---|
double |
average(int position)
It return the average of an specific attribute
|
java.lang.String |
className(int clase)
Returns the nominal value for a class represented by the integer given.
|
void |
computeInstancesPerClass()
It computes the number of examples per class.
|
void |
computeStatisticsPerClass()
It computes the average and standard deviation of the input attributes
|
java.lang.String |
copyHeader()
It copies the header of the dataset
|
void |
discretize(int intervalos)
Uniform width discretization
|
java.lang.String |
doHeader()
It prints the header of a dataset into KEEL format
|
boolean |
empty()
To compute whether the dataset is empty
|
double[][] |
getAveragePerClass()
Returns the average values per class.
|
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)
It returns the maximum value of the given attribute
|
double |
getMin(int variable)
It returns the minimum value of the given attribute
|
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)
It returns the output value (string) which matchs with a given integer value
|
double[][] |
getRanges()
Returns the minimum and maximum values of every attributes as a matrix.
|
double[][] |
getStdPerClass()
Returns the standard deviation per class.
|
int |
getTipo(int variable)
It returns the type of an attribute
|
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()
It checks if the data-set has any numerical value
|
boolean |
hasRealAttributes()
It checks if the data-set has any real value
|
double |
ir()
It computes the Imbalance Ratio
|
boolean |
isMissing(int i,
int j)
This function checks if the attribute value is missing
|
java.lang.String |
mostFrequentClass()
It returns the most frequent class in the dataset
|
int |
n_minoritaria()
It returns the number of minority class examples
|
java.lang.String[] |
names()
It returns the names for all input variables
|
static java.lang.String |
nominalValue(int atributo,
double valorReal)
Returns a nominal representation of a attribute's real value given as argument.
|
void |
normalize_statistics()
It transforms the input space into the [0,1] range, but it is stored in X_normalized.
|
void |
normalize()
It transforms the input space into the [0,1] range
|
int |
numberInstances(int clas)
It returns the number of instances in the data set for a given class.
|
int |
numberOfExamples(int clase)
It obtains the number of examples for the i-th class
|
int |
numberValues(int attribute)
Function to get the number of different feasible values for a given attribute
|
int |
numericClass(java.lang.String valorNominal)
Returns a numeric representation of a class nominal value given as argument.
|
java.lang.String |
printDataSet(boolean ova)
It prints the dataset into an string
|
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.
|
static double |
realValue(int atributo,
java.lang.String valorNominal)
Returns a real representation of a attribute's nominal value given as argument.
|
int |
size()
It return the size of 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 |
totalNominals(int attribute)
It returns the number of nominal values for a given variable
|
java.lang.String |
varName(int pos)
It returns the attribute name of a given variable
|
public static final int REAL
public static final int INTEGER
public static final int NOMINAL
protected double[][] X
public myDataset()
public myDataset(myDataset copy, int class_1, int class_2)
copy
- the original training datasetclass_1
- first classclass_2
- second classpublic myDataset(myDataset copia, int positiva)
copia
- the original training datasetpositiva
- primary class (against the rest)public myDataset(myDataset copy, int class_1, int class_2, int[] ties)
copy
- the original training datasetclass_1
- first classclass_2
- second classties
- number of tiespublic 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
- the index of the attributepublic double getMin(int variable)
variable
- the index of the attributepublic 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 normalize()
public void normalize_statistics()
public void computeStatisticsPerClass()
public double[][] getAveragePerClass()
public double[][] getStdPerClass()
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
- int Given class.public int numberValues(int attribute)
attribute
- int Given attributepublic java.lang.String getOutputValue(int intValue)
intValue
- int Given valuepublic int getTipo(int variable)
variable
- Given attributepublic double[][] getRanges()
public java.lang.String varName(int pos)
pos
- variable id.public java.lang.String className(int clase)
clase
- integer representation of the class.public void discretize(int intervalos)
intervalos
- int Number of intervalspublic java.lang.String[] names()
public static double realValue(int atributo, java.lang.String valorNominal)
atributo
- Attribute given.valorNominal
- Nominal value of the attribute given.public int numericClass(java.lang.String valorNominal)
valorNominal
- class nominal value.public static java.lang.String nominalValue(int atributo, double valorReal)
atributo
- Attribute given.valorReal
- Real value of the attribute given.public int totalNominals(int attribute)
attribute
- variable idpublic java.lang.String mostFrequentClass()
public int n_minoritaria()
public double ir()
public int numberOfExamples(int clase)
clase
- int class idpublic boolean empty()
public java.lang.String doHeader()
public java.lang.String copyHeader()
public java.lang.String printDataSet(boolean ova)
ova
- a boolean variable for the OVO or OVA case. In the latter the attributes will be removed from static (new classes!)