org.encog.util.simple
Class EncogUtility
- java.lang.Object
-
- org.encog.util.simple.EncogUtility
-
public final class EncogUtility extends java.lang.ObjectGeneral utility class for Encog. Provides for some common Encog procedures.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classEncogUtility.FalsePositiveReport
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static doublecalculateClassificationError(MLClassification method, MLDataSet data)Calculate the classification error.static EncogUtility.FalsePositiveReportcalculatePositiveNegative(MLRegression method, MatrixMLDataSet data)static doublecalculateRegressionError(MLRegression method, MLDataSet data)static voidconvertCSV2Binary(java.io.File csvFile, CSVFormat format, java.io.File binFile, int[] input, int[] ideal, boolean headers)static voidconvertCSV2Binary(java.io.File csvFile, java.io.File binFile, int inputCount, int outputCount, boolean headers)Convert a CSV file to a binary training file.static voidconvertCSV2Binary(java.lang.String csvFile, java.lang.String binFile, int inputCount, int outputCount, boolean headers)Convert a CSV file to a binary training file.static voidevaluate(MLRegression network, MLDataSet training)Evaluate the network and display (to the console) the output for every value in the training set.static voidexplainErrorMSE(MLRegression method, MatrixMLDataSet training)static voidexplainErrorRMS(MLRegression method, MatrixMLDataSet training)static java.lang.StringformatNeuralData(MLData data)Format neural data as a list of numbers.static MLDataSetloadCSV2Memory(java.lang.String filename, int input, int ideal, boolean headers, CSVFormat format, boolean significance)Load CSV to memory.static MLDataSetloadEGB2Memory(java.io.File filename)static voidsaveCSV(java.io.File targetFile, CSVFormat format, MLDataSet set)static voidsaveEGB(java.io.File f, MLDataSet data)Save a training set to an EGB file.static BasicNetworksimpleFeedForward(int input, int hidden1, int hidden2, int output, boolean tanh)Create a simple feedforward neural network.static MLDataSet[]splitTrainValidate(MLDataSet trainingSet, GenerateRandom rnd, double trainingPercent)static voidtrainConsole(BasicNetwork network, MLDataSet trainingSet, int minutes)Train the neural network, using SCG training, and output status to the console.static voidtrainConsole(MLTrain train, BasicNetwork network, MLDataSet trainingSet, int minutes)Train the network, using the specified training algorithm, and send the output to the console.static voidtrainToError(MLMethod method, MLDataSet dataSet, double error)Train the method, to a specific error, send the output to the console.static voidtrainToError(MLTrain train, double error)Train to a specific error, using the specified training method, send the output to the console.
-
-
-
Method Detail
-
convertCSV2Binary
public static void convertCSV2Binary(java.io.File csvFile, java.io.File binFile, int inputCount, int outputCount, boolean headers)Convert a CSV file to a binary training file.- Parameters:
csvFile- The CSV file.binFile- The binary file.inputCount- The number of input values.outputCount- The number of output values.headers- True, if there are headers on the3 CSV.
-
loadCSV2Memory
public static MLDataSet loadCSV2Memory(java.lang.String filename, int input, int ideal, boolean headers, CSVFormat format, boolean significance)
Load CSV to memory.- Parameters:
filename- The CSV file to load.input- The input count.ideal- The ideal count.headers- True, if headers are present.format- The loaded dataset.significance- True, if there is a significance column.- Returns:
- The loaded dataset.
-
evaluate
public static void evaluate(MLRegression network, MLDataSet training)
Evaluate the network and display (to the console) the output for every value in the training set. Displays ideal and actual.- Parameters:
network- The network to evaluate.training- The training set to evaluate.
-
formatNeuralData
public static java.lang.String formatNeuralData(MLData data)
Format neural data as a list of numbers.- Parameters:
data- The neural data to format.- Returns:
- The formatted neural data.
-
simpleFeedForward
public static BasicNetwork simpleFeedForward(int input, int hidden1, int hidden2, int output, boolean tanh)
Create a simple feedforward neural network.- Parameters:
input- The number of input neurons.hidden1- The number of hidden layer 1 neurons.hidden2- The number of hidden layer 2 neurons.output- The number of output neurons.tanh- True to use hyperbolic tangent activation function, false to use the sigmoid activation function.- Returns:
- The neural network.
-
trainConsole
public static void trainConsole(BasicNetwork network, MLDataSet trainingSet, int minutes)
Train the neural network, using SCG training, and output status to the console.- Parameters:
network- The network to train.trainingSet- The training set.minutes- The number of minutes to train for.
-
trainConsole
public static void trainConsole(MLTrain train, BasicNetwork network, MLDataSet trainingSet, int minutes)
Train the network, using the specified training algorithm, and send the output to the console.- Parameters:
train- The training method to use.network- The network to train.trainingSet- The training set.minutes- The number of minutes to train for.
-
trainToError
public static void trainToError(MLMethod method, MLDataSet dataSet, double error)
Train the method, to a specific error, send the output to the console.- Parameters:
method- The method to train.dataSet- The training set to use.error- The error level to train to.
-
trainToError
public static void trainToError(MLTrain train, double error)
Train to a specific error, using the specified training method, send the output to the console.- Parameters:
train- The training method.error- The desired error level.
-
loadEGB2Memory
public static MLDataSet loadEGB2Memory(java.io.File filename)
-
convertCSV2Binary
public static void convertCSV2Binary(java.lang.String csvFile, java.lang.String binFile, int inputCount, int outputCount, boolean headers)Convert a CSV file to a binary training file.- Parameters:
csvFile- The binary file.binFile- The binary file.inputCount- The number of input values.outputCount- The number of output values.headers- True, if there are headers on the CSV.
-
convertCSV2Binary
public static void convertCSV2Binary(java.io.File csvFile, CSVFormat format, java.io.File binFile, int[] input, int[] ideal, boolean headers)
-
calculateRegressionError
public static double calculateRegressionError(MLRegression method, MLDataSet data)
-
calculateClassificationError
public static double calculateClassificationError(MLClassification method, MLDataSet data)
Calculate the classification error.- Parameters:
method- The method to check.data- The data to check.- Returns:
- The error.
-
saveEGB
public static void saveEGB(java.io.File f, MLDataSet data)Save a training set to an EGB file.- Parameters:
f- The file.data- The data.
-
explainErrorMSE
public static void explainErrorMSE(MLRegression method, MatrixMLDataSet training)
-
explainErrorRMS
public static void explainErrorRMS(MLRegression method, MatrixMLDataSet training)
-
calculatePositiveNegative
public static EncogUtility.FalsePositiveReport calculatePositiveNegative(MLRegression method, MatrixMLDataSet data)
-
splitTrainValidate
public static MLDataSet[] splitTrainValidate(MLDataSet trainingSet, GenerateRandom rnd, double trainingPercent)
-
-
DMelt 3.0 © DataMelt by jWork.ORG