Catalano.MachineLearning.Dataset
Class DatasetRegression
- java.lang.Object
-
- Catalano.MachineLearning.Dataset.DatasetRegression
-
- All Implemented Interfaces:
- IDataset<double[][],double[]>, java.io.Serializable
public class DatasetRegression extends java.lang.Object implements IDataset<double[][],double[]>
Dataset for regression.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DatasetRegression(java.lang.String filepath)Initializes a new instance of the DatasetRegression class.DatasetRegression(java.lang.String name, double[][] input, double[] output)Initializes a new instance of the DatasetClassification class.DatasetRegression(java.lang.String name, double[][] input, double[] output, DecisionVariable[] attributes)Initializes a new instance of the DatasetClassification class.DatasetRegression(java.lang.String filepath, java.lang.String name)Initializes a new instance of the DatasetRegression class.DatasetRegression(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo)Initializes a new instance of the DatasetRegression class.DatasetRegression(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo, int classIndex)Initializes a new instance of the DatasetRegression class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static DatasetRegressionFromCSV(java.lang.String filepath, java.lang.String name)Read dataset from a CSV structure.static DatasetRegressionFromCSV(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo)Read dataset from a CSV structure.static DatasetRegressionFromCSV(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo, int classIndex)Construct a dataset from an CSV file.DecisionVariable[]getAllDecisionVariables()Get the decision variables including the output.intgetClassIndex()Get class index.DecisionVariable[]getDecisionVariables()Get the decision variables.double[][]getInput()Get the input data.java.lang.StringgetName()Get the name of the dataset.intgetNumberOfAttributes()Get the number of attributes.intgetNumberOfContinuous()Get the number of type continuous.intgetNumberOfDiscrete()Get the number of type discrete.intgetNumberOfInstances()Get the number of instances.double[]getOutput()Get the output data.StatisticsDataset[]getStatistics()Get the statistics from the dataset.voidKeepAttributes(int[] indexes)Keep the selected attributes and remove the rest.double[][]Normalize()Normalize all continuous data.double[][]Normalize(double min, double max)Normalize all continuous data.voidRemoveAttribute(int index)Remove an attribute.voidRemoveAttributes(int[] indexes)Remove selected attributes.voidsetClassIndex(int classIndex)Set class index.voidsetInput(double[][] input, DecisionVariable[] variables)Set the input data.DatasetRegressionSplit(float percentage)Split the percentange of the dataset in Trainning and the rest in Validation.DatasetRegressionSplit(float percentage, java.lang.String name)Split the percentange of the dataset in Trainning and the rest in Validation.double[][]Standartize()Standartize all continuous data.voidWriteAsARFF(java.lang.String filename)Write dataset as ARFF file.voidWriteAsARFF(java.lang.String filename, int decimalPlaces)Write dataset as ARFF file.voidWriteAsCSV(java.lang.String filename)Write the dataset as CSV file.voidWriteAsCSV(java.lang.String filename, int decimalPlaces)Write the dataset as CSV file.voidWriteAsCSV(java.lang.String filename, int decimalPlaces, char delimiter)Write the dataset as CSV file.voidWriteAsCSV(java.lang.String filename, int decimalPlaces, char delimiter, java.lang.String newLine)Write the dataset as CSV file.voidWriteAsCSV(java.lang.String filename, int decimalPlaces, char delimiter, java.lang.String newLine, boolean writeHeader)Write the dataset as CSV file.
-
-
-
Constructor Detail
-
DatasetRegression
public DatasetRegression(java.lang.String filepath)
Initializes a new instance of the DatasetRegression class.- Parameters:
filepath- File path.
-
DatasetRegression
public DatasetRegression(java.lang.String filepath, java.lang.String name)Initializes a new instance of the DatasetRegression class.- Parameters:
filepath- File path.name- Name of the dataset.
-
DatasetRegression
public DatasetRegression(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo)Initializes a new instance of the DatasetRegression class.- Parameters:
filepath- File path.name- Name of the data.ignoreAttributeInfo- Ignore attribute information.
-
DatasetRegression
public DatasetRegression(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo, int classIndex)Initializes a new instance of the DatasetRegression class.- Parameters:
filepath- File path.name- Name of the dataset.ignoreAttributeInfo- Ignore attribute information.classIndex- Output index.
-
DatasetRegression
public DatasetRegression(java.lang.String name, double[][] input, double[] output)Initializes a new instance of the DatasetClassification class.- Parameters:
name- Name of the dataset.input- Input data.output- Output data.
-
DatasetRegression
public DatasetRegression(java.lang.String name, double[][] input, double[] output, DecisionVariable[] attributes)Initializes a new instance of the DatasetClassification class.- Parameters:
name- Name of the dataset.attributes- Decision variables.input- Input data.output- Output data.
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name of the dataset.- Returns:
- Name.
-
getInput
public double[][] getInput()
Get the input data.
-
getOutput
public double[] getOutput()
Get the output data.
-
getClassIndex
public int getClassIndex()
Get class index.- Returns:
- Class index.
-
setClassIndex
public void setClassIndex(int classIndex)
Set class index.- Parameters:
classIndex- Class index.
-
getDecisionVariables
public DecisionVariable[] getDecisionVariables()
Get the decision variables.- Specified by:
getDecisionVariablesin interfaceIDataset<double[][],double[]>- Returns:
- Decision Variables.
-
getAllDecisionVariables
public DecisionVariable[] getAllDecisionVariables()
Get the decision variables including the output.- Returns:
- Decision Variables.
-
getNumberOfInstances
public int getNumberOfInstances()
Get the number of instances.- Returns:
- Number of instances.
-
getNumberOfAttributes
public int getNumberOfAttributes()
Get the number of attributes.- Returns:
- Number of attributes.
-
getNumberOfContinuous
public int getNumberOfContinuous()
Get the number of type continuous.- Returns:
- Number of type continuous.
-
getNumberOfDiscrete
public int getNumberOfDiscrete()
Get the number of type discrete.- Returns:
- Number of type discrete.
-
FromCSV
public static DatasetRegression FromCSV(java.lang.String filepath, java.lang.String name)
Read dataset from a CSV structure. The last column of CSV is interpreted as output.- Parameters:
filepath- File path.name- Name of the dataset.- Returns:
- Classification Dataset.
-
FromCSV
public static DatasetRegression FromCSV(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo)
Read dataset from a CSV structure. The last column of CSV is interpreted as output.- Parameters:
filepath- File path.name- Name of the dataset.- Returns:
- Classification Dataset.
-
FromCSV
public static DatasetRegression FromCSV(java.lang.String filepath, java.lang.String name, boolean ignoreAttributeInfo, int classIndex)
Construct a dataset from an CSV file.- Parameters:
filepath- File.name- Name of the dataset.ignoreAttributeInfo- Ignore attribute information.classIndex- Index of the attribute for to be setup as output.- Returns:
- ClassificationDataset.
-
Normalize
public double[][] Normalize()
Normalize all continuous data. Default: (0..1).- Returns:
- Range of the normalization.
-
Normalize
public double[][] Normalize(double min, double max)Normalize all continuous data.- Parameters:
min- Minimum.max- Maximum.- Returns:
- Range of the normalization.
-
RemoveAttribute
public void RemoveAttribute(int index)
Remove an attribute.- Parameters:
index- Index of the attribute.
-
RemoveAttributes
public void RemoveAttributes(int[] indexes)
Remove selected attributes.- Parameters:
indexes- Indexes of the attributes.
-
KeepAttributes
public void KeepAttributes(int[] indexes)
Keep the selected attributes and remove the rest.- Parameters:
indexes- Indexes of the attributes.
-
Split
public DatasetRegression Split(float percentage)
Split the percentange of the dataset in Trainning and the rest in Validation.- Parameters:
percentage- Percentage.- Returns:
- Validation dataset.
-
Split
public DatasetRegression Split(float percentage, java.lang.String name)
Split the percentange of the dataset in Trainning and the rest in Validation.- Parameters:
percentage- Percentage.name- Name of the validation dataset.- Returns:
- Validation dataset.
-
Standartize
public double[][] Standartize()
Standartize all continuous data. x = (x - u) / s- Returns:
- Range of standartization.
-
getStatistics
public StatisticsDataset[] getStatistics()
Description copied from interface:IDatasetGet the statistics from the dataset.- Specified by:
getStatisticsin interfaceIDataset<double[][],double[]>- Returns:
- Statistics.
-
WriteAsCSV
public void WriteAsCSV(java.lang.String filename)
Write the dataset as CSV file.- Parameters:
filename- Filename.
-
WriteAsCSV
public void WriteAsCSV(java.lang.String filename, int decimalPlaces)Write the dataset as CSV file.- Parameters:
filename- Filename.decimalPlaces- Decimal places for continous data.
-
WriteAsCSV
public void WriteAsCSV(java.lang.String filename, int decimalPlaces, char delimiter)Write the dataset as CSV file.- Parameters:
filename- Filename.decimalPlaces- Decimal places for continous data.delimiter- Delimiter.
-
WriteAsCSV
public void WriteAsCSV(java.lang.String filename, int decimalPlaces, char delimiter, java.lang.String newLine)Write the dataset as CSV file.- Parameters:
filename- Filename.decimalPlaces- Decimal places.delimiter- Delimiter.newLine- Newline char.
-
WriteAsCSV
public void WriteAsCSV(java.lang.String filename, int decimalPlaces, char delimiter, java.lang.String newLine, boolean writeHeader)Write the dataset as CSV file.- Parameters:
filename- Filename.decimalPlaces- Decimal places.delimiter- Delimiter.newLine- Newline char.writeHeader- Write the header of the dataset.
-
WriteAsARFF
public void WriteAsARFF(java.lang.String filename)
Write dataset as ARFF file.- Parameters:
filename- Filename.
-
WriteAsARFF
public void WriteAsARFF(java.lang.String filename, int decimalPlaces)Write dataset as ARFF file.- Parameters:
filename- Filename.decimalPlaces- Decimal places.
-
setInput
public void setInput(double[][] input, DecisionVariable[] variables)Description copied from interface:IDatasetSet the input data.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG