2 Fast Artificial Neural Network Library (fann)
3 Copyright (C) 2003 Steffen Nissen (lukesky@diku.dk)
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef __fann_error_h__
21 #define __fann_error_h__
25 #define FANN_ERRSTR_MAX 128
28 /* Section: FANN Error Handling
30 Errors from the fann library are usually reported on stderr.
31 It is however possible to redirect these error messages to a file,
32 or completely ignore them by the <fann_set_error_log> function.
34 It is also possible to inspect the last error message by using the
35 <fann_get_errno> and <fann_get_errstr> functions.
38 /* Enum: fann_errno_enum
39 Used to define error events on <struct fann> and <struct fann_train_data>.
42 <fann_get_errno>, <fann_reset_errno>, <fann_get_errstr>
44 FANN_E_NO_ERROR - No error
45 FANN_E_CANT_OPEN_CONFIG_R - Unable to open configuration file for reading
46 FANN_E_CANT_OPEN_CONFIG_W - Unable to open configuration file for writing
47 FANN_E_WRONG_CONFIG_VERSION - Wrong version of configuration file
48 FANN_E_CANT_READ_CONFIG - Error reading info from configuration file
49 FANN_E_CANT_READ_NEURON - Error reading neuron info from configuration file
50 FANN_E_CANT_READ_CONNECTIONS - Error reading connections from configuration file
51 FANN_E_WRONG_NUM_CONNECTIONS - Number of connections not equal to the number expected
52 FANN_E_CANT_OPEN_TD_W - Unable to open train data file for writing
53 FANN_E_CANT_OPEN_TD_R - Unable to open train data file for reading
54 FANN_E_CANT_READ_TD - Error reading training data from file
55 FANN_E_CANT_ALLOCATE_MEM - Unable to allocate memory
56 FANN_E_CANT_TRAIN_ACTIVATION - Unable to train with the selected activation function
57 FANN_E_CANT_USE_ACTIVATION - Unable to use the selected activation function
58 FANN_E_TRAIN_DATA_MISMATCH - Irreconcilable differences between two <struct fann_train_data> structures
59 FANN_E_CANT_USE_TRAIN_ALG - Unable to use the selected training algorithm
60 FANN_E_TRAIN_DATA_SUBSET - Trying to take subset which is not within the training set
61 FANN_E_INDEX_OUT_OF_BOUND - Index is out of bound
66 FANN_E_CANT_OPEN_CONFIG_R,
67 FANN_E_CANT_OPEN_CONFIG_W,
68 FANN_E_WRONG_CONFIG_VERSION,
69 FANN_E_CANT_READ_CONFIG,
70 FANN_E_CANT_READ_NEURON,
71 FANN_E_CANT_READ_CONNECTIONS,
72 FANN_E_WRONG_NUM_CONNECTIONS,
73 FANN_E_CANT_OPEN_TD_W,
74 FANN_E_CANT_OPEN_TD_R,
76 FANN_E_CANT_ALLOCATE_MEM,
77 FANN_E_CANT_TRAIN_ACTIVATION,
78 FANN_E_CANT_USE_ACTIVATION,
79 FANN_E_TRAIN_DATA_MISMATCH,
80 FANN_E_CANT_USE_TRAIN_ALG,
81 FANN_E_TRAIN_DATA_SUBSET,
82 FANN_E_INDEX_OUT_OF_BOUND
85 /* Group: Error Handling */
87 /* Function: fann_set_error_log
89 Change where errors are logged to. Both <struct fann> and <struct fann_data> can be
90 casted to <struct fann_error>, so this function can be used to set either of these.
92 If log_file is NULL, no errors will be printed.
94 If errdata is NULL, the default log will be set. The default log is the log used when creating
95 <struct fann> and <struct fann_data>. This default log will also be the default for all new structs
98 The default behavior is to log them to stderr.
103 This function appears in FANN >= 1.1.0.
105 FANN_EXTERNAL void FANN_API fann_set_error_log(struct fann_error *errdat, FILE * log_file);
108 /* Function: fann_get_errno
110 Returns the last error number.
113 <fann_errno_enum>, <fann_reset_errno>
115 This function appears in FANN >= 1.1.0.
117 FANN_EXTERNAL enum fann_errno_enum FANN_API fann_get_errno(struct fann_error *errdat);
120 /* Function: fann_reset_errno
122 Resets the last error number.
124 This function appears in FANN >= 1.1.0.
126 FANN_EXTERNAL void FANN_API fann_reset_errno(struct fann_error *errdat);
129 /* Function: fann_reset_errstr
131 Resets the last error string.
133 This function appears in FANN >= 1.1.0.
135 FANN_EXTERNAL void FANN_API fann_reset_errstr(struct fann_error *errdat);
138 /* Function: fann_get_errstr
140 Returns the last errstr.
142 This function calls <fann_reset_errno> and <fann_reset_errstr>
144 This function appears in FANN >= 1.1.0.
146 FANN_EXTERNAL char *FANN_API fann_get_errstr(struct fann_error *errdat);
149 /* Function: fann_print_error
151 Prints the last error to stderr.
153 This function appears in FANN >= 1.1.0.
155 FANN_EXTERNAL void FANN_API fann_print_error(struct fann_error *errdat);
157 extern FILE * fann_default_error_log;