Package com.googlecode.fannj
Class Trainer
java.lang.Object
com.googlecode.fannj.Trainer
Trains an ANN. Currently only File based training is supported.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
cascadeTrain
(String dataFile, int maxNeurons, int neuronsBetweenReports, float desiredError) protected static void
fann_cascadetrain_on_file
(com.sun.jna.Pointer ann, String filename, int max_neurons, int neurons_between_reports, float desired_error) protected static void
fann_destroy_train
(com.sun.jna.Pointer data) Deallocate the dataprotected static float
fann_get_MSE
(com.sun.jna.Pointer ann) Reads the mean square error from the network.protected static int
fann_get_training_algorithm
(com.sun.jna.Pointer ann) protected static com.sun.jna.Pointer
fann_read_train_from_file
(String filename) Read the training or testing data from a file You must callfann_destroy_train(Pointer)
on thePointer
you get from this after you have finished with itprotected static void
fann_reset_MSE
(com.sun.jna.Pointer ann) Resets the mean square error from the network.protected static void
fann_set_training_algorithm
(com.sun.jna.Pointer ann, int training_algorithm) protected static float
fann_test_data
(com.sun.jna.Pointer ann, com.sun.jna.Pointer data) Test the network using data and return the MSE of the network.protected static void
fann_train_on_file
(com.sun.jna.Pointer ann, String filename, int max_epochs, int epochs_between_reports, float desired_error) void
setTrainingAlgorithm
(TrainingAlgorithm algorithm) float
float
-
Constructor Details
-
Trainer
-
-
Method Details
-
train
public float train(String trainingFile, int maxEpochs, int epochsBetweenReports, float desiredError) - Parameters:
trainingFile
-maxEpochs
-epochsBetweenReports
-desiredError
-- Returns:
- MSE for the ann once trained
-
cascadeTrain
public float cascadeTrain(String dataFile, int maxNeurons, int neuronsBetweenReports, float desiredError) - Parameters:
dataFile
-maxNeurons
-neuronsBetweenReports
-desiredError
-- Returns:
- MSE for the ann once trained
-
setTrainingAlgorithm
-
test
- Parameters:
testingFile
-- Returns:
- MSE for the Fann which has been tested
-
fann_train_on_file
protected static void fann_train_on_file(com.sun.jna.Pointer ann, String filename, int max_epochs, int epochs_between_reports, float desired_error) -
fann_cascadetrain_on_file
protected static void fann_cascadetrain_on_file(com.sun.jna.Pointer ann, String filename, int max_neurons, int neurons_between_reports, float desired_error) -
fann_set_training_algorithm
protected static void fann_set_training_algorithm(com.sun.jna.Pointer ann, int training_algorithm) -
fann_get_training_algorithm
protected static int fann_get_training_algorithm(com.sun.jna.Pointer ann) -
fann_reset_MSE
protected static void fann_reset_MSE(com.sun.jna.Pointer ann) Resets the mean square error from the network.- Parameters:
ann
-
-
fann_get_MSE
protected static float fann_get_MSE(com.sun.jna.Pointer ann) Reads the mean square error from the network.- Parameters:
ann
-- Returns:
- the mean square error of the network
-
fann_test_data
protected static float fann_test_data(com.sun.jna.Pointer ann, com.sun.jna.Pointer data) Test the network using data and return the MSE of the network. You might need to runfann_reset_MSE(Pointer)
first- Parameters:
ann
-data
- the data to test with- Returns:
- the mean square error of the network
-
fann_read_train_from_file
Read the training or testing data from a file You must callfann_destroy_train(Pointer)
on thePointer
you get from this after you have finished with it- Parameters:
filename
- the file name of the file to read the data from- Returns:
- pointer to the data which has been read for use with
fann_test_data(Pointer,Pointer)
-
fann_destroy_train
protected static void fann_destroy_train(com.sun.jna.Pointer data) Deallocate the data- Parameters:
data
- the training/testing data to deallocate
-