📄 fann.h
字号:
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 (FANN_API *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 (FANN_API *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);
/* Get the error function used during training. (default FANN_ERRORFUNC_TANH)
*/
FANN_EXTERNAL void FANN_API fann_set_train_error_function(struct fann *ann, unsigned int train_error_function);
/* Get the error function used during training.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_train_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 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -