]> ruin.nu Git - germs.git/blob - fann/src/include/fann_io.h
Make it possible to build statically against the included fann library.
[germs.git] / fann / src / include / fann_io.h
1 /*
2 Fast Artificial Neural Network Library (fann)
3 Copyright (C) 2003 Steffen Nissen (lukesky@diku.dk)
4
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.
9
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.
14
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
18 */
19
20 #ifndef __fann_io_h__
21 #define __fann_io_h__
22         
23 /* Section: FANN File Input/Output 
24    
25    It is possible to save an entire ann to a file with <fann_save> for future loading with <fann_create_from_file>.
26  */     
27
28 /* Group: File Input and Output */      
29
30 /* Function: fann_create_from_file
31    
32    Constructs a backpropagation neural network from a configuration file, which have been saved by <fann_save>.
33    
34    See also:
35         <fann_save>, <fann_save_to_fixed>
36         
37    This function appears in FANN >= 1.0.0.
38  */
39 FANN_EXTERNAL struct fann *FANN_API fann_create_from_file(const char *configuration_file);
40
41
42 /* Function: fann_save
43
44    Save the entire network to a configuration file.
45    
46    The configuration file contains all information about the neural network and enables 
47    <fann_create_from_file> to create an exact copy of the neural network and all of the
48    parameters associated with the neural network.
49    
50    These two parameters (<fann_set_callback>, <fann_set_error_log>) are *NOT* saved 
51    to the file because they cannot safely be ported to a different location. Also temporary
52    parameters generated during training like <fann_get_MSE> is not saved.
53    
54    Return:
55    The function returns 0 on success and -1 on failure.
56    
57    See also:
58     <fann_create_from_file>, <fann_save_to_fixed>
59
60    This function appears in FANN >= 1.0.0.
61  */
62 FANN_EXTERNAL int FANN_API fann_save(struct fann *ann, const char *configuration_file);
63
64
65 /* Function: fann_save_to_fixed
66
67    Saves the entire network to a configuration file.
68    But it is saved in fixed point format no matter which
69    format it is currently in.
70
71    This is usefull for training a network in floating points,
72    and then later executing it in fixed point.
73
74    The function returns the bit position of the fix point, which
75    can be used to find out how accurate the fixed point network will be.
76    A high value indicates high precision, and a low value indicates low
77    precision.
78
79    A negative value indicates very low precision, and a very
80    strong possibility for overflow.
81    (the actual fix point will be set to 0, since a negative
82    fix point does not make sence).
83
84    Generally, a fix point lower than 6 is bad, and should be avoided.
85    The best way to avoid this, is to have less connections to each neuron,
86    or just less neurons in each layer.
87
88    The fixed point use of this network is only intended for use on machines that
89    have no floating point processor, like an iPAQ. On normal computers the floating
90    point version is actually faster.
91
92    See also:
93     <fann_create_from_file>, <fann_save>
94
95    This function appears in FANN >= 1.0.0.
96 */ 
97 FANN_EXTERNAL int FANN_API fann_save_to_fixed(struct fann *ann, const char *configuration_file);
98         
99 #endif