public class myDataset
extends java.lang.Object
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 |
---|---|
java.lang.String[] |
clases()
Returns the different classes in the data-set.
|
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.
|
int[] |
getemax()
It returns an array with the maximum values of the attributes.
|
int[] |
getemin()
It returns an array with the minimum values of the attributes.
|
int[] |
getExample(int pos)
Output a specific example.
|
java.lang.String |
getInputAsString(int var,
int pos)
It returns the input value of the example "pos" as string.
|
int |
getMax(int variable)
Gets the maximum value of the variable as argument.
|
int |
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.
|
int[][] |
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.
|
boolean |
isNominal(int i)
This function checks if the attribute value is nominal.
|
java.lang.String[] |
names()
Returns the names of the different attributes of the data-set.
|
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.
|
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.
|
int[] |
returnNumberInstances()
Returns an Array with the number of instances that belong to each class.
|
int[][] |
returnRanks()
Returns the minimum and maximum values of every attributes as a matrix.
|
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.
|
public static final int REAL
public static final int INTEGER
public static final int NOMINAL
public int[][] getX()
public int[] getExample(int pos)
pos
- 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
- the position (id) of the examplepublic java.lang.String getInputAsString(int var, int pos)
var
- the variable (id) of the examplepos
- the position (id) of the examplepublic int getOutputAsInteger(int pos)
pos
- the position (id) of the examplepublic double getOutputAsReal(int pos)
pos
- the position (id) of the examplepublic int[] getemax()
public int[] getemin()
public int getMax(int variable)
variable
- index of the attribute/variable is being asked forpublic int 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
- Example idj
- Variable idpublic boolean isNominal(int i)
i
- attribute idpublic void readClassificationSet(java.lang.String datasetFile, boolean train) throws java.io.IOException
datasetFile
- name of the file containing the datasettrain
- 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 boolean hasRealAttributes()
public boolean hasNumericalAttributes()
public boolean hasMissingAttributes()
public int sizeWithoutMissing()
public int size()
public void computeInstancesPerClass()
public int numberInstances(int clas)
clas
- Index of the class being asked.public int[] returnNumberInstances()
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 int[][] returnRanks()
public java.lang.String[] names()
public java.lang.String[] clases()