[libfann] 197/242: More documentation and change of functionality for the callback function

Christian Kastner chrisk-guest at moszumanska.debian.org
Sat Oct 4 21:10:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

chrisk-guest pushed a commit to tag Version2_0_0
in repository libfann.

commit a228952dd60d481e0df05bf47fd5dfefd055dc57
Author: Steffen Nissen <lukesky at diku.dk>
Date:   Tue Sep 27 20:18:08 2005 +0000

    More documentation and change of functionality for the callback function
---
 .project                   |  22 +++----
 examples/mushroom.c        |  12 +---
 examples/robot.c           |   7 --
 examples/simple_train.c    |   6 +-
 examples/steepness_train.c |   8 +--
 examples/xor_train.c       |  18 +++---
 src/fann_cascade.c         |   5 +-
 src/fann_train.c           |   1 +
 src/fann_train_data.c      |  51 +++------------
 src/include/fann.h         |   6 +-
 src/include/fann_data.h    |  43 +++++++++++++
 src/include/fann_train.h   | 155 ++++++++++++++++++++-------------------------
 12 files changed, 159 insertions(+), 175 deletions(-)

diff --git a/.project b/.project
index dc32650..94c2b67 100644
--- a/.project
+++ b/.project
@@ -17,15 +17,11 @@
 					<value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
 				</dictionary>
 				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
 					<key>org.eclipse.cdt.make.core.environment</key>
 					<value></value>
 				</dictionary>
 				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableFullBuild</key>
+					<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
 					<value>true</value>
 				</dictionary>
 				<dictionary>
@@ -33,22 +29,26 @@
 					<value>all</value>
 				</dictionary>
 				<dictionary>
-					<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
+					<key>org.eclipse.cdt.make.core.enableFullBuild</key>
 					<value>true</value>
 				</dictionary>
 				<dictionary>
-					<key>org.eclipse.cdt.make.core.build.location</key>
-					<value>/fann/examples</value>
+					<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
+					<value>true</value>
 				</dictionary>
 				<dictionary>
-					<key>org.eclipse.cdt.make.core.build.target.clean</key>
-					<value>clean</value>
+					<key>org.eclipse.cdt.make.core.build.location</key>
+					<value>/fann/src</value>
 				</dictionary>
 				<dictionary>
 					<key>org.eclipse.cdt.make.core.build.command</key>
 					<value>make</value>
 				</dictionary>
 				<dictionary>
+					<key>org.eclipse.cdt.make.core.build.target.clean</key>
+					<value>clean</value>
+				</dictionary>
+				<dictionary>
 					<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
 					<value>true</value>
 				</dictionary>
@@ -66,7 +66,7 @@
 				</dictionary>
 				<dictionary>
 					<key>org.eclipse.cdt.make.core.build.target.auto</key>
-					<value>compiletest</value>
+					<value>floatfann.o</value>
 				</dictionary>
 				<dictionary>
 					<key>org.eclipse.cdt.make.core.stopOnError</key>
diff --git a/examples/mushroom.c b/examples/mushroom.c
index 8bc6324..c36cb8d 100644
--- a/examples/mushroom.c
+++ b/examples/mushroom.c
@@ -21,19 +21,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 #include "fann.h"
 
-int print_callback(unsigned int epochs, float error)
-{
-	printf("Epochs     %8d. Current MSE-Error: %.10f\n", epochs, error);
-	return 0;
-}
-
 int main()
 {
 	const unsigned int num_layers = 3;
 	const unsigned int num_neurons_hidden = 32;
 	const float desired_error = (const float) 0.0001;
-	const unsigned int max_iterations = 300;
-	const unsigned int iterations_between_reports = 10;
+	const unsigned int max_epochs = 300;
+	const unsigned int epochs_between_reports = 10;
 	struct fann *ann;
 	struct fann_train_data *train_data, *test_data;
 
@@ -53,7 +47,7 @@ int main()
 
 	/*fann_set_training_algorithm(ann, FANN_TRAIN_INCREMENTAL); */
 
-	fann_train_on_data(ann, train_data, max_iterations, iterations_between_reports, desired_error);
+	fann_train_on_data(ann, train_data, max_epochs, epochs_between_reports, desired_error);
 
 	printf("Testing network.\n");
 
diff --git a/examples/robot.c b/examples/robot.c
index 17e743c..c58ce2f 100644
--- a/examples/robot.c
+++ b/examples/robot.c
@@ -21,12 +21,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 #include "fann.h"
 
-int print_callback(unsigned int epochs, float error)
-{
-	printf("Epochs     %8d. Current MSE-Error: %.10f\n", epochs, error);
-	return 0;
-}
-
 int main()
 {
 	const unsigned int num_layers = 3;
@@ -50,7 +44,6 @@ int main()
 
 	fann_train_on_data(ann, train_data, 1000, 10, desired_error);
 
-	/*fann_train_on_data_callback(ann, data, max_iterations, iterations_between_reports, desired_error, print_callback); */
 	printf("Testing network.\n");
 
 	test_data = fann_read_train_from_file("../benchmarks/datasets/robot.test");
diff --git a/examples/simple_train.c b/examples/simple_train.c
index 910c4d9..7bb1e77 100644
--- a/examples/simple_train.c
+++ b/examples/simple_train.c
@@ -26,15 +26,15 @@ int main()
 	const unsigned int num_layers = 3;
 	const unsigned int num_neurons_hidden = 3;
 	const float desired_error = (const float) 0.001;
-	const unsigned int max_iterations = 500000;
-	const unsigned int iterations_between_reports = 1000;
+	const unsigned int max_epochs = 500000;
+	const unsigned int epochs_between_reports = 1000;
 
 	struct fann *ann = fann_create_standard(num_layers, num_input, num_neurons_hidden, num_output);
 
 	fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC);
 	fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC);
 
-	fann_train_on_file(ann, "xor.data", max_iterations, iterations_between_reports, desired_error);
+	fann_train_on_file(ann, "xor.data", max_epochs, epochs_between_reports, desired_error);
 
 	fann_save(ann, "xor_float.net");
 
diff --git a/examples/steepness_train.c b/examples/steepness_train.c
index 50a1890..2ce2c99 100644
--- a/examples/steepness_train.c
+++ b/examples/steepness_train.c
@@ -74,8 +74,8 @@ int main()
 	const unsigned int num_layers = 3;
 	const unsigned int num_neurons_hidden = 3;
 	const float desired_error = (const float) 0.001;
-	const unsigned int max_iterations = 500000;
-	const unsigned int iterations_between_reports = 1000;
+	const unsigned int max_epochs = 500000;
+	const unsigned int epochs_between_reports = 1000;
 	unsigned int i;
 	fann_type *calc_out;
 
@@ -91,8 +91,8 @@ int main()
 
 	fann_set_training_algorithm(ann, FANN_TRAIN_QUICKPROP);
 
-	train_on_steepness_file(ann, "xor.data", max_iterations,
-							iterations_between_reports, desired_error, (float) 1.0, (float) 0.1,
+	train_on_steepness_file(ann, "xor.data", max_epochs,
+							epochs_between_reports, desired_error, (float) 1.0, (float) 0.1,
 							(float) 20.0);
 
 	fann_set_activation_function_hidden(ann, FANN_THRESHOLD_SYMMETRIC);
diff --git a/examples/xor_train.c b/examples/xor_train.c
index 7f84b2d..5bb476d 100644
--- a/examples/xor_train.c
+++ b/examples/xor_train.c
@@ -21,9 +21,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 #include "fann.h"
 
-int print_callback(unsigned int epochs, float error)
+int FANN_API test_callback(struct fann *ann, struct fann_train_data *train,
+	unsigned int max_epochs, unsigned int epochs_between_reports, 
+	float desired_error, unsigned int epochs)
 {
-	printf("Epochs     %8d. Current MSE-Error: %.10f\n", epochs, error);
+	printf("Epochs     %8d. MSE: %.5f. Desired-MSE: %.5f\n", epochs, fann_get_MSE(ann), desired_error);
 	return 0;
 }
 
@@ -35,8 +37,8 @@ int main()
 	const unsigned int num_layers = 3;
 	const unsigned int num_neurons_hidden = 3;
 	const float desired_error = (const float) 0.00001;
-	const unsigned int max_iterations = 100000;
-	const unsigned int iterations_between_reports = 1000;
+	const unsigned int max_epochs = 100000;
+	const unsigned int epochs_between_reports = 1000;
 	struct fann *ann;
 	struct fann_train_data *data;
 
@@ -61,10 +63,10 @@ int main()
 	fann_init_weights(ann, data);
 
 	/*fann_set_training_algorithm(ann, FANN_TRAIN_QUICKPROP); */
-	fann_train_on_data(ann, data, max_iterations, iterations_between_reports, desired_error);
-
-	/*fann_train_on_data_callback(ann, data, max_iterations, iterations_between_reports, desired_error, print_callback); */
-
+	
+	fann_set_callback(ann, test_callback);
+	
+	fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error);
 
 
 	printf("Testing network. %f\n", fann_test_data(ann, data));
diff --git a/src/fann_cascade.c b/src/fann_cascade.c
index cff08c1..7d0bb32 100644
--- a/src/fann_cascade.c
+++ b/src/fann_cascade.c
@@ -19,6 +19,7 @@
 
 #include "config.h"
 #include "fann.h"
+#include "string.h"
 
 #ifndef FIXEDFANN
 
@@ -994,7 +995,7 @@ FANN_EXTERNAL void fann_set_cascade_activation_functions(struct fann *ann,
 		}
 	}
 	
-	memcpy(ann->cascade_activation_functions, cascade_activation_functions, 
+	memmove(ann->cascade_activation_functions, cascade_activation_functions, 
 		ann->cascade_activation_functions_count * sizeof(enum fann_activationfunc_enum));
 }
 
@@ -1022,6 +1023,6 @@ FANN_EXTERNAL void fann_set_cascade_activation_steepnesses(struct fann *ann,
 		}
 	}
 	
-	memcpy(ann->cascade_activation_steepnesses, cascade_activation_steepnesses, 
+	memmove(ann->cascade_activation_steepnesses, cascade_activation_steepnesses, 
 		ann->cascade_activation_steepnesses_count * sizeof(fann_type));
 }
diff --git a/src/fann_train.c b/src/fann_train.c
index 9861c9e..8431f76 100644
--- a/src/fann_train.c
+++ b/src/fann_train.c
@@ -823,6 +823,7 @@ FANN_EXTERNAL void FANN_API fann_set_activation_steepness_output(struct fann *an
 }
 
 FANN_GET_SET(enum fann_errorfunc_enum, train_error_function)
+FANN_GET_SET(fann_callback_type, callback)
 FANN_GET_SET(float, quickprop_decay)
 FANN_GET_SET(float, quickprop_mu)
 FANN_GET_SET(float, rprop_increase_factor)
diff --git a/src/fann_train_data.c b/src/fann_train_data.c
index eee526b..599ded3 100644
--- a/src/fann_train_data.c
+++ b/src/fann_train_data.c
@@ -206,17 +206,10 @@ FANN_EXTERNAL float FANN_API fann_test_data(struct fann *ann, struct fann_train_
 	return fann_get_MSE(ann);
 }
 
-/*
- * Train directly on the training data. 
- */
-FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann,
-														struct fann_train_data *data,
-														unsigned int max_epochs,
-														unsigned int epochs_between_reports,
-														float desired_error,
-														int (FANN_API *
-															 callback) (unsigned int epochs,
-																		float error))
+FANN_EXTERNAL void FANN_API fann_train_on_data(struct fann *ann, struct fann_train_data *data,
+											   unsigned int max_epochs,
+											   unsigned int epochs_between_reports,
+											   float desired_error)
 {
 	float error;
 	unsigned int i;
@@ -226,7 +219,7 @@ FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann,
 	printf("Training with %s\n", FANN_TRAIN_NAMES[ann->training_algorithm]);
 #endif
 
-	if(epochs_between_reports && callback == NULL)
+	if(epochs_between_reports && ann->callback == NULL)
 	{
 		printf("Max epochs %8d. Desired error: %.10f.\n", max_epochs, desired_error);
 	}
@@ -246,12 +239,13 @@ FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann,
 		   (i % epochs_between_reports == 0 || i == max_epochs || i == 1 ||
 			desired_error_reached == 0))
 		{
-			if(callback == NULL)
+			if(ann->callback == NULL)
 			{
 				printf("Epochs     %8d. Current error: %.10f. Bit fail %d.\n", i, error,
 					   ann->num_bit_fail);
 			}
-			else if((*callback) (i, error) == -1)
+			else if(((*ann->callback)(ann, data, max_epochs, epochs_between_reports, 
+									  desired_error, i)) == -1)
 			{
 				/*
 				 * you can break the training by returning -1 
@@ -265,46 +259,21 @@ FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann,
 	}
 }
 
-FANN_EXTERNAL void FANN_API fann_train_on_data(struct fann *ann, struct fann_train_data *data,
+FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, char *filename,
 											   unsigned int max_epochs,
 											   unsigned int epochs_between_reports,
 											   float desired_error)
 {
-	fann_train_on_data_callback(ann, data, max_epochs, epochs_between_reports, desired_error, NULL);
-}
-
-
-/*
- * Wrapper to make it easy to train directly on a training data file. 
- */
-FANN_EXTERNAL void FANN_API fann_train_on_file_callback(struct fann *ann, char *filename,
-														unsigned int max_epochs,
-														unsigned int epochs_between_reports,
-														float desired_error,
-														int (FANN_API *
-															 callback) (unsigned int epochs,
-																		float error))
-{
 	struct fann_train_data *data = fann_read_train_from_file(filename);
 
 	if(data == NULL)
 	{
 		return;
 	}
-	fann_train_on_data_callback(ann, data, max_epochs, epochs_between_reports, desired_error,
-								callback);
+	fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error);
 	fann_destroy_train(data);
 }
 
-FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, char *filename,
-											   unsigned int max_epochs,
-											   unsigned int epochs_between_reports,
-											   float desired_error)
-{
-	fann_train_on_file_callback(ann, filename, max_epochs, epochs_between_reports, desired_error,
-								NULL);
-}
-
 #endif
 
 /*
diff --git a/src/include/fann.h b/src/include/fann.h
index 74c4896..93e6be0 100644
--- a/src/include/fann.h
+++ b/src/include/fann.h
@@ -90,11 +90,9 @@ extern "C"
  The __stdcall calling convention is used for functions in a
  windows DLL.
 
- The callback functions for fann_train_on_data_callback and
- fann_train_on_file_callback must be declared as FANN_API
+ The callback functions for fann_set_callback must be declared as FANN_API
  so the DLL and the application program both use the same
- calling convention. The callback functions must of this form:
-     int FANN_API user_callback(unsigned int epochs, float error)
+ calling convention.
 */ 
  
 /*
diff --git a/src/include/fann_data.h b/src/include/fann_data.h
index 452b300..f70c025 100644
--- a/src/include/fann_data.h
+++ b/src/include/fann_data.h
@@ -272,6 +272,45 @@ static char const *const FANN_STOPFUNC_NAMES[] = {
 	"FANN_STOPFUNC_BIT"
 };
 
+/* forward declarations for use with the callback */
+struct fann;
+struct fann_train_data;
+/* Type: fann_callback_type
+   This callback function can be called during training when using <fann_train_on_data>, 
+   <fann_train_on_file> or <fann_cascade_train>.
+	
+	>typedef int (FANN_API * fann_callback_type) (struct fann *ann, struct fann_train_data *train, 
+	>											  unsigned int max_epochs, 
+	>                                             unsigned int epochs_between_reports, 
+	>                                             float desired_error, unsigned int epochs);
+	
+	The callback can be set by using <fann_set_callback> and is very usefull for doing custom 
+	things during training. It is recommended to use this function when implementing custom 
+	training procedures, or when visualizing the training in a GUI etc. The parameters which the
+	callback function takes is the parameters given to the <fann_train_on_data>, plus an epochs
+	parameter which tells how many epochs the training have taken so far.
+	
+	The callback function should return an integer, if the callback function returns -1, the training
+	will terminate.
+	
+	Example of a callback function:
+		>int FANN_API test_callback(struct fann *ann, struct fann_train_data *train,
+		>				            unsigned int max_epochs, unsigned int epochs_between_reports, 
+		>				            float desired_error, unsigned int epochs)
+		>{
+		>	printf("Epochs     %8d. MSE: %.5f. Desired-MSE: %.5f\n", epochs, fann_get_MSE(ann), desired_error);
+		>	return 0;
+		>}
+	
+	See also:
+		<fann_set_callback>, <fann_train_on_data>
+ */ 
+FANN_EXTERNAL typedef int (FANN_API * fann_callback_type) (struct fann *ann, struct fann_train_data *train, 
+														   unsigned int max_epochs, 
+														   unsigned int epochs_between_reports, 
+														   float desired_error, unsigned int epochs);
+
+
 /* ----- Data structures -----
  * No data within these structures should be altered directly by the user.
  */
@@ -461,6 +500,10 @@ struct fann
 	*/
 	enum fann_stopfunc_enum train_stop_function;
 
+	/* The callback function used during training. (default NULL)
+	*/
+	fann_callback_type callback;
+
 	/* Variables for use with Cascade Correlation */
 
 	/* The error must change by at least this
diff --git a/src/include/fann_train.h b/src/include/fann_train.h
index 1f5095d..7977dad 100644
--- a/src/include/fann_train.h
+++ b/src/include/fann_train.h
@@ -145,42 +145,53 @@ FANN_EXTERNAL unsigned int fann_get_bit_fail(struct fann *ann);
  */ 
 FANN_EXTERNAL void FANN_API fann_reset_MSE(struct fann *ann);
 
-/* Group: Training Data */
+/* Group: Training Data Training */
 
-/* Function: fann_read_train_from_file
-   Reads a file that stores training data.
+#ifndef FIXEDFANN
+	
+/* Function: fann_train_on_data
+
+   Trains on an entire dataset, for a period of time. 
    
-   The file must be formatted like:
-   >num_train_data num_input num_output
-   >inputdata seperated by space
-   >outputdata seperated by space
-   >
-   >.
-   >.
-   >.
-   >
-   >inputdata seperated by space
-   >outputdata seperated by space
+   This training uses the training algorithm chosen by <fann_set_training_algorithm>,
+   and the parameters set for these training algorithms.
    
-   See also:
-   	<fann_train_on_data>, <fann_destroy_train>, <fann_save_train>
-
-    This function appears in FANN >= 1.0.0
-*/ 
-FANN_EXTERNAL struct fann_train_data *FANN_API fann_read_train_from_file(char *filename);
+   Parameters:
+   		ann - The neural network
+   		data - The data, which should be used during training
+   		max_epochs - The maximum number of epochs the training should continue
+   		epochs_between_reports - The number of epochs between printing a status report to stdout.
+   			A value of zero means no reports should be printed.
+   		desired_error - The desired <fann_get_MSE> or <fann_get_bit_fail>, depending on which stop function
+   			is chosen by <fann_set_train_stop_function>.
 
+	Instead of printing out reports every epochs_between_reports, a callback function can be called 
+	(see <fann_set_callback>).
+	
+	See also:
+		<fann_train_on_file>, <fann_train_epoch>, <Parameters>
 
-/* Function: fann_destroy_train
-   Destructs the training data and properly deallocates all of the associated data.
-   Be sure to call this function after finished using the training data.
+	This function appears in FANN >= 1.0.0.
+*/ 
+FANN_EXTERNAL void FANN_API fann_train_on_data(struct fann *ann, struct fann_train_data *data,
+											   unsigned int max_epochs,
+											   unsigned int epochs_between_reports,
+											   float desired_error);
 
-    This function appears in FANN >= 1.0.0
- */ 
-FANN_EXTERNAL void FANN_API fann_destroy_train(struct fann_train_data *train_data);
+/* Function: fann_train_on_file
+   
+   Does the same as <fann_train_on_data>, but reads the training data directly from a file.
+   
+   See also:
+   		<fann_train_on_data>
 
+	This function appears in FANN >= 1.0.0.
+*/ 
+FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, char *filename,
+											   unsigned int max_epochs,
+											   unsigned int epochs_between_reports,
+											   float desired_error);
 
-#ifndef FIXEDFANN
-	
 /* Function: fann_train_epoch
    Train one epoch with a set of training data.
    
@@ -215,73 +226,38 @@ FANN_EXTERNAL float FANN_API fann_train_epoch(struct fann *ann, struct fann_trai
  */ 
 FANN_EXTERNAL float FANN_API fann_test_data(struct fann *ann, struct fann_train_data *data);
 
+/* Group: Training Data Manipulation */
 
-/* Function: fann_train_on_data
-
-   Trains on an entire dataset, for a period of time. 
+/* Function: fann_read_train_from_file
+   Reads a file that stores training data.
    
-   This training uses the training algorithm chosen by <fann_set_training_algorithm>,
-   and the parameters set for these training algorithms.
+   The file must be formatted like:
+   >num_train_data num_input num_output
+   >inputdata seperated by space
+   >outputdata seperated by space
+   >
+   >.
+   >.
+   >.
+   >
+   >inputdata seperated by space
+   >outputdata seperated by space
    
-   Parameters:
-   		ann - The neural network
-   		data - The data, which should be used during training
-   		max_epochs - The maximum number of epochs the training should continue
-   		epochs_between_reports - The number of epochs between printing a status report to stdout.
-   			A value of zero means no reports should be printed.
-   		desired_error - The desired <fann_get_MSE> or <fann_get_bit_fail>, depending on which stop function
-   			is chosen by <fann_set_train_stop_function>.
-
-	See also:
-		<fann_train_on_data_callback>, <fann_train_on_file>, <fann_train_epoch>, <Parameters>
-*/ 
-FANN_EXTERNAL void FANN_API fann_train_on_data(struct fann *ann, struct fann_train_data *data,
-											   unsigned int max_epochs,
-											   unsigned int epochs_between_reports,
-											   float desired_error);
-
-
-/* Function: fann_train_on_data_callback
+   See also:
+   	<fann_train_on_data>, <fann_destroy_train>, <fann_save_train>
 
-	TODO - callback definition should be changed.
-	   
-   Same as fann_train_on_data, but a callback function is given,
-   which can be used to print out reports. (effective for gui programming).
-   If the callback returns -1, then the training is terminated, otherwise
-   it continues until the normal stop criteria.
+    This function appears in FANN >= 1.0.0
 */ 
-FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann,
-														struct fann_train_data *data,
-														unsigned int max_epochs,
-														unsigned int epochs_between_reports,
-														float desired_error,
-														int (FANN_API *
-															 callback) (unsigned int epochs,
-																		float error));
-
+FANN_EXTERNAL struct fann_train_data *FANN_API fann_read_train_from_file(char *filename);
 
-/* Function: fann_train_on_file
-   
-   Does the same as train_on_data, but reads the data directly from a file.
- */ 
-FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, char *filename,
-											   unsigned int max_epochs,
-											   unsigned int epochs_between_reports,
-											   float desired_error);
 
+/* Function: fann_destroy_train
+   Destructs the training data and properly deallocates all of the associated data.
+   Be sure to call this function after finished using the training data.
 
-/* Function: fann_train_on_file_callback
-   
-   Does the same as train_on_data_callback, but
-   reads the data directly from a file.
+    This function appears in FANN >= 1.0.0
  */ 
-FANN_EXTERNAL void FANN_API fann_train_on_file_callback(struct fann *ann, char *filename,
-														unsigned int max_epochs,
-														unsigned int epochs_between_reports,
-														float desired_error,
-														int (FANN_API *
-															 callback) (unsigned int epochs,
-																		float error));
+FANN_EXTERNAL void FANN_API fann_destroy_train(struct fann_train_data *train_data);
 
 
 /* Function: fann_shuffle_train_data
@@ -462,6 +438,13 @@ FANN_EXTERNAL fann_type FANN_API fann_get_bit_fail_limit(struct fann *ann);
  */ 
 FANN_EXTERNAL void FANN_API fann_set_bit_fail_limit(struct fann *ann, fann_type bit_fail_limit);
 
+/* Function: fann_set_callback
+ 	Sets the callback function for use during training.
+ 	
+ 	See <fann_callback_type> for more information about the callback function.
+ */
+FANN_EXTERNAL void fann_set_callback(struct fann *ann, fann_callback_type callback);
+
 /* Function: fann_get_quickprop_decay
 
    Decay is used to make the weights do not go so high (default -0.0001). 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libfann.git



More information about the debian-science-commits mailing list