[libfann] 149/242: minor bugfixes, fixed msvc warnings, altered function definition for use in dll creation
Christian Kastner
chrisk-guest at moszumanska.debian.org
Sat Oct 4 21:10:36 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 5b44b7ebfb3da35b895e5534254aa5a2641f88e5
Author: Steffen Nissen <lukesky at diku.dk>
Date: Mon Jul 5 18:22:23 2004 +0000
minor bugfixes, fixed msvc warnings, altered function definition for use in dll creation
---
src/fann.c | 27 +-
src/fann_error.c | 14 +-
src/fann_io.c | 6 +-
src/fann_options.c | 81 ++--
src/fann_train.c | 18 +-
src/fann_train_data.c | 79 ++--
src/include/compat_time.h | 49 ++-
src/include/fann.h | 933 ++++++++++++++++++++++--------------------
src/include/fann_activation.h | 2 +-
src/include/fann_internal.h | 3 +-
10 files changed, 651 insertions(+), 561 deletions(-)
diff --git a/src/fann.c b/src/fann.c
index 02fab8d..a45cab5 100644
--- a/src/fann.c
+++ b/src/fann.c
@@ -30,7 +30,7 @@
/* create a neural network.
*/
-struct fann * fann_create(float connection_rate, float learning_rate,
+FANN_EXTERNAL struct fann * FANN_API fann_create(float connection_rate, float learning_rate,
unsigned int num_layers, /* the number of layers, including the input and output layer */
@@ -56,7 +56,7 @@ struct fann * fann_create(float connection_rate, float learning_rate,
/* create a neural network.
*/
-struct fann * fann_create_array(float connection_rate, float learning_rate, unsigned int num_layers, unsigned int * layers)
+FANN_EXTERNAL struct fann * FANN_API fann_create_array(float connection_rate, float learning_rate, unsigned int num_layers, unsigned int * layers)
{
struct fann_layer *layer_it, *last_layer, *prev_layer;
struct fann *ann;
@@ -282,7 +282,7 @@ struct fann * fann_create_array(float connection_rate, float learning_rate, unsi
/* create a neural network with forward connections.
*/
-struct fann * fann_create_forward(float learning_rate,
+FANN_EXTERNAL struct fann * FANN_API fann_create_forward(float learning_rate,
unsigned int num_layers, /* the number of layers, including the input and output layer */
@@ -308,7 +308,7 @@ struct fann * fann_create_forward(float learning_rate,
/* create a neural network with forward connections.
*/
-struct fann * fann_create_forward_array(float learning_rate, unsigned int num_layers, unsigned int * layers)
+FANN_EXTERNAL struct fann * FANN_API fann_create_forward_array(float learning_rate, unsigned int num_layers, unsigned int * layers)
{
struct fann_layer *layer_it, *layer_it2, *last_layer;
struct fann *ann;
@@ -425,7 +425,7 @@ struct fann * fann_create_forward_array(float learning_rate, unsigned int num_la
/* runs the network.
*/
-fann_type* fann_run(struct fann *ann, fann_type *input)
+FANN_EXTERNAL fann_type * FANN_API fann_run(struct fann *ann, fann_type *input)
{
struct fann_neuron *neuron_it, *last_neuron, *neurons, **neuron_pointers;
unsigned int activation_function, i, num_connections, num_neurons, num_input, num_output;
@@ -693,8 +693,9 @@ fann_type* fann_run(struct fann *ann, fann_type *input)
/* deallocate the network.
*/
-void fann_destroy(struct fann *ann)
+FANN_EXTERNAL void FANN_API fann_destroy(struct fann *ann)
{
+ if(ann == NULL) return;
fann_safe_free(fann_get_weights(ann));
fann_safe_free(fann_get_connections(ann));
fann_safe_free(ann->first_layer->first_neuron);
@@ -708,7 +709,7 @@ void fann_destroy(struct fann *ann)
fann_safe_free(ann);
}
-void fann_randomize_weights(struct fann *ann, fann_type min_weight, fann_type max_weight)
+FANN_EXTERNAL void FANN_API fann_randomize_weights(struct fann *ann, fann_type min_weight, fann_type max_weight)
{
fann_type *last_weight;
fann_type *weights = (ann->first_layer+1)->first_neuron->weights;
@@ -718,7 +719,7 @@ void fann_randomize_weights(struct fann *ann, fann_type min_weight, fann_type ma
}
}
-void fann_print_connections(struct fann *ann)
+FANN_EXTERNAL void FANN_API fann_print_connections(struct fann *ann)
{
struct fann_layer *layer_it;
struct fann_neuron *neuron_it;
@@ -754,7 +755,7 @@ void fann_print_connections(struct fann *ann)
/* Initialize the weights using Widrow + Nguyen's algorithm.
*/
-void fann_init_weights(struct fann *ann, struct fann_train_data *train_data)
+FANN_EXTERNAL void FANN_API fann_init_weights(struct fann *ann, struct fann_train_data *train_data)
{
fann_type smallest_inp, largest_inp;
unsigned int dat = 0, elem, num_neurons_in, num_neurons_out, num_connect, num_hidden_neurons;
@@ -775,8 +776,8 @@ void fann_init_weights(struct fann *ann, struct fann_train_data *train_data)
}
num_hidden_neurons = ann->total_neurons - (ann->num_input + ann->num_output + (ann->last_layer - ann->first_layer));
- scale_factor = pow((double)(0.7f * (double)num_hidden_neurons),
- (double)(1.0f / (double)ann->num_input)) / (double)(largest_inp - smallest_inp);
+ scale_factor = (float)(pow((double)(0.7f * (double)num_hidden_neurons),
+ (double)(1.0f / (double)ann->num_input)) / (double)(largest_inp - smallest_inp));
#ifdef DEBUG
printf("Initializing weights with scale factor %f\n", scale_factor);
@@ -861,11 +862,11 @@ struct fann * fann_allocate_structure(float learning_rate, unsigned int num_laye
ann->stagnation_epochs = 12;*/
/* Variables for use with with Quickprop training (reasonable defaults) */
- ann->quickprop_decay = -0.0001;
+ ann->quickprop_decay = (float)-0.0001;
ann->quickprop_mu = 1.75;
/* Variables for use with with RPROP training (reasonable defaults) */
- ann->rprop_increase_factor = 1.2;
+ ann->rprop_increase_factor = (float)1.2;
ann->rprop_decrease_factor = 0.5;
ann->rprop_delta_min = 0.0;
ann->rprop_delta_max = 50.0;
diff --git a/src/fann_error.c b/src/fann_error.c
index f20a910..766c69d 100644
--- a/src/fann_error.c
+++ b/src/fann_error.c
@@ -33,14 +33,14 @@
/* resets the last error number
*/
-void fann_reset_errno(struct fann_error *errdat)
+FANN_EXTERNAL void FANN_API fann_reset_errno(struct fann_error *errdat)
{
errdat->errno_f = 0;
}
/* resets the last errstr
*/
-void fann_reset_errstr(struct fann_error *errdat)
+FANN_EXTERNAL void FANN_API fann_reset_errstr(struct fann_error *errdat)
{
if ( errdat->errstr != NULL )
free(errdat->errstr);
@@ -49,14 +49,14 @@ void fann_reset_errstr(struct fann_error *errdat)
/* returns the last error number
*/
-unsigned int fann_get_errno(struct fann_error *errdat)
+FANN_EXTERNAL unsigned int FANN_API fann_get_errno(struct fann_error *errdat)
{
return errdat->errno_f;
}
/* returns the last errstr
*/
-char * fann_get_errstr(struct fann_error *errdat)
+FANN_EXTERNAL char * FANN_API fann_get_errstr(struct fann_error *errdat)
{
char *errstr = errdat->errstr;
@@ -68,14 +68,14 @@ char * fann_get_errstr(struct fann_error *errdat)
/* change where errors are logged to
*/
-void fann_set_error_log(struct fann_error *errdat, FILE *log_file)
+FANN_EXTERNAL void FANN_API fann_set_error_log(struct fann_error *errdat, FILE *log_file)
{
- errdat->error_log = log_file;
+ errdat->error_log = log_file;
}
/* prints the last error to the error log (default stderr)
*/
-void fann_print_error(struct fann_error *errdat) {
+FANN_EXTERNAL void FANN_API fann_print_error(struct fann_error *errdat) {
if ( (errdat->errno_f != FANN_E_NO_ERROR) && (errdat->error_log != NULL) ){
fputs(errdat->errstr, errdat->error_log);
}
diff --git a/src/fann_io.c b/src/fann_io.c
index 2aea67a..3e4b092 100644
--- a/src/fann_io.c
+++ b/src/fann_io.c
@@ -28,7 +28,7 @@
/* Create a network from a configuration file.
*/
-struct fann * fann_create_from_file(const char *configuration_file)
+FANN_EXTERNAL struct fann * FANN_API fann_create_from_file(const char *configuration_file)
{
struct fann *ann;
FILE *conf = fopen(configuration_file, "r");
@@ -43,14 +43,14 @@ struct fann * fann_create_from_file(const char *configuration_file)
/* Save the network.
*/
-void fann_save(struct fann *ann, const char *configuration_file)
+FANN_EXTERNAL void FANN_API fann_save(struct fann *ann, const char *configuration_file)
{
fann_save_internal(ann, configuration_file, 0);
}
/* Save the network as fixed point data.
*/
-int fann_save_to_fixed(struct fann *ann, const char *configuration_file)
+FANN_EXTERNAL int FANN_API fann_save_to_fixed(struct fann *ann, const char *configuration_file)
{
return fann_save_internal(ann, configuration_file, 1);
}
diff --git a/src/fann_options.c b/src/fann_options.c
index efc89df..d62bd3b 100644
--- a/src/fann_options.c
+++ b/src/fann_options.c
@@ -27,7 +27,7 @@
#include "fann_errno.h"
/* Prints all of the parameters and options of the ANN */
-void fann_print_parameters(struct fann *ann)
+FANN_EXTERNAL void FANN_API fann_print_parameters(struct fann *ann)
{
struct fann_layer *layer_it;
@@ -45,9 +45,12 @@ void fann_print_parameters(struct fann *ann)
printf("Learning rate : %5.2f\n", ann->learning_rate);
printf("Activation function hidden : %s\n", FANN_ACTIVATION_NAMES[ann->activation_function_hidden]);
printf("Activation function output : %s\n", FANN_ACTIVATION_NAMES[ann->activation_function_output]);
+#ifndef FIXEDFANN
printf("Activation steepness hidden: %5.2f\n", ann->activation_steepness_hidden);
printf("Activation steepness output: %5.2f\n", ann->activation_steepness_output);
-#ifdef FIXEDFANN
+#else
+ printf("Activation steepness hidden: %d\n", ann->activation_steepness_hidden);
+ printf("Activation steepness output: %d\n", ann->activation_steepness_output);
printf("Decimal point : %2d\n", ann->decimal_point);
printf("Multiplier : %2d\n", ann->multiplier);
#endif
@@ -60,112 +63,112 @@ void fann_print_parameters(struct fann *ann)
printf("RPROP delta max : %5.2f\n", ann->rprop_delta_max);
}
-unsigned int fann_get_training_algorithm(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_training_algorithm(struct fann *ann)
{
return ann->training_algorithm;
}
-void fann_set_training_algorithm(struct fann *ann, unsigned int training_algorithm)
+FANN_EXTERNAL void FANN_API fann_set_training_algorithm(struct fann *ann, unsigned int training_algorithm)
{
ann->training_algorithm = training_algorithm;
}
-void fann_set_learning_rate(struct fann *ann, float learning_rate)
+FANN_EXTERNAL void FANN_API fann_set_learning_rate(struct fann *ann, float learning_rate)
{
ann->learning_rate = learning_rate;
}
-void fann_set_activation_function_hidden(struct fann *ann, unsigned int activation_function)
+FANN_EXTERNAL void FANN_API fann_set_activation_function_hidden(struct fann *ann, unsigned int activation_function)
{
ann->activation_function_hidden = activation_function;
fann_update_stepwise_hidden(ann);
}
-void fann_set_activation_function_output(struct fann *ann, unsigned int activation_function)
+FANN_EXTERNAL void FANN_API fann_set_activation_function_output(struct fann *ann, unsigned int activation_function)
{
ann->activation_function_output = activation_function;
fann_update_stepwise_output(ann);
}
-void fann_set_activation_steepness_hidden(struct fann *ann, fann_type steepness)
+FANN_EXTERNAL void FANN_API fann_set_activation_steepness_hidden(struct fann *ann, fann_type steepness)
{
ann->activation_steepness_hidden = steepness;
fann_update_stepwise_hidden(ann);
}
-void fann_set_activation_steepness_output(struct fann *ann, fann_type steepness)
+FANN_EXTERNAL void FANN_API fann_set_activation_steepness_output(struct fann *ann, fann_type steepness)
{
ann->activation_steepness_output = steepness;
fann_update_stepwise_output(ann);
}
-void fann_set_activation_hidden_steepness(struct fann *ann, fann_type steepness)
+FANN_EXTERNAL void FANN_API fann_set_activation_hidden_steepness(struct fann *ann, fann_type steepness)
{
fann_set_activation_steepness_hidden(ann, steepness);
}
-void fann_set_activation_output_steepness(struct fann *ann, fann_type steepness)
+FANN_EXTERNAL void FANN_API fann_set_activation_output_steepness(struct fann *ann, fann_type steepness)
{
fann_set_activation_steepness_output(ann, steepness);
}
-float fann_get_learning_rate(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_learning_rate(struct fann *ann)
{
return ann->learning_rate;
}
-unsigned int fann_get_num_input(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_num_input(struct fann *ann)
{
return ann->num_input;
}
-unsigned int fann_get_num_output(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_num_output(struct fann *ann)
{
return ann->num_output;
}
-unsigned int fann_get_activation_function_hidden(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_activation_function_hidden(struct fann *ann)
{
return ann->activation_function_hidden;
}
-unsigned int fann_get_activation_function_output(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_activation_function_output(struct fann *ann)
{
return ann->activation_function_output;
}
-fann_type fann_get_activation_hidden_steepness(struct fann *ann)
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_hidden_steepness(struct fann *ann)
{
return ann->activation_steepness_hidden;
}
-fann_type fann_get_activation_output_steepness(struct fann *ann)
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_output_steepness(struct fann *ann)
{
return ann->activation_steepness_output;
}
-fann_type fann_get_activation_steepness_hidden(struct fann *ann)
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_steepness_hidden(struct fann *ann)
{
return ann->activation_steepness_hidden;
}
-fann_type fann_get_activation_steepness_output(struct fann *ann)
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_steepness_output(struct fann *ann)
{
return ann->activation_steepness_output;
}
-unsigned int fann_get_total_neurons(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_total_neurons(struct fann *ann)
{
/* -1, because there is always an unused bias neuron in the last layer */
return ann->total_neurons - 1;
}
-unsigned int fann_get_total_connections(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_total_connections(struct fann *ann)
{
return ann->total_connections;
}
-fann_type* fann_get_weights(struct fann *ann)
+fann_type * fann_get_weights(struct fann *ann)
{
return (ann->first_layer+1)->first_neuron->weights;
}
@@ -180,43 +183,43 @@ struct fann_neuron** fann_get_connections(struct fann *ann)
Makes the error used for calculating the slopes
higher when the difference is higher.
*/
-void fann_set_use_tanh_error_function(struct fann *ann, unsigned int use_tanh_error_function)
+FANN_EXTERNAL void FANN_API fann_set_use_tanh_error_function(struct fann *ann, unsigned int use_tanh_error_function)
{
ann->use_tanh_error_function = use_tanh_error_function;
}
/* Decay is used to make the weights do not go so high (default -0.0001). */
-void fann_set_quickprop_decay(struct fann *ann, float quickprop_decay)
+FANN_EXTERNAL void FANN_API fann_set_quickprop_decay(struct fann *ann, float quickprop_decay)
{
ann->quickprop_decay = quickprop_decay;
}
/* Mu is a factor used to increase and decrease the stepsize (default 1.75). */
-void fann_set_quickprop_mu(struct fann *ann, float quickprop_mu)
+FANN_EXTERNAL void FANN_API fann_set_quickprop_mu(struct fann *ann, float quickprop_mu)
{
ann->quickprop_mu = quickprop_mu;
}
/* Tells how much the stepsize should increase during learning (default 1.2). */
-void fann_set_rprop_increase_factor(struct fann *ann, float rprop_increase_factor)
+FANN_EXTERNAL void FANN_API fann_set_rprop_increase_factor(struct fann *ann, float rprop_increase_factor)
{
ann->rprop_increase_factor = rprop_increase_factor;
}
/* Tells how much the stepsize should decrease during learning (default 0.5). */
-void fann_set_rprop_decrease_factor(struct fann *ann, float rprop_decrease_factor)
+FANN_EXTERNAL void FANN_API fann_set_rprop_decrease_factor(struct fann *ann, float rprop_decrease_factor)
{
ann->rprop_decrease_factor = rprop_decrease_factor;
}
/* The minimum stepsize (default 0.0). */
-void fann_set_rprop_delta_min(struct fann *ann, float rprop_delta_min)
+FANN_EXTERNAL void FANN_API fann_set_rprop_delta_min(struct fann *ann, float rprop_delta_min)
{
ann->rprop_delta_min = rprop_delta_min;
}
/* The maximum stepsize (default 50.0). */
-void fann_set_rprop_delta_max(struct fann *ann, float rprop_delta_max)
+FANN_EXTERNAL void FANN_API fann_set_rprop_delta_max(struct fann *ann, float rprop_delta_max)
{
ann->rprop_delta_max = rprop_delta_max;
}
@@ -225,43 +228,43 @@ void fann_set_rprop_delta_max(struct fann *ann, float rprop_delta_max)
Makes the error used for calculating the slopes
higher when the difference is higher.
*/
-unsigned int fann_get_use_tanh_error_function(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_use_tanh_error_function(struct fann *ann)
{
return ann->use_tanh_error_function;
}
/* Decay is used to make the weights do not go so high (default -0.0001). */
-float fann_get_quickprop_decay(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_quickprop_decay(struct fann *ann)
{
return ann->quickprop_decay;
}
/* Mu is a factor used to increase and decrease the stepsize (default 1.75). */
-float fann_get_quickprop_mu(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_quickprop_mu(struct fann *ann)
{
return ann->quickprop_mu;
}
/* Tells how much the stepsize should increase during learning (default 1.2). */
-float fann_get_rprop_increase_factor(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_rprop_increase_factor(struct fann *ann)
{
return ann->rprop_increase_factor;
}
/* Tells how much the stepsize should decrease during learning (default 0.5). */
-float fann_get_rprop_decrease_factor(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_rprop_decrease_factor(struct fann *ann)
{
return ann->rprop_decrease_factor;
}
/* The minimum stepsize (default 0.0). */
-float fann_get_rprop_delta_min(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_rprop_delta_min(struct fann *ann)
{
return ann->rprop_delta_min;
}
/* The maximum stepsize (default 50.0). */
-float fann_get_rprop_delta_max(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_rprop_delta_max(struct fann *ann)
{
return ann->rprop_delta_max;
}
@@ -269,14 +272,14 @@ float fann_get_rprop_delta_max(struct fann *ann)
#ifdef FIXEDFANN
/* returns the position of the fix point.
*/
-unsigned int fann_get_decimal_point(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_decimal_point(struct fann *ann)
{
return ann->decimal_point;
}
/* returns the multiplier that fix point data is multiplied with.
*/
-unsigned int fann_get_multiplier(struct fann *ann)
+FANN_EXTERNAL unsigned int FANN_API fann_get_multiplier(struct fann *ann)
{
return ann->multiplier;
}
diff --git a/src/fann_train.c b/src/fann_train.c
index 674a5c7..8d575ea 100644
--- a/src/fann_train.c
+++ b/src/fann_train.c
@@ -54,7 +54,7 @@ static fann_type fann_activation_derived(unsigned int activation_function,
#ifndef FIXEDFANN
/* Trains the network with the backpropagation algorithm.
*/
-void fann_train(struct fann *ann, fann_type *input, fann_type *desired_output)
+FANN_EXTERNAL void FANN_API fann_train(struct fann *ann, fann_type *input, fann_type *desired_output)
{
fann_run(ann, input);
@@ -68,7 +68,7 @@ void fann_train(struct fann *ann, fann_type *input, fann_type *desired_output)
/* Tests the network.
*/
-fann_type *fann_test(struct fann *ann, fann_type *input, fann_type *desired_output)
+FANN_EXTERNAL fann_type * FANN_API fann_test(struct fann *ann, fann_type *input, fann_type *desired_output)
{
fann_type neuron_value;
fann_type *output_begin = fann_run(ann, input);
@@ -91,7 +91,7 @@ fann_type *fann_test(struct fann *ann, fann_type *input, fann_type *desired_outp
#ifdef FIXEDFANN
ann->MSE_value += (neuron_diff/(float)ann->multiplier) * (neuron_diff/(float)ann->multiplier);
#else
- ann->MSE_value += neuron_diff * neuron_diff;
+ ann->MSE_value += (float)(neuron_diff * neuron_diff);
#endif
desired_output++;
@@ -104,14 +104,14 @@ fann_type *fann_test(struct fann *ann, fann_type *input, fann_type *desired_outp
/* get the mean square error.
(obsolete will be removed at some point, use fann_get_MSE)
*/
-float fann_get_error(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_error(struct fann *ann)
{
return fann_get_MSE(ann);
}
/* get the mean square error.
*/
-float fann_get_MSE(struct fann *ann)
+FANN_EXTERNAL float FANN_API fann_get_MSE(struct fann *ann)
{
if(ann->num_MSE){
return ann->MSE_value/(float)ann->num_MSE;
@@ -123,14 +123,14 @@ float fann_get_MSE(struct fann *ann)
/* reset the mean square error.
(obsolete will be removed at some point, use fann_reset_MSE)
*/
-void fann_reset_error(struct fann *ann)
+FANN_EXTERNAL void FANN_API fann_reset_error(struct fann *ann)
{
fann_reset_MSE(ann);
}
/* reset the mean square error.
*/
-void fann_reset_MSE(struct fann *ann)
+FANN_EXTERNAL void FANN_API fann_reset_MSE(struct fann *ann)
{
ann->num_MSE = 0;
ann->MSE_value = 0;
@@ -180,7 +180,7 @@ void fann_compute_MSE(struct fann *ann, fann_type *desired_output)
neuron_diff /= 2.0;
}
- ann->MSE_value += neuron_diff * neuron_diff;
+ ann->MSE_value += (float)(neuron_diff * neuron_diff);
if(ann->use_tanh_error_function){
if ( neuron_diff < -.9999999 )
@@ -478,7 +478,7 @@ void fann_update_weights_quickprop(struct fann *ann, unsigned int num_data)
float epsilon = ann->learning_rate/num_data;
float decay = ann->quickprop_decay; /*-0.0001;*/
float mu = ann->quickprop_mu; /*1.75;*/
- float shrink_factor = mu / (1.0 + mu);
+ float shrink_factor = (float)(mu / (1.0 + mu));
unsigned int i = ann->total_connections;
while(i--){
diff --git a/src/fann_train_data.c b/src/fann_train_data.c
index c4d0b1f..09c2bce 100644
--- a/src/fann_train_data.c
+++ b/src/fann_train_data.c
@@ -28,7 +28,7 @@
/* Reads training data from a file.
*/
-struct fann_train_data* fann_read_train_from_file(char *configuration_file)
+FANN_EXTERNAL struct fann_train_data* FANN_API fann_read_train_from_file(char *configuration_file)
{
struct fann_train_data* data;
FILE *file = fopen(configuration_file, "r");
@@ -45,7 +45,7 @@ struct fann_train_data* fann_read_train_from_file(char *configuration_file)
/* Save training data to a file
*/
-void fann_save_train(struct fann_train_data* data, char *filename)
+FANN_EXTERNAL void FANN_API fann_save_train(struct fann_train_data* data, char *filename)
{
fann_save_train_internal(data, filename, 0, 0);
}
@@ -53,28 +53,18 @@ void fann_save_train(struct fann_train_data* data, char *filename)
/* Save training data to a file in fixed point algebra.
(Good for testing a network in fixed point)
*/
-void fann_save_train_to_fixed(struct fann_train_data* data, char *filename, unsigned int decimal_point)
+FANN_EXTERNAL void FANN_API fann_save_train_to_fixed(struct fann_train_data* data, char *filename, unsigned int decimal_point)
{
fann_save_train_internal(data, filename, 1, decimal_point);
}
/* deallocate the train data structure.
*/
-void fann_destroy_train(struct fann_train_data *data)
+FANN_EXTERNAL void FANN_API fann_destroy_train(struct fann_train_data *data)
{
- unsigned int i;
- if(data->input){
- for(i = 0; i != data->num_data; i++){
- fann_safe_free(data->input[i]);
- }
- }
-
- if(data->output){
- for(i = 0; i != data->num_data; i++){
- fann_safe_free(data->output[i]);
- }
- }
-
+ if(data == NULL) return;
+ fann_safe_free(data->input[0]);
+ fann_safe_free(data->output[0]);
fann_safe_free(data->input);
fann_safe_free(data->output);
fann_safe_free(data);
@@ -82,6 +72,7 @@ void fann_destroy_train(struct fann_train_data *data)
#ifndef FIXEDFANN
+/* Internal train function */
float fann_train_epoch_quickprop(struct fann *ann, struct fann_train_data *data)
{
unsigned int i;
@@ -103,6 +94,7 @@ float fann_train_epoch_quickprop(struct fann *ann, struct fann_train_data *data)
return fann_get_MSE(ann);
}
+/* Internal train function */
float fann_train_epoch_irpropm(struct fann *ann, struct fann_train_data *data)
{
unsigned int i;
@@ -124,6 +116,7 @@ float fann_train_epoch_irpropm(struct fann *ann, struct fann_train_data *data)
return fann_get_MSE(ann);
}
+/* Internal train function */
float fann_train_epoch_batch(struct fann *ann, struct fann_train_data *data)
{
unsigned int i;
@@ -140,6 +133,7 @@ float fann_train_epoch_batch(struct fann *ann, struct fann_train_data *data)
return fann_get_MSE(ann);
}
+/* Internal train function */
float fann_train_epoch_incremental(struct fann *ann, struct fann_train_data *data)
{
unsigned int i;
@@ -154,7 +148,7 @@ float fann_train_epoch_incremental(struct fann *ann, struct fann_train_data *dat
/* Train for one epoch with the selected training algorithm
*/
-float fann_train_epoch(struct fann *ann, struct fann_train_data *data)
+FANN_EXTERNAL float FANN_API fann_train_epoch(struct fann *ann, struct fann_train_data *data)
{
switch(ann->training_algorithm){
case FANN_TRAIN_QUICKPROP:
@@ -176,7 +170,7 @@ float fann_train_epoch(struct fann *ann, struct fann_train_data *data)
/* Test a set of training data and calculate the MSE
*/
-float fann_test_data(struct fann *ann, struct fann_train_data *data)
+FANN_EXTERNAL float FANN_API fann_test_data(struct fann *ann, struct fann_train_data *data)
{
unsigned int i;
fann_reset_MSE(ann);
@@ -190,7 +184,7 @@ float fann_test_data(struct fann *ann, struct fann_train_data *data)
/* Train directly on the training data.
*/
-void 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 (*callback)(unsigned int epochs, float error))
+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 (*callback)(unsigned int epochs, float error))
{
float error;
unsigned int i;
@@ -249,7 +243,7 @@ void fann_train_on_data_callback(struct fann *ann, struct fann_train_data *data,
}
}
-void fann_train_on_data(struct fann *ann, struct fann_train_data *data, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_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)
{
fann_train_on_data_callback(ann, data, max_epochs, epochs_between_reports, desired_error, NULL);
}
@@ -257,7 +251,7 @@ void fann_train_on_data(struct fann *ann, struct fann_train_data *data, unsigned
/* Wrapper to make it easy to train directly on a training data file.
*/
-void fann_train_on_file_callback(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (*callback)(unsigned int epochs, float error))
+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 (*callback)(unsigned int epochs, float error))
{
struct fann_train_data *data = fann_read_train_from_file(filename);
if(data == NULL){
@@ -267,7 +261,7 @@ void fann_train_on_file_callback(struct fann *ann, char *filename, unsigned int
fann_destroy_train(data);
}
-void fann_train_on_file(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error)
+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);
}
@@ -276,7 +270,7 @@ void fann_train_on_file(struct fann *ann, char *filename, unsigned int max_epoch
/* shuffles training data, randomizing the order
*/
-void fann_shuffle_train_data(struct fann_train_data *train_data) {
+FANN_EXTERNAL void FANN_API fann_shuffle_train_data(struct fann_train_data *train_data) {
unsigned int dat = 0, elem, swap;
fann_type temp;
@@ -299,7 +293,7 @@ void fann_shuffle_train_data(struct fann_train_data *train_data) {
/* merges training data into a single struct.
*/
-struct fann_train_data * fann_merge_train_data(struct fann_train_data *data1, struct fann_train_data *data2) {
+FANN_EXTERNAL struct fann_train_data * FANN_API fann_merge_train_data(struct fann_train_data *data1, struct fann_train_data *data2) {
struct fann_train_data * train_data;
unsigned int x;
@@ -343,7 +337,7 @@ struct fann_train_data * fann_merge_train_data(struct fann_train_data *data1, st
/* return a copy of a fann_train_data struct
*/
-struct fann_train_data * fann_duplicate_train_data(struct fann_train_data *data) {
+FANN_EXTERNAL struct fann_train_data * FANN_API fann_duplicate_train_data(struct fann_train_data *data) {
struct fann_train_data * dest;
unsigned int x;
@@ -385,6 +379,7 @@ struct fann_train_data* fann_read_train_from_fd(FILE *file, char *filename)
{
unsigned int num_input, num_output, num_data, i, j;
unsigned int line = 1;
+ fann_type *data_input, *data_output;
struct fann_train_data* data = (struct fann_train_data *)malloc(sizeof(struct fann_train_data));
if(data == NULL){
@@ -418,13 +413,23 @@ struct fann_train_data* fann_read_train_from_fd(FILE *file, char *filename)
return NULL;
}
+ data_input = (fann_type *)calloc(num_input*num_data, sizeof(fann_type));
+ if(data_input == NULL){
+ fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(data);
+ return NULL;
+ }
+
+ data_output = (fann_type *)calloc(num_output*num_data, sizeof(fann_type));
+ if(data_output == NULL){
+ fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(data);
+ return NULL;
+ }
+
for(i = 0; i != num_data; i++){
- data->input[i] = (fann_type *)calloc(num_input, sizeof(fann_type));
- if(data->input[i] == NULL){
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
- fann_destroy_train(data);
- return NULL;
- }
+ data->input[i] = data_input;
+ data_input += num_input;
for(j = 0; j != num_input; j++){
if(fscanf(file, FANNSCANF" ", &data->input[i][j]) != 1){
@@ -435,13 +440,9 @@ struct fann_train_data* fann_read_train_from_fd(FILE *file, char *filename)
}
line++;
- data->output[i] = (fann_type *)calloc(num_output, sizeof(fann_type));
- if(data->output[i] == NULL){
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
- fann_destroy_train(data);
- return NULL;
- }
-
+ data->output[i] = data_output;
+ data_output += num_output;
+
for(j = 0; j != num_output; j++){
if(fscanf(file, FANNSCANF" ", &data->output[i][j]) != 1){
fann_error(NULL, FANN_E_CANT_READ_TD, filename, line);
diff --git a/src/include/compat_time.h b/src/include/compat_time.h
index 4523ef9..7402091 100644
--- a/src/include/compat_time.h
+++ b/src/include/compat_time.h
@@ -34,8 +34,46 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+/* Modified to compile as ANSI C without include of windows.h
+ If this gives problems with future Windows/MSC versions, then
+ uncomment the USE_WINDOWS_H definition to switch back. */
+/* #define USE_WINDOWS_H */
+#ifdef USE_WINDOWS_H
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+#else
+ #define VOID void
+ #define WINAPI __stdcall
+ #define OUT
+ #define WINBASEAPI
+
+ typedef long LONG;
+ typedef unsigned long DWORD;
+ typedef __int64 LONGLONG;
+
+ typedef struct _FILETIME {
+ DWORD dwLowDateTime;
+ DWORD dwHighDateTime;
+ } FILETIME, *LPFILETIME;
+
+ typedef union _LARGE_INTEGER {
+ /* Removed unnamed struct,
+ it is not ANSI C compatible*/
+ /* struct {
+ DWORD LowPart;
+ LONG HighPart;
+ }; */
+ struct {
+ DWORD LowPart;
+ LONG HighPart;
+ } u;
+ LONGLONG QuadPart;
+ } LARGE_INTEGER;
+
+ WINBASEAPI VOID WINAPI
+ GetSystemTimeAsFileTime(OUT LPFILETIME lpSystemTimeAsFileTime);
+#endif /* USE_WINDOWS_H */
+
#include <time.h>
#ifndef __GNUC__
@@ -64,8 +102,11 @@ __inline int gettimeofday(struct timeval *tv, struct timezone *tz)
if (tv)
{
GetSystemTimeAsFileTime(&ft);
- li.LowPart = ft.dwLowDateTime;
- li.HighPart = ft.dwHighDateTime;
+
+ /* The following two lines have been modified to use the named
+ union member. Unnamed members are not ANSI C compatible. */
+ li.u.LowPart = ft.dwLowDateTime;
+ li.u.HighPart = ft.dwHighDateTime;
t = li.QuadPart; /* In 100-nanosecond intervals */
t -= EPOCHFILETIME; /* Offset to the Epoch time */
t /= 10; /* In microseconds */
diff --git a/src/include/fann.h b/src/include/fann.h
index aee46fb..737d29a 100644
--- a/src/include/fann.h
+++ b/src/include/fann.h
@@ -1,445 +1,488 @@
-/*
-Fast Artificial Neural Network Library (fann)
-Copyright (C) 2003 Steffen Nissen (lukesky at diku.dk)
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-/* This file defines the user interface to the fann library.
- It is included from fixedfann.h, floatfann.h and doublefann.h and should
- NOT be included directly. If included directly it will react as if
- floatfann.h was included.
-*/
-
-#ifndef FANN_INCLUDE
-/* just to allow for inclusion of fann.h in normal stuations where only floats are needed */
-#ifdef FIXEDFANN
-#include "fixedfann.h"
-#else
-#include "floatfann.h"
-#endif /* FIXEDFANN */
-
-#else
-
-#include "compat_time.h"
-#include "fann_data.h"
-#include "fann_internal.h"
-#include "fann_activation.h"
-
-#ifndef __fann_h__
-#define __fann_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#ifndef NULL
-#define NULL 0
-#endif /* NULL */
-
-/* ----- Implemented in fann.c Creation, running and destruction of ANNs ----- */
-
-/* Constructs a backpropagation neural network, from an connection rate,
- a learning rate, the number of layers and the number of neurons in each
- of the layers.
-
- The connection rate controls how many connections there will be in the
- network. If the connection rate is set to 1, the network will be fully
- connected, but if it is set to 0.5 only half of the connections will be set.
-
- There will be a bias neuron in each layer (except the output layer),
- and this bias neuron will be connected to all neurons in the next layer.
- When running the network, the bias nodes always emits 1
-*/
-struct fann * fann_create(float connection_rate, float learning_rate,
- /* the number of layers, including the input and output layer */
- unsigned int num_layers,
- /* the number of neurons in each of the layers, starting with
- the input layer and ending with the output layer */
- ...);
-
-/* Just like fann_create, but with an array of layer sizes
- instead of individual parameters.
-*/
-struct fann * fann_create_array(float connection_rate, float learning_rate,
- unsigned int num_layers, unsigned int * layers);
-
-/* create a fully connected neural network with forward connections.
- */
-struct fann * fann_create_forward(float learning_rate,
- unsigned int num_layers, /* the number of layers, including the input and output layer */
- ...); /* the number of neurons in each of the layers, starting with the input layer and ending with the output layer */
-
-/* create a neural network with forward connections.
- */
-struct fann * fann_create_forward_array(float learning_rate, unsigned int num_layers, unsigned int * layers);
-
-/* Runs a input through the network, and returns the output.
- */
-fann_type* fann_run(struct fann *ann, fann_type *input);
-
-/* Destructs the entire network.
- Be sure to call this function after finished using the network.
- */
-void fann_destroy(struct fann *ann);
-
-/* Randomize weights (from the beginning the weights are random between -0.1 and 0.1)
- */
-void fann_randomize_weights(struct fann *ann, fann_type min_weight, fann_type max_weight);
-
-/* Initialize the weights using Widrow + Nguyen's algorithm.
-*/
-void fann_init_weights(struct fann *ann, struct fann_train_data * train_data);
-
-/* print out which connections there are in the ann */
-void fann_print_connections(struct fann *ann);
-
-/* ----- Implemented in fann_io.c Saving and loading of ANNs ----- */
-
-/* Constructs a backpropagation neural network from a configuration file.
- */
-struct fann * fann_create_from_file(const char *configuration_file);
-
-/* Save the entire network to a configuration file.
- */
-void fann_save(struct fann *ann, const char *configuration_file);
-
-/* Saves the entire network to a configuration file.
- But it is saved in fixed point format no matter which
- format it is currently in.
-
- This is usefull for training a network in floating points,
- and then later executing it in fixed point.
-
- The function returns the bit position of the fix point, which
- can be used to find out how accurate the fixed point network will be.
- A high value indicates high precision, and a low value indicates low
- precision.
-
- A negative value indicates very low precision, and a very
- strong possibility for overflow.
- (the actual fix point will be set to 0, since a negative
- fix point does not make sence).
-
- Generally, a fix point lower than 6 is bad, and should be avoided.
- The best way to avoid this, is to have less connections to each neuron,
- or just less neurons in each layer.
-
- The fixed point use of this network is only intended for use on machines that
- have no floating point processor, like an iPAQ. On normal computers the floating
- point version is actually faster.
-*/
-int fann_save_to_fixed(struct fann *ann, const char *configuration_file);
-
-
-/* ----- Implemented in fann_train.c Training and testing of ANNs ----- */
-
-#ifndef FIXEDFANN
-/* Train one iteration with a set of inputs, and a set of desired outputs.
- */
-void fann_train(struct fann *ann, fann_type *input, fann_type *desired_output);
-
-#endif /* NOT FIXEDFANN */
-
-/* Test with a set of inputs, and a set of desired outputs.
- This operation updates the mean square error, but does not
- change the network in any way.
-*/
-fann_type *fann_test(struct fann *ann, fann_type *input, fann_type *desired_output);
-
-/* Reads the mean square error from the network.
- (obsolete will be removed at some point, use fann_get_MSE)
- */
-float fann_get_error(struct fann *ann);
-
-/* Reads the mean square error from the network.
- */
-float fann_get_MSE(struct fann *ann);
-
-/* Resets the mean square error from the network.
- (obsolete will be removed at some point, use fann_reset_MSE)
- */
-void fann_reset_error(struct fann *ann);
-
-/* Resets the mean square error from the network.
- */
-void fann_reset_MSE(struct fann *ann);
-
-/* ----- Implemented in fann_train_data.c Data for training of ANNs ----- */
-
-/* Reads a file that stores training data, in the format:
- num_train_data num_input num_output\n
- inputdata seperated by space\n
- outputdata seperated by space\n
-
- .
- .
- .
-
- inputdata seperated by space\n
- outputdata seperated by space\n
-*/
-struct fann_train_data* fann_read_train_from_file(char *filename);
-
-/* Destructs the training data
- Be sure to call this function after finished using the training data.
- */
-void fann_destroy_train(struct fann_train_data* train_data);
-
-#ifndef FIXEDFANN
-
-/* Train one epoch with a set of training data.
- */
-float fann_train_epoch(struct fann *ann, struct fann_train_data *data);
-
-/* Test a set of training data and calculate the MSE
- */
-float fann_test_data(struct fann *ann, struct fann_train_data *data);
-
-/* Trains on an entire dataset, for a maximum of max_epochs
- epochs or until mean square error is lower than desired_error.
- Reports about the progress is given every
- epochs_between_reports epochs.
- If epochs_between_reports is zero, no reports are given.
-*/
-void fann_train_on_data(struct fann *ann, struct fann_train_data *data, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error);
-
-/* 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.
-*/
-void 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 (*callback)(unsigned int epochs, float error));
-
-/* Does the same as train_on_data, but reads the data directly from a file.
- */
-void fann_train_on_file(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error);
-
-/* Does the same as train_on_data_callback, but
- reads the data directly from a file.
- */
-void fann_train_on_file_callback(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (*callback)(unsigned int epochs, float error));
-
-/* shuffles training data, randomizing the order
- */
-void fann_shuffle_train_data(struct fann_train_data *train_data);
-
-/* merges training data into a single struct.
- */
-struct fann_train_data * fann_merge_train_data(struct fann_train_data *data1, struct fann_train_data *data2);
-
-/* return a copy of a fann_train_data struct
- */
-struct fann_train_data * fann_duplicate_train_data(struct fann_train_data *data);
-
-#endif /* NOT FIXEDFANN */
-
-/* Save the training structure to a file.
- */
-void fann_save_train(struct fann_train_data* data, char *filename);
-
-/* Saves the training structure to a fixed point data file.
- * (Very usefull for testing the quality of a fixed point network).
- */
-void fann_save_train_to_fixed(struct fann_train_data* data, char *filename, unsigned int decimal_point);
-
-
-
-/* ----- Implemented in fann_options.c Get and set options for the ANNs ----- */
-
-/* Prints all of the parameters and options of the ANN */
-void fann_print_parameters(struct fann *ann);
-
-/* Get the training algorithm.
- */
-unsigned int fann_get_training_algorithm(struct fann *ann);
-
-/* Set the training algorithm.
- */
-void fann_set_training_algorithm(struct fann *ann, unsigned int training_algorithm);
-
-/* Get the learning rate.
- */
-float fann_get_learning_rate(struct fann *ann);
-
-/* Set the learning rate.
- */
-void fann_set_learning_rate(struct fann *ann, float learning_rate);
-
-/* Get the activation function used in the hidden layers.
- */
-unsigned int fann_get_activation_function_hidden(struct fann *ann);
-
-/* Set the activation function for the hidden layers.
- */
-void fann_set_activation_function_hidden(struct fann *ann, unsigned int activation_function);
-
-/* Get the activation function used in the output layer.
- */
-unsigned int fann_get_activation_function_output(struct fann *ann);
-
-/* Set the activation function for the output layer.
- */
-void fann_set_activation_function_output(struct fann *ann, unsigned int activation_function);
-
-/* Get the steepness parameter for the sigmoid function used in the hidden layers.
- */
-fann_type fann_get_activation_steepness_hidden(struct fann *ann);
-
-/* Set the steepness of the sigmoid function used in the hidden layers.
- Only usefull if sigmoid function is used in the hidden layers (default 0.5).
- */
-void fann_set_activation_steepness_hidden(struct fann *ann, fann_type steepness);
-
-/* Get the steepness parameter for the sigmoid function used in the output layer.
- */
-fann_type fann_get_activation_steepness_output(struct fann *ann);
-
-/* Set the steepness of the sigmoid function used in the output layer.
- Only usefull if sigmoid function is used in the output layer (default 0.5).
- */
-void fann_set_activation_steepness_output(struct fann *ann, fann_type steepness);
-
-/* OBSOLETE use fann_get_activation_steepness_hidden
- Get the steepness parameter for the sigmoid function used in the hidden layers.
- */
-fann_type fann_get_activation_hidden_steepness(struct fann *ann);
-
-/* OBSOLETE use fann_set_activation_steepness_hidden
- Set the steepness of the sigmoid function used in the hidden layers.
- Only usefull if sigmoid function is used in the hidden layers (default 0.5).
- */
-void fann_set_activation_hidden_steepness(struct fann *ann, fann_type steepness);
-
-/* OBSOLETE use fann_get_activation_steepness_output
- Get the steepness parameter for the sigmoid function used in the output layer.
- */
-fann_type fann_get_activation_output_steepness(struct fann *ann);
-
-/* OBSOLETE use fann_set_activation_steepness_output
- Set the steepness of the sigmoid function used in the output layer.
- Only usefull if sigmoid function is used in the output layer (default 0.5).
- */
-void fann_set_activation_output_steepness(struct fann *ann, fann_type steepness);
-
-/* When using this, training is usually faster. (default).
- Makes the error used for calculating the slopes
- higher when the difference is higher.
- */
-void fann_set_use_tanh_error_function(struct fann *ann, unsigned int use_tanh_error_function);
-
-/* When using this, training is usually faster. (default).
- Makes the error used for calculating the slopes
- higher when the difference is higher.
- */
-unsigned int fann_get_use_tanh_error_function(struct fann *ann);
-
-/* Decay is used to make the weights do not go so high (default -0.0001). */
-float fann_get_quickprop_decay(struct fann *ann);
-
-/* Decay is used to make the weights do not go so high (default -0.0001). */
-void fann_set_quickprop_decay(struct fann *ann, float quickprop_decay);
-
-/* Mu is a factor used to increase and decrease the stepsize (default 1.75). */
-float fann_get_quickprop_mu(struct fann *ann);
-
-/* Mu is a factor used to increase and decrease the stepsize (default 1.75). */
-void fann_set_quickprop_mu(struct fann *ann, float quickprop_mu);
-
-/* Tells how much the stepsize should increase during learning (default 1.2). */
-float fann_get_rprop_increase_factor(struct fann *ann);
-
-/* Tells how much the stepsize should increase during learning (default 1.2). */
-void fann_set_rprop_increase_factor(struct fann *ann, float rprop_increase_factor);
-
-/* Tells how much the stepsize should decrease during learning (default 0.5). */
-float fann_get_rprop_decrease_factor(struct fann *ann);
-
-/* Tells how much the stepsize should decrease during learning (default 0.5). */
-void fann_set_rprop_decrease_factor(struct fann *ann, float rprop_decrease_factor);
-
-/* The minimum stepsize (default 0.0). */
-float fann_get_rprop_delta_min(struct fann *ann);
-
-/* The minimum stepsize (default 0.0). */
-void fann_set_rprop_delta_min(struct fann *ann, float rprop_delta_min);
-
-/* The maximum stepsize (default 50.0). */
-float fann_get_rprop_delta_max(struct fann *ann);
-
-/* The maximum stepsize (default 50.0). */
-void fann_set_rprop_delta_max(struct fann *ann, float rprop_delta_max);
-
-/* Get the number of input neurons.
- */
-unsigned int fann_get_num_input(struct fann *ann);
-
-/* Get the number of output neurons.
- */
-unsigned int fann_get_num_output(struct fann *ann);
-
-/* Get the total number of neurons in the entire network.
- */
-unsigned int fann_get_total_neurons(struct fann *ann);
-
-/* Get the total number of connections in the entire network.
- */
-unsigned int fann_get_total_connections(struct fann *ann);
-
-#ifdef FIXEDFANN
-
-/* returns the position of the decimal point.
- */
-unsigned int fann_get_decimal_point(struct fann *ann);
-
-/* returns the multiplier that fix point data is multiplied with.
- */
-unsigned int fann_get_multiplier(struct fann *ann);
-#endif /* FIXEDFANN */
-
-/* ----- Implemented in fann_error.c Access error information about the ANN ----- */
-
-/* change where errors are logged to
- */
-void fann_set_error_log(struct fann_error *errdat, FILE *log_file);
-
-/* returns the last error number
- */
-unsigned int fann_get_errno(struct fann_error *errdat);
-
-/* resets the last error number
- */
-void fann_reset_errno(struct fann_error *errdat);
-
-/* resets the last error string
- */
-void fann_reset_errstr(struct fann_error *errdat);
-
-/* returns the last errstr.
- * This function calls fann_reset_errno and fann_reset_errstr
- */
-char * fann_get_errstr(struct fann_error *errdat);
-
-/* prints the last error to stderr
- */
-void fann_print_error(struct fann_error *errdat);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __fann_h__ */
-
-#endif /* NOT FANN_INCLUDE */
+/*
+Fast Artificial Neural Network Library (fann)
+Copyright (C) 2003 Steffen Nissen (lukesky at diku.dk)
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+/* This file defines the user interface to the fann library.
+ It is included from fixedfann.h, floatfann.h and doublefann.h and should
+ NOT be included directly. If included directly it will react as if
+ floatfann.h was included.
+*/
+
+#ifndef FANN_INCLUDE
+/* just to allow for inclusion of fann.h in normal stuations where only floats are needed */
+#ifdef FIXEDFANN
+#include "fixedfann.h"
+#else
+#include "floatfann.h"
+#endif /* FIXEDFANN */
+
+#else
+
+#include "compat_time.h"
+#include "fann_data.h"
+#include "fann_internal.h"
+#include "fann_activation.h"
+
+#ifndef __fann_h__
+#define __fann_h__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef NULL
+#define NULL 0
+#endif /* NULL */
+
+/* ----- Macros used to define DLL external entrypoints ----- */
+/*
+ DLL Export, import and calling convention for Windows.
+ Only defined for Microsoft VC++ FANN_EXTERNAL indicates
+ that a function will be exported/imported from a dll
+ FANN_API ensures that the DLL calling convention
+ will be used for a function regardless of the calling convention
+ used when compiling.
+
+ For a function to be exported from a DLL its prototype and
+ declaration must be like this:
+ FANN_EXTERNAL void FANN_API function(char *argument)
+
+ The following ifdef block is a way of creating macros which
+ make exporting from a DLL simple. All files within a DLL are
+ compiled with the FANN_DLL_EXPORTS symbol defined on the
+ command line. This symbol should not be defined on any project
+ that uses this DLL. This way any other project whose source
+ files include this file see FANN_EXTERNAL functions as being imported
+ from a DLL, whereas a DLL sees symbols defined with this
+ macro as being exported which makes calls more efficient.
+ 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
+ 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)
+*/
+
+#ifdef _MSC_VER
+#ifdef FANN_DLL_EXPORTS
+#define FANN_EXTERNAL __declspec(dllexport)
+#else
+#define FANN_EXTERNAL __declspec(dllimport)
+#endif /* FANN_DLL_EXPORTS*/
+#define FANN_API __stdcall
+#else
+#define FANN_EXTERNAL
+#define FANN_API
+#endif /* _MSC_VER */
+/* ----- End of macros used to define DLL external entrypoints ----- */
+
+
+/* ----- Implemented in fann.c Creation, running and destruction of ANNs ----- */
+
+/* Constructs a backpropagation neural network, from an connection rate,
+ a learning rate, the number of layers and the number of neurons in each
+ of the layers.
+
+ The connection rate controls how many connections there will be in the
+ network. If the connection rate is set to 1, the network will be fully
+ connected, but if it is set to 0.5 only half of the connections will be set.
+
+ There will be a bias neuron in each layer (except the output layer),
+ and this bias neuron will be connected to all neurons in the next layer.
+ When running the network, the bias nodes always emits 1
+*/
+FANN_EXTERNAL struct fann * FANN_API fann_create(float connection_rate, float learning_rate,
+ /* the number of layers, including the input and output layer */
+ unsigned int num_layers,
+ /* the number of neurons in each of the layers, starting with
+ the input layer and ending with the output layer */
+ ...);
+
+/* Just like fann_create, but with an array of layer sizes
+ instead of individual parameters.
+*/
+FANN_EXTERNAL struct fann * FANN_API fann_create_array(float connection_rate, float learning_rate,
+ unsigned int num_layers, unsigned int * layers);
+
+/* create a fully connected neural network with forward connections.
+ */
+FANN_EXTERNAL struct fann * FANN_API fann_create_forward(float learning_rate,
+ unsigned int num_layers, /* the number of layers, including the input and output layer */
+ ...); /* the number of neurons in each of the layers, starting with the input layer and ending with the output layer */
+
+/* create a neural network with forward connections.
+ */
+FANN_EXTERNAL struct fann * FANN_API fann_create_forward_array(float learning_rate, unsigned int num_layers, unsigned int * layers);
+
+/* Runs a input through the network, and returns the output.
+ */
+FANN_EXTERNAL fann_type* FANN_API fann_run(struct fann *ann, fann_type *input);
+
+/* Destructs the entire network.
+ Be sure to call this function after finished using the network.
+ */
+FANN_EXTERNAL void FANN_API fann_destroy(struct fann *ann);
+
+/* Randomize weights (from the beginning the weights are random between -0.1 and 0.1)
+ */
+FANN_EXTERNAL void FANN_API fann_randomize_weights(struct fann *ann, fann_type min_weight, fann_type max_weight);
+
+/* Initialize the weights using Widrow + Nguyen's algorithm.
+*/
+FANN_EXTERNAL void FANN_API fann_init_weights(struct fann *ann, struct fann_train_data * train_data);
+
+/* print out which connections there are in the ann */
+FANN_EXTERNAL void FANN_API fann_print_connections(struct fann *ann);
+
+/* ----- Implemented in fann_io.c Saving and loading of ANNs ----- */
+
+/* Constructs a backpropagation neural network from a configuration file.
+ */
+FANN_EXTERNAL struct fann * FANN_API fann_create_from_file(const char *configuration_file);
+
+/* Save the entire network to a configuration file.
+ */
+FANN_EXTERNAL void FANN_API fann_save(struct fann *ann, const char *configuration_file);
+
+/* Saves the entire network to a configuration file.
+ But it is saved in fixed point format no matter which
+ format it is currently in.
+
+ This is usefull for training a network in floating points,
+ and then later executing it in fixed point.
+
+ The function returns the bit position of the fix point, which
+ can be used to find out how accurate the fixed point network will be.
+ A high value indicates high precision, and a low value indicates low
+ precision.
+
+ A negative value indicates very low precision, and a very
+ strong possibility for overflow.
+ (the actual fix point will be set to 0, since a negative
+ fix point does not make sence).
+
+ Generally, a fix point lower than 6 is bad, and should be avoided.
+ The best way to avoid this, is to have less connections to each neuron,
+ or just less neurons in each layer.
+
+ The fixed point use of this network is only intended for use on machines that
+ have no floating point processor, like an iPAQ. On normal computers the floating
+ point version is actually faster.
+*/
+FANN_EXTERNAL int FANN_API fann_save_to_fixed(struct fann *ann, const char *configuration_file);
+
+
+/* ----- Implemented in fann_train.c Training and testing of ANNs ----- */
+
+#ifndef FIXEDFANN
+/* Train one iteration with a set of inputs, and a set of desired outputs.
+ */
+FANN_EXTERNAL void FANN_API fann_train(struct fann *ann, fann_type *input, fann_type *desired_output);
+
+#endif /* NOT FIXEDFANN */
+
+/* Test with a set of inputs, and a set of desired outputs.
+ This operation updates the mean square error, but does not
+ change the network in any way.
+*/
+FANN_EXTERNAL fann_type * FANN_API fann_test(struct fann *ann, fann_type *input, fann_type *desired_output);
+
+/* Reads the mean square error from the network.
+ (obsolete will be removed at some point, use fann_get_MSE)
+ */
+FANN_EXTERNAL float FANN_API fann_get_error(struct fann *ann);
+
+/* Reads the mean square error from the network.
+ */
+FANN_EXTERNAL float FANN_API fann_get_MSE(struct fann *ann);
+
+/* Resets the mean square error from the network.
+ (obsolete will be removed at some point, use fann_reset_MSE)
+ */
+FANN_EXTERNAL void FANN_API fann_reset_error(struct fann *ann);
+
+/* Resets the mean square error from the network.
+ */
+FANN_EXTERNAL void FANN_API fann_reset_MSE(struct fann *ann);
+
+/* ----- Implemented in fann_train_data.c Data for training of ANNs ----- */
+
+/* Reads a file that stores training data, in the format:
+ num_train_data num_input num_output\n
+ inputdata seperated by space\n
+ outputdata seperated by space\n
+
+ .
+ .
+ .
+
+ inputdata seperated by space\n
+ outputdata seperated by space\n
+*/
+FANN_EXTERNAL struct fann_train_data* FANN_API fann_read_train_from_file(char *filename);
+
+/* Destructs the training data
+ Be sure to call this function after finished using the training data.
+ */
+FANN_EXTERNAL void FANN_API fann_destroy_train(struct fann_train_data* train_data);
+
+#ifndef FIXEDFANN
+
+/* Train one epoch with a set of training data.
+ */
+FANN_EXTERNAL float FANN_API fann_train_epoch(struct fann *ann, struct fann_train_data *data);
+
+/* Test a set of training data and calculate the MSE
+ */
+FANN_EXTERNAL float FANN_API fann_test_data(struct fann *ann, struct fann_train_data *data);
+
+/* Trains on an entire dataset, for a maximum of max_epochs
+ epochs or until mean square error is lower than desired_error.
+ Reports about the progress is given every
+ epochs_between_reports epochs.
+ If epochs_between_reports is zero, no reports are given.
+*/
+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);
+
+/* 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.
+*/
+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 (*callback)(unsigned int epochs, float error));
+
+/* 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);
+
+/* Does the same as train_on_data_callback, but
+ reads the data directly from a 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 (*callback)(unsigned int epochs, float error));
+
+/* shuffles training data, randomizing the order
+ */
+FANN_EXTERNAL void FANN_API fann_shuffle_train_data(struct fann_train_data *train_data);
+
+/* merges training data into a single struct.
+ */
+FANN_EXTERNAL struct fann_train_data * FANN_API fann_merge_train_data(struct fann_train_data *data1, struct fann_train_data *data2);
+
+/* return a copy of a fann_train_data struct
+ */
+FANN_EXTERNAL struct fann_train_data * FANN_API fann_duplicate_train_data(struct fann_train_data *data);
+
+#endif /* NOT FIXEDFANN */
+
+/* Save the training structure to a file.
+ */
+FANN_EXTERNAL void FANN_API fann_save_train(struct fann_train_data* data, char *filename);
+
+/* Saves the training structure to a fixed point data file.
+ * (Very usefull for testing the quality of a fixed point network).
+ */
+FANN_EXTERNAL void FANN_API fann_save_train_to_fixed(struct fann_train_data* data, char *filename, unsigned int decimal_point);
+
+/* ----- Implemented in fann_options.c Get and set options for the ANNs ----- */
+
+/* Prints all of the parameters and options of the ANN */
+FANN_EXTERNAL void FANN_API fann_print_parameters(struct fann *ann);
+
+/* Get the training algorithm.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_training_algorithm(struct fann *ann);
+
+/* Set the training algorithm.
+ */
+FANN_EXTERNAL void FANN_API fann_set_training_algorithm(struct fann *ann, unsigned int training_algorithm);
+
+/* Get the learning rate.
+ */
+FANN_EXTERNAL float FANN_API fann_get_learning_rate(struct fann *ann);
+
+/* Set the learning rate.
+ */
+FANN_EXTERNAL void FANN_API fann_set_learning_rate(struct fann *ann, float learning_rate);
+
+/* Get the activation function used in the hidden layers.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_activation_function_hidden(struct fann *ann);
+
+/* Set the activation function for the hidden layers.
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_function_hidden(struct fann *ann, unsigned int activation_function);
+
+/* Get the activation function used in the output layer.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_activation_function_output(struct fann *ann);
+
+/* Set the activation function for the output layer.
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_function_output(struct fann *ann, unsigned int activation_function);
+
+/* Get the steepness parameter for the sigmoid function used in the hidden layers.
+ */
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_steepness_hidden(struct fann *ann);
+
+/* Set the steepness of the sigmoid function used in the hidden layers.
+ Only usefull if sigmoid function is used in the hidden layers (default 0.5).
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_steepness_hidden(struct fann *ann, fann_type steepness);
+
+/* Get the steepness parameter for the sigmoid function used in the output layer.
+ */
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_steepness_output(struct fann *ann);
+
+/* Set the steepness of the sigmoid function used in the output layer.
+ Only usefull if sigmoid function is used in the output layer (default 0.5).
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_steepness_output(struct fann *ann, fann_type steepness);
+
+/* OBSOLETE use fann_get_activation_steepness_hidden
+ Get the steepness parameter for the sigmoid function used in the hidden layers.
+ */
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_hidden_steepness(struct fann *ann);
+
+/* OBSOLETE use fann_set_activation_steepness_hidden
+ Set the steepness of the sigmoid function used in the hidden layers.
+ Only usefull if sigmoid function is used in the hidden layers (default 0.5).
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_hidden_steepness(struct fann *ann, fann_type steepness);
+
+/* OBSOLETE use fann_get_activation_steepness_output
+ Get the steepness parameter for the sigmoid function used in the output layer.
+ */
+FANN_EXTERNAL fann_type FANN_API fann_get_activation_output_steepness(struct fann *ann);
+
+/* OBSOLETE use fann_set_activation_steepness_output
+ Set the steepness of the sigmoid function used in the output layer.
+ Only usefull if sigmoid function is used in the output layer (default 0.5).
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_output_steepness(struct fann *ann, fann_type steepness);
+
+/* When using this, training is usually faster. (default).
+ Makes the error used for calculating the slopes
+ higher when the difference is higher.
+ */
+FANN_EXTERNAL void FANN_API fann_set_use_tanh_error_function(struct fann *ann, unsigned int use_tanh_error_function);
+
+/* When using this, training is usually faster. (default).
+ Makes the error used for calculating the slopes
+ higher when the difference is higher.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_use_tanh_error_function(struct fann *ann);
+
+/* Decay is used to make the weights do not go so high (default -0.0001). */
+FANN_EXTERNAL float FANN_API fann_get_quickprop_decay(struct fann *ann);
+
+/* Decay is used to make the weights do not go so high (default -0.0001). */
+FANN_EXTERNAL void FANN_API fann_set_quickprop_decay(struct fann *ann, float quickprop_decay);
+
+/* Mu is a factor used to increase and decrease the stepsize (default 1.75). */
+FANN_EXTERNAL float FANN_API fann_get_quickprop_mu(struct fann *ann);
+
+/* Mu is a factor used to increase and decrease the stepsize (default 1.75). */
+FANN_EXTERNAL void FANN_API fann_set_quickprop_mu(struct fann *ann, float quickprop_mu);
+
+/* Tells how much the stepsize should increase during learning (default 1.2). */
+FANN_EXTERNAL float FANN_API fann_get_rprop_increase_factor(struct fann *ann);
+
+/* Tells how much the stepsize should increase during learning (default 1.2). */
+FANN_EXTERNAL void FANN_API fann_set_rprop_increase_factor(struct fann *ann, float rprop_increase_factor);
+
+/* Tells how much the stepsize should decrease during learning (default 0.5). */
+FANN_EXTERNAL float FANN_API fann_get_rprop_decrease_factor(struct fann *ann);
+
+/* Tells how much the stepsize should decrease during learning (default 0.5). */
+FANN_EXTERNAL void FANN_API fann_set_rprop_decrease_factor(struct fann *ann, float rprop_decrease_factor);
+
+/* The minimum stepsize (default 0.0). */
+FANN_EXTERNAL float FANN_API fann_get_rprop_delta_min(struct fann *ann);
+
+/* The minimum stepsize (default 0.0). */
+FANN_EXTERNAL void FANN_API fann_set_rprop_delta_min(struct fann *ann, float rprop_delta_min);
+
+/* The maximum stepsize (default 50.0). */
+FANN_EXTERNAL float FANN_API fann_get_rprop_delta_max(struct fann *ann);
+
+/* The maximum stepsize (default 50.0). */
+FANN_EXTERNAL void FANN_API fann_set_rprop_delta_max(struct fann *ann, float rprop_delta_max);
+
+/* Get the number of input neurons.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_num_input(struct fann *ann);
+
+/* Get the number of output neurons.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_num_output(struct fann *ann);
+
+/* Get the total number of neurons in the entire network.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_total_neurons(struct fann *ann);
+
+/* Get the total number of connections in the entire network.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_total_connections(struct fann *ann);
+
+#ifdef FIXEDFANN
+
+/* returns the position of the decimal point.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_decimal_point(struct fann *ann);
+
+/* returns the multiplier that fix point data is multiplied with.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_multiplier(struct fann *ann);
+#endif /* FIXEDFANN */
+
+/* ----- Implemented in fann_error.c Access error information about the ANN ----- */
+
+/* change where errors are logged to
+ */
+FANN_EXTERNAL void FANN_API fann_set_error_log(struct fann_error *errdat, FILE *log_file);
+
+/* returns the last error number
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_get_errno(struct fann_error *errdat);
+
+/* resets the last error number
+ */
+FANN_EXTERNAL void FANN_API fann_reset_errno(struct fann_error *errdat);
+
+/* resets the last error string
+ */
+FANN_EXTERNAL void FANN_API fann_reset_errstr(struct fann_error *errdat);
+
+/* returns the last errstr.
+ * This function calls fann_reset_errno and fann_reset_errstr
+ */
+FANN_EXTERNAL char * FANN_API fann_get_errstr(struct fann_error *errdat);
+
+/* prints the last error to stderr
+ */
+FANN_EXTERNAL void FANN_API fann_print_error(struct fann_error *errdat);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __fann_h__ */
+
+#endif /* NOT FANN_INCLUDE */
diff --git a/src/include/fann_activation.h b/src/include/fann_activation.h
index f55b68e..0b2fa22 100644
--- a/src/include/fann_activation.h
+++ b/src/include/fann_activation.h
@@ -100,7 +100,7 @@ enum {
y = (x*s) / (1 + |x*s|), d = s*1/((1+|x|)*(1+|x|))
NOT implemented yet.
*/
- FANN_ELLIOT_SYMMETRIC,
+ FANN_ELLIOT_SYMMETRIC
};
static char const * const FANN_ACTIVATION_NAMES[] = {
diff --git a/src/include/fann_internal.h b/src/include/fann_internal.h
index 1b3035a..4ff6628 100644
--- a/src/include/fann_internal.h
+++ b/src/include/fann_internal.h
@@ -69,7 +69,8 @@ void fann_update_weights_batch(struct fann *ann, unsigned int num_data);
fann_type* fann_get_weights(struct fann *ann);
/* get a pointer to the connections */
struct fann_neuron** fann_get_connections(struct fann *ann);
-
+
+void fann_clear_train_arrays(struct fann *ann);
/* called fann_max, in order to not interferre with predefined versions of max */
#define fann_max(x, y) (((x) > (y)) ? (x) : (y))
--
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