FANN Error Handling

Errors from the fann library are usually reported on stderr.  It is however possible to redirect these error messages to a file, or completely ignore them by the fann_set_error_log function.

It is also possible to inspect the last error message by using the fann_get_errno and fann_get_errstr functions.

Summary
FANN Error HandlingErrors from the fann library are usually reported on stderr.
fann_errno_enumUsed to define error events on struct fann and struct fann_train_data.
Error Handling
fann_set_error_logChange where errors are logged to.
fann_get_errnoReturns the last error number.
fann_reset_errnoResets the last error number.
fann_reset_errstrResets the last error string.
fann_get_errstrReturns the last errstr.
fann_print_errorPrints the last error to stderr.

fann_errno_enum

Used to define error events on struct fann and struct fann_train_data.

See also

fann_get_errno, fann_reset_errno, fann_get_errstr

FANN_E_NO_ERRORNo error
FANN_E_CANT_OPEN_CONFIG_RUnable to open configuration file for reading
FANN_E_CANT_OPEN_CONFIG_WUnable to open configuration file for writing
FANN_E_WRONG_CONFIG_VERSIONWrong version of configuration file
FANN_E_CANT_READ_CONFIGError reading info from configuration file
FANN_E_CANT_READ_NEURONError reading neuron info from configuration file
FANN_E_CANT_READ_CONNECTIONSError reading connections from configuration file
FANN_E_WRONG_NUM_CONNECTIONSNumber of connections not equal to the number expected
FANN_E_CANT_OPEN_TD_WUnable to open train data file for writing
FANN_E_CANT_OPEN_TD_RUnable to open train data file for reading
FANN_E_CANT_READ_TDError reading training data from file
FANN_E_CANT_ALLOCATE_MEMUnable to allocate memory
FANN_E_CANT_TRAIN_ACTIVATIONUnable to train with the selected activation function
FANN_E_CANT_USE_ACTIVATIONUnable to use the selected activation function
FANN_E_TRAIN_DATA_MISMATCHIrreconcilable differences between two struct fann_train_data structures
FANN_E_CANT_USE_TRAIN_ALGUnable to use the selected training algorithm
FANN_E_TRAIN_DATA_SUBSETTrying to take subset which is not within the training set
FANN_E_INDEX_OUT_OF_BOUNDIndex is out of bound
FANN_E_SCALE_NOT_PRESENTScaling parameters not present
FANN_E_INPUT_NO_MATCHThe number of input neurons in the ann and data don’t match
FANN_E_OUTPUT_NO_MATCHThe number of output neurons in the ann and data don’t match
FANN_E_WRONG_PARAMETERS_FOR_CREATEThe parameters for create_standard are wrong, either too few parameters provided or a negative/very high value provided

Error Handling

fann_set_error_log

FANN_EXTERNAL void FANN_API fann_set_error_log(struct fann_error *errdat,
FILE *log_file)

Change where errors are logged to.  Both struct fann and <struct fann_data> can be casted to struct fann_error, so this function can be used to set either of these.

If log_file is NULL, no errors will be printed.

If errdat is NULL, the default log will be set.  The default log is the log used when creating struct fann and <struct fann_data>.  This default log will also be the default for all new structs that are created.

The default behavior is to log them to stderr.

See also

struct fann_error

This function appears in FANN >= 1.1.0.

fann_get_errno

FANN_EXTERNAL enum fann_errno_enum FANN_API fann_get_errno(
   struct fann_error *errdat
)

Returns the last error number.

See also

fann_errno_enum, fann_reset_errno

This function appears in FANN >= 1.1.0.

fann_reset_errno

FANN_EXTERNAL void FANN_API fann_reset_errno(struct fann_error *errdat)

Resets the last error number.

This function appears in FANN >= 1.1.0.

fann_reset_errstr

FANN_EXTERNAL void FANN_API fann_reset_errstr(struct fann_error *errdat)

Resets the last error string.

This function appears in FANN >= 1.1.0.

fann_get_errstr

FANN_EXTERNAL char *FANN_API fann_get_errstr(struct fann_error *errdat)

Returns the last errstr.

This function calls fann_reset_errno and fann_reset_errstr

This function appears in FANN >= 1.1.0.

fann_print_error

FANN_EXTERNAL void FANN_API fann_print_error(struct fann_error *errdat)

Prints the last error to stderr.

This function appears in FANN >= 1.1.0.

struct fann
The fast artificial neural network (fann) structure.
struct fann_train_data
Structure used to store data, for use with training.
FANN_EXTERNAL void FANN_API fann_set_error_log(struct fann_error *errdat,
FILE *log_file)
Change where errors are logged to.
FANN_EXTERNAL enum fann_errno_enum FANN_API fann_get_errno(
   struct fann_error *errdat
)
Returns the last error number.
FANN_EXTERNAL void FANN_API fann_reset_errno(struct fann_error *errdat)
Resets the last error number.
FANN_EXTERNAL void FANN_API fann_reset_errstr(struct fann_error *errdat)
Resets the last error string.
FANN_EXTERNAL char *FANN_API fann_get_errstr(struct fann_error *errdat)
Returns the last errstr.
FANN_EXTERNAL void FANN_API fann_print_error(struct fann_error *errdat)
Prints the last error to stderr.
struct fann_error
Structure used to store error-related information, both struct fann and struct fann_train_data can be casted to this type.
Used to define error events on struct fann and struct fann_train_data.
Close