org.encog.ml.model
Class EncogModel
- java.lang.Object
-
- org.encog.ml.model.EncogModel
-
public class EncogModel extends java.lang.ObjectEncog model is designed to allow you to easily swap between different model types and automatically normalize data. It is designed to work with a VersatileMLDataSet only.
-
-
Constructor Summary
Constructors Constructor and Description EncogModel(VersatileMLDataSet theDataset)Construct a model for the specified dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecalculateError(MLMethod method, MLDataSet data)Calculate the error for the given method and dataset.MLMethodcreateMethod()Create the selected method.MLMethodcrossvalidate(int k, boolean shuffle)Crossvalidate and fit.VersatileMLDataSetgetDataset()java.util.List<ColumnDefinition>getInputFeatures()java.util.Map<java.lang.String,MethodConfig>getMethodConfigurations()java.util.List<ColumnDefinition>getPredictedFeatures()StatusReportablegetReport()MatrixMLDataSetgetTrainingDataset()MatrixMLDataSetgetValidationDataset()voidholdBackValidation(double validationPercent, boolean shuffle, int seed)Specify a validation set to hold back.voidselectMethod(VersatileMLDataSet dataset, java.lang.String methodType)Select the method to create.voidselectMethod(VersatileMLDataSet dataset, java.lang.String methodType, java.lang.String methodArgs, java.lang.String trainingType, java.lang.String trainingArgs)Select the method to use.voidselectTraining(VersatileMLDataSet dataset, java.lang.String trainingType, java.lang.String trainingArgs)Select the training to use.voidselectTrainingType(VersatileMLDataSet dataset)Select the training type.voidsetReport(StatusReportable report)voidsetTrainingDataset(MatrixMLDataSet trainingDataset)voidsetValidationDataset(MatrixMLDataSet validationDataset)MLRegressiontrain(boolean shuffle)MLRegressiontrain(int iterations, boolean shuffle)
-
-
-
Constructor Detail
-
EncogModel
public EncogModel(VersatileMLDataSet theDataset)
Construct a model for the specified dataset.- Parameters:
theDataset- The dataset.
-
-
Method Detail
-
getDataset
public VersatileMLDataSet getDataset()
- Returns:
- the dataset
-
getInputFeatures
public java.util.List<ColumnDefinition> getInputFeatures()
- Returns:
- the inputFeatures
-
getPredictedFeatures
public java.util.List<ColumnDefinition> getPredictedFeatures()
- Returns:
- the predictedFeatures
-
holdBackValidation
public void holdBackValidation(double validationPercent, boolean shuffle, int seed)Specify a validation set to hold back.- Parameters:
validationPercent- The percent to use for validation.shuffle- True to shuffle.seed- The seed for random generation.
-
calculateError
public double calculateError(MLMethod method, MLDataSet data)
Calculate the error for the given method and dataset.- Parameters:
method- The method to use.data- The data to use.- Returns:
- The error.
-
crossvalidate
public MLMethod crossvalidate(int k, boolean shuffle)
Crossvalidate and fit.- Parameters:
k- The number of folds.shuffle- True if we should shuffle.- Returns:
- The trained method.
-
getTrainingDataset
public MatrixMLDataSet getTrainingDataset()
- Returns:
- the trainingDataset
-
setTrainingDataset
public void setTrainingDataset(MatrixMLDataSet trainingDataset)
- Parameters:
trainingDataset- the trainingDataset to set
-
getValidationDataset
public MatrixMLDataSet getValidationDataset()
- Returns:
- the validationDataset
-
setValidationDataset
public void setValidationDataset(MatrixMLDataSet validationDataset)
- Parameters:
validationDataset- the validationDataset to set
-
selectMethod
public void selectMethod(VersatileMLDataSet dataset, java.lang.String methodType, java.lang.String methodArgs, java.lang.String trainingType, java.lang.String trainingArgs)
Select the method to use.- Parameters:
dataset- The dataset.methodType- The type of method.methodArgs- The method arguments.trainingType- The training type.trainingArgs- The training arguments.
-
createMethod
public MLMethod createMethod()
Create the selected method.- Returns:
- The created method.
-
selectMethod
public void selectMethod(VersatileMLDataSet dataset, java.lang.String methodType)
Select the method to create.- Parameters:
dataset- The dataset.methodType- The method type.
-
selectTrainingType
public void selectTrainingType(VersatileMLDataSet dataset)
Select the training type.- Parameters:
dataset- The dataset.
-
selectTraining
public void selectTraining(VersatileMLDataSet dataset, java.lang.String trainingType, java.lang.String trainingArgs)
Select the training to use.- Parameters:
dataset- The dataset.trainingType- The type of training.trainingArgs- The training arguments.
-
getMethodConfigurations
public java.util.Map<java.lang.String,MethodConfig> getMethodConfigurations()
- Returns:
- the methodConfigurations
-
getReport
public StatusReportable getReport()
- Returns:
- the report
-
setReport
public void setReport(StatusReportable report)
- Parameters:
report- the report to set
-
train
public MLRegression train(boolean shuffle)
-
train
public MLRegression train(int iterations, boolean shuffle)
-
-
DMelt 3.0 © DataMelt by jWork.ORG