ruby-fann 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +1 -0
- data/ext/ruby_fann/fann.h +603 -0
- data/lib/ruby_fann/version.rb +1 -1
- data/neurotica1.png +0 -0
- data/neurotica2.vrml +18 -18
- data/website/index.html +1 -1
- data/xor_cascade.net +2 -2
- data/xor_float.net +1 -1
- metadata +2 -1
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -0,0 +1,603 @@
|
|
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
|
+
/* This file defines the user interface to the fann library.
|
21
|
+
It is included from fixedfann.h, floatfann.h and doublefann.h and should
|
22
|
+
NOT be included directly. If included directly it will react as if
|
23
|
+
floatfann.h was included.
|
24
|
+
*/
|
25
|
+
|
26
|
+
/* Section: FANN Creation/Execution
|
27
|
+
|
28
|
+
The FANN library is designed to be very easy to use.
|
29
|
+
A feedforward ann can be created by a simple <fann_create_standard> function, while
|
30
|
+
other ANNs can be created just as easily. The ANNs can be trained by <fann_train_on_file>
|
31
|
+
and executed by <fann_run>.
|
32
|
+
|
33
|
+
All of this can be done without much knowledge of the internals of ANNs, although the ANNs created will
|
34
|
+
still be powerfull and effective. If you have more knowledge about ANNs, and desire more control, almost
|
35
|
+
every part of the ANNs can be parametized to create specialized and highly optimal ANNs.
|
36
|
+
*/
|
37
|
+
/* Group: Creation, Destruction & Execution */
|
38
|
+
|
39
|
+
#ifndef FANN_INCLUDE
|
40
|
+
/* just to allow for inclusion of fann.h in normal stuations where only floats are needed */
|
41
|
+
#ifdef FIXEDFANN
|
42
|
+
#include "fixedfann.h"
|
43
|
+
#else
|
44
|
+
#include "floatfann.h"
|
45
|
+
#endif /* FIXEDFANN */
|
46
|
+
|
47
|
+
#else
|
48
|
+
|
49
|
+
/* COMPAT_TIME REPLACEMENT */
|
50
|
+
#ifndef _WIN32
|
51
|
+
#include <sys/time.h>
|
52
|
+
#else /* _WIN32 */
|
53
|
+
#if !defined(_MSC_EXTENSIONS) && !defined(_INC_WINDOWS)
|
54
|
+
extern unsigned long __stdcall GetTickCount(void);
|
55
|
+
|
56
|
+
#else /* _MSC_EXTENSIONS */
|
57
|
+
#define WIN32_LEAN_AND_MEAN
|
58
|
+
#include <windows.h>
|
59
|
+
#endif /* _MSC_EXTENSIONS */
|
60
|
+
#endif /* _WIN32 */
|
61
|
+
|
62
|
+
#ifndef __fann_h__
|
63
|
+
#define __fann_h__
|
64
|
+
|
65
|
+
#ifdef __cplusplus
|
66
|
+
extern "C"
|
67
|
+
{
|
68
|
+
|
69
|
+
#ifndef __cplusplus
|
70
|
+
} /* to fool automatic indention engines */
|
71
|
+
#endif
|
72
|
+
#endif /* __cplusplus */
|
73
|
+
|
74
|
+
#ifndef NULL
|
75
|
+
#define NULL 0
|
76
|
+
#endif /* NULL */
|
77
|
+
|
78
|
+
/* ----- Macros used to define DLL external entrypoints ----- */
|
79
|
+
/*
|
80
|
+
DLL Export, import and calling convention for Windows.
|
81
|
+
Only defined for Microsoft VC++ FANN_EXTERNAL indicates
|
82
|
+
that a function will be exported/imported from a dll
|
83
|
+
FANN_API ensures that the DLL calling convention
|
84
|
+
will be used for a function regardless of the calling convention
|
85
|
+
used when compiling.
|
86
|
+
|
87
|
+
For a function to be exported from a DLL its prototype and
|
88
|
+
declaration must be like this:
|
89
|
+
FANN_EXTERNAL void FANN_API function(char *argument)
|
90
|
+
|
91
|
+
The following ifdef block is a way of creating macros which
|
92
|
+
make exporting from a DLL simple. All files within a DLL are
|
93
|
+
compiled with the FANN_DLL_EXPORTS symbol defined on the
|
94
|
+
command line. This symbol should not be defined on any project
|
95
|
+
that uses this DLL. This way any other project whose source
|
96
|
+
files include this file see FANN_EXTERNAL functions as being imported
|
97
|
+
from a DLL, whereas a DLL sees symbols defined with this
|
98
|
+
macro as being exported which makes calls more efficient.
|
99
|
+
The __stdcall calling convention is used for functions in a
|
100
|
+
windows DLL.
|
101
|
+
|
102
|
+
The callback functions for fann_set_callback must be declared as FANN_API
|
103
|
+
so the DLL and the application program both use the same
|
104
|
+
calling convention.
|
105
|
+
*/
|
106
|
+
|
107
|
+
/*
|
108
|
+
The following sets the default for MSVC++ 2003 or later to use
|
109
|
+
the fann dll's. To use a lib or fixedfann.c, floatfann.c or doublefann.c
|
110
|
+
with those compilers FANN_NO_DLL has to be defined before
|
111
|
+
including the fann headers.
|
112
|
+
The default for previous MSVC compilers such as VC++ 6 is not
|
113
|
+
to use dll's. To use dll's FANN_USE_DLL has to be defined before
|
114
|
+
including the fann headers.
|
115
|
+
*/
|
116
|
+
#if (_MSC_VER > 1300)
|
117
|
+
#ifndef FANN_NO_DLL
|
118
|
+
#define FANN_USE_DLL
|
119
|
+
#endif /* FANN_USE_LIB */
|
120
|
+
#endif /* _MSC_VER */
|
121
|
+
#if defined(_MSC_VER) && (defined(FANN_USE_DLL) || defined(FANN_DLL_EXPORTS))
|
122
|
+
#ifdef FANN_DLL_EXPORTS
|
123
|
+
#define FANN_EXTERNAL __declspec(dllexport)
|
124
|
+
#else /* */
|
125
|
+
#define FANN_EXTERNAL __declspec(dllimport)
|
126
|
+
#endif /* FANN_DLL_EXPORTS*/
|
127
|
+
#define FANN_API __stdcall
|
128
|
+
#else /* */
|
129
|
+
#define FANN_EXTERNAL
|
130
|
+
#define FANN_API
|
131
|
+
#endif /* _MSC_VER */
|
132
|
+
/* ----- End of macros used to define DLL external entrypoints ----- */
|
133
|
+
|
134
|
+
#include "fann_error.h"
|
135
|
+
#include "fann_activation.h"
|
136
|
+
#include "fann_data.h"
|
137
|
+
#include "fann_internal.h"
|
138
|
+
#include "fann_train.h"
|
139
|
+
#include "fann_cascade.h"
|
140
|
+
#include "fann_io.h"
|
141
|
+
|
142
|
+
/* Function: fann_create_standard
|
143
|
+
|
144
|
+
Creates a standard fully connected backpropagation neural network.
|
145
|
+
|
146
|
+
There will be a bias neuron in each layer (except the output layer),
|
147
|
+
and this bias neuron will be connected to all neurons in the next layer.
|
148
|
+
When running the network, the bias nodes always emits 1.
|
149
|
+
|
150
|
+
To destroy a <struct fann> use the <fann_destroy> function.
|
151
|
+
|
152
|
+
Parameters:
|
153
|
+
num_layers - The total number of layers including the input and the output layer.
|
154
|
+
... - Integer values determining the number of neurons in each layer starting with the
|
155
|
+
input layer and ending with the output layer.
|
156
|
+
|
157
|
+
Returns:
|
158
|
+
A pointer to the newly created <struct fann>.
|
159
|
+
|
160
|
+
Example:
|
161
|
+
> // Creating an ANN with 2 input neurons, 1 output neuron,
|
162
|
+
> // and two hidden neurons with 8 and 9 neurons
|
163
|
+
> struct fann *ann = fann_create_standard(4, 2, 8, 9, 1);
|
164
|
+
|
165
|
+
See also:
|
166
|
+
<fann_create_standard_array>, <fann_create_sparse>, <fann_create_shortcut>
|
167
|
+
|
168
|
+
This function appears in FANN >= 2.0.0.
|
169
|
+
*/
|
170
|
+
FANN_EXTERNAL struct fann *FANN_API fann_create_standard(unsigned int num_layers, ...);
|
171
|
+
|
172
|
+
/* Function: fann_create_standard_array
|
173
|
+
Just like <fann_create_standard>, but with an array of layer sizes
|
174
|
+
instead of individual parameters.
|
175
|
+
|
176
|
+
Example:
|
177
|
+
> // Creating an ANN with 2 input neurons, 1 output neuron,
|
178
|
+
> // and two hidden neurons with 8 and 9 neurons
|
179
|
+
> unsigned int layers[4] = {2, 8, 9, 1};
|
180
|
+
> struct fann *ann = fann_create_standard_array(4, layers);
|
181
|
+
|
182
|
+
See also:
|
183
|
+
<fann_create_standard>, <fann_create_sparse>, <fann_create_shortcut>
|
184
|
+
|
185
|
+
This function appears in FANN >= 2.0.0.
|
186
|
+
*/
|
187
|
+
FANN_EXTERNAL struct fann *FANN_API fann_create_standard_array(unsigned int num_layers,
|
188
|
+
const unsigned int *layers);
|
189
|
+
|
190
|
+
/* Function: fann_create_sparse
|
191
|
+
|
192
|
+
Creates a standard backpropagation neural network, which is not fully connected.
|
193
|
+
|
194
|
+
Parameters:
|
195
|
+
connection_rate - The connection rate controls how many connections there will be in the
|
196
|
+
network. If the connection rate is set to 1, the network will be fully
|
197
|
+
connected, but if it is set to 0.5 only half of the connections will be set.
|
198
|
+
A connection rate of 1 will yield the same result as <fann_create_standard>
|
199
|
+
num_layers - The total number of layers including the input and the output layer.
|
200
|
+
... - Integer values determining the number of neurons in each layer starting with the
|
201
|
+
input layer and ending with the output layer.
|
202
|
+
|
203
|
+
Returns:
|
204
|
+
A pointer to the newly created <struct fann>.
|
205
|
+
|
206
|
+
See also:
|
207
|
+
<fann_create_sparse_array>, <fann_create_standard>, <fann_create_shortcut>
|
208
|
+
|
209
|
+
This function appears in FANN >= 2.0.0.
|
210
|
+
*/
|
211
|
+
FANN_EXTERNAL struct fann *FANN_API fann_create_sparse(float connection_rate,
|
212
|
+
unsigned int num_layers, ...);
|
213
|
+
|
214
|
+
|
215
|
+
/* Function: fann_create_sparse_array
|
216
|
+
Just like <fann_create_sparse>, but with an array of layer sizes
|
217
|
+
instead of individual parameters.
|
218
|
+
|
219
|
+
See <fann_create_standard_array> for a description of the parameters.
|
220
|
+
|
221
|
+
See also:
|
222
|
+
<fann_create_sparse>, <fann_create_standard>, <fann_create_shortcut>
|
223
|
+
|
224
|
+
This function appears in FANN >= 2.0.0.
|
225
|
+
*/
|
226
|
+
FANN_EXTERNAL struct fann *FANN_API fann_create_sparse_array(float connection_rate,
|
227
|
+
unsigned int num_layers,
|
228
|
+
const unsigned int *layers);
|
229
|
+
|
230
|
+
/* Function: fann_create_shortcut
|
231
|
+
|
232
|
+
Creates a standard backpropagation neural network, which is not fully connected and which
|
233
|
+
also has shortcut connections.
|
234
|
+
|
235
|
+
Shortcut connections are connections that skip layers. A fully connected network with shortcut
|
236
|
+
connections, is a network where all neurons are connected to all neurons in later layers.
|
237
|
+
Including direct connections from the input layer to the output layer.
|
238
|
+
|
239
|
+
See <fann_create_standard> for a description of the parameters.
|
240
|
+
|
241
|
+
See also:
|
242
|
+
<fann_create_shortcut_array>, <fann_create_standard>, <fann_create_sparse>,
|
243
|
+
|
244
|
+
This function appears in FANN >= 2.0.0.
|
245
|
+
*/
|
246
|
+
FANN_EXTERNAL struct fann *FANN_API fann_create_shortcut(unsigned int num_layers, ...);
|
247
|
+
|
248
|
+
/* Function: fann_create_shortcut_array
|
249
|
+
Just like <fann_create_shortcut>, but with an array of layer sizes
|
250
|
+
instead of individual parameters.
|
251
|
+
|
252
|
+
See <fann_create_standard_array> for a description of the parameters.
|
253
|
+
|
254
|
+
See also:
|
255
|
+
<fann_create_shortcut>, <fann_create_standard>, <fann_create_sparse>
|
256
|
+
|
257
|
+
This function appears in FANN >= 2.0.0.
|
258
|
+
*/
|
259
|
+
FANN_EXTERNAL struct fann *FANN_API fann_create_shortcut_array(unsigned int num_layers,
|
260
|
+
const unsigned int *layers);
|
261
|
+
/* Function: fann_destroy
|
262
|
+
Destroys the entire network and properly freeing all the associated memmory.
|
263
|
+
|
264
|
+
This function appears in FANN >= 1.0.0.
|
265
|
+
*/
|
266
|
+
FANN_EXTERNAL void FANN_API fann_destroy(struct fann *ann);
|
267
|
+
|
268
|
+
|
269
|
+
/* Function: fann_run
|
270
|
+
Will run input through the neural network, returning an array of outputs, the number of which being
|
271
|
+
equal to the number of neurons in the output layer.
|
272
|
+
|
273
|
+
See also:
|
274
|
+
<fann_test>
|
275
|
+
|
276
|
+
This function appears in FANN >= 1.0.0.
|
277
|
+
*/
|
278
|
+
FANN_EXTERNAL fann_type * FANN_API fann_run(struct fann *ann, fann_type * input);
|
279
|
+
|
280
|
+
/* Function: fann_randomize_weights
|
281
|
+
Give each connection a random weight between *min_weight* and *max_weight*
|
282
|
+
|
283
|
+
From the beginning the weights are random between -0.1 and 0.1.
|
284
|
+
|
285
|
+
See also:
|
286
|
+
<fann_init_weights>
|
287
|
+
|
288
|
+
This function appears in FANN >= 1.0.0.
|
289
|
+
*/
|
290
|
+
FANN_EXTERNAL void FANN_API fann_randomize_weights(struct fann *ann, fann_type min_weight,
|
291
|
+
fann_type max_weight);
|
292
|
+
|
293
|
+
/* Function: fann_init_weights
|
294
|
+
Initialize the weights using Widrow + Nguyen's algorithm.
|
295
|
+
|
296
|
+
This function behaves similarly to fann_randomize_weights. It will use the algorithm developed
|
297
|
+
by Derrick Nguyen and Bernard Widrow to set the weights in such a way
|
298
|
+
as to speed up training. This technique is not always successful, and in some cases can be less
|
299
|
+
efficient than a purely random initialization.
|
300
|
+
|
301
|
+
The algorithm requires access to the range of the input data (ie, largest and smallest input),
|
302
|
+
and therefore accepts a second argument, data, which is the training data that will be used to
|
303
|
+
train the network.
|
304
|
+
|
305
|
+
See also:
|
306
|
+
<fann_randomize_weights>, <fann_read_train_from_file>
|
307
|
+
|
308
|
+
This function appears in FANN >= 1.1.0.
|
309
|
+
*/
|
310
|
+
FANN_EXTERNAL void FANN_API fann_init_weights(struct fann *ann, struct fann_train_data *train_data);
|
311
|
+
|
312
|
+
/* Function: fann_print_connections
|
313
|
+
Will print the connections of the ann in a compact matrix, for easy viewing of the internals
|
314
|
+
of the ann.
|
315
|
+
|
316
|
+
The output from fann_print_connections on a small (2 2 1) network trained on the xor problem
|
317
|
+
>Layer / Neuron 012345
|
318
|
+
>L 1 / N 3 BBa...
|
319
|
+
>L 1 / N 4 BBA...
|
320
|
+
>L 1 / N 5 ......
|
321
|
+
>L 2 / N 6 ...BBA
|
322
|
+
>L 2 / N 7 ......
|
323
|
+
|
324
|
+
This network have five real neurons and two bias neurons. This gives a total of seven neurons
|
325
|
+
named from 0 to 6. The connections between these neurons can be seen in the matrix. "." is a
|
326
|
+
place where there is no connection, while a character tells how strong the connection is on a
|
327
|
+
scale from a-z. The two real neurons in the hidden layer (neuron 3 and 4 in layer 1) has
|
328
|
+
connection from the three neurons in the previous layer as is visible in the first two lines.
|
329
|
+
The output neuron (6) has connections form the three neurons in the hidden layer 3 - 5 as is
|
330
|
+
visible in the fourth line.
|
331
|
+
|
332
|
+
To simplify the matrix output neurons is not visible as neurons that connections can come from,
|
333
|
+
and input and bias neurons are not visible as neurons that connections can go to.
|
334
|
+
|
335
|
+
This function appears in FANN >= 1.2.0.
|
336
|
+
*/
|
337
|
+
FANN_EXTERNAL void FANN_API fann_print_connections(struct fann *ann);
|
338
|
+
|
339
|
+
/* Group: Parameters */
|
340
|
+
/* Function: fann_print_parameters
|
341
|
+
|
342
|
+
Prints all of the parameters and options of the ANN
|
343
|
+
|
344
|
+
This function appears in FANN >= 1.2.0.
|
345
|
+
*/
|
346
|
+
FANN_EXTERNAL void FANN_API fann_print_parameters(struct fann *ann);
|
347
|
+
|
348
|
+
|
349
|
+
/* Function: fann_get_num_input
|
350
|
+
|
351
|
+
Get the number of input neurons.
|
352
|
+
|
353
|
+
This function appears in FANN >= 1.0.0.
|
354
|
+
*/
|
355
|
+
FANN_EXTERNAL unsigned int FANN_API fann_get_num_input(struct fann *ann);
|
356
|
+
|
357
|
+
|
358
|
+
/* Function: fann_get_num_output
|
359
|
+
|
360
|
+
Get the number of output neurons.
|
361
|
+
|
362
|
+
This function appears in FANN >= 1.0.0.
|
363
|
+
*/
|
364
|
+
FANN_EXTERNAL unsigned int FANN_API fann_get_num_output(struct fann *ann);
|
365
|
+
|
366
|
+
|
367
|
+
/* Function: fann_get_total_neurons
|
368
|
+
|
369
|
+
Get the total number of neurons in the entire network. This number does also include the
|
370
|
+
bias neurons, so a 2-4-2 network has 2+4+2 +2(bias) = 10 neurons.
|
371
|
+
|
372
|
+
This function appears in FANN >= 1.0.0.
|
373
|
+
*/
|
374
|
+
FANN_EXTERNAL unsigned int FANN_API fann_get_total_neurons(struct fann *ann);
|
375
|
+
|
376
|
+
|
377
|
+
/* Function: fann_get_total_connections
|
378
|
+
|
379
|
+
Get the total number of connections in the entire network.
|
380
|
+
|
381
|
+
This function appears in FANN >= 1.0.0.
|
382
|
+
*/
|
383
|
+
FANN_EXTERNAL unsigned int FANN_API fann_get_total_connections(struct fann *ann);
|
384
|
+
|
385
|
+
/* Function: fann_get_network_type
|
386
|
+
|
387
|
+
Get the type of neural network it was created as.
|
388
|
+
|
389
|
+
Parameters:
|
390
|
+
ann - A previously created neural network structure of
|
391
|
+
type <struct fann> pointer.
|
392
|
+
|
393
|
+
Returns:
|
394
|
+
The neural network type from enum <fann_network_type_enum>
|
395
|
+
|
396
|
+
See Also:
|
397
|
+
<fann_network_type_enum>
|
398
|
+
|
399
|
+
This function appears in FANN >= 2.1.0
|
400
|
+
*/
|
401
|
+
FANN_EXTERNAL enum fann_nettype_enum FANN_API fann_get_network_type(struct fann *ann);
|
402
|
+
|
403
|
+
/* Function: fann_get_connection_rate
|
404
|
+
|
405
|
+
Get the connection rate used when the network was created
|
406
|
+
|
407
|
+
Parameters:
|
408
|
+
ann - A previously created neural network structure of
|
409
|
+
type <struct fann> pointer.
|
410
|
+
|
411
|
+
Returns:
|
412
|
+
The connection rate
|
413
|
+
|
414
|
+
This function appears in FANN >= 2.1.0
|
415
|
+
*/
|
416
|
+
FANN_EXTERNAL float FANN_API fann_get_connection_rate(struct fann *ann);
|
417
|
+
|
418
|
+
/* Function: fann_get_num_layers
|
419
|
+
|
420
|
+
Get the number of layers in the network
|
421
|
+
|
422
|
+
Parameters:
|
423
|
+
ann - A previously created neural network structure of
|
424
|
+
type <struct fann> pointer.
|
425
|
+
|
426
|
+
Returns:
|
427
|
+
The number of layers in the neural network
|
428
|
+
|
429
|
+
Example:
|
430
|
+
> // Obtain the number of layers in a neural network
|
431
|
+
> struct fann *ann = fann_create_standard(4, 2, 8, 9, 1);
|
432
|
+
> unsigned int num_layers = fann_get_num_layers(ann);
|
433
|
+
|
434
|
+
This function appears in FANN >= 2.1.0
|
435
|
+
*/
|
436
|
+
FANN_EXTERNAL unsigned int FANN_API fann_get_num_layers(struct fann *ann);
|
437
|
+
|
438
|
+
/*Function: fann_get_layer_array
|
439
|
+
|
440
|
+
Get the number of neurons in each layer in the network.
|
441
|
+
|
442
|
+
Bias is not included so the layers match the fann_create functions.
|
443
|
+
|
444
|
+
Parameters:
|
445
|
+
ann - A previously created neural network structure of
|
446
|
+
type <struct fann> pointer.
|
447
|
+
|
448
|
+
The layers array must be preallocated to at least
|
449
|
+
sizeof(unsigned int) * fann_num_layers() long.
|
450
|
+
|
451
|
+
This function appears in FANN >= 2.1.0
|
452
|
+
*/
|
453
|
+
FANN_EXTERNAL void FANN_API fann_get_layer_array(struct fann *ann, unsigned int *layers);
|
454
|
+
|
455
|
+
/* Function: fann_get_bias_array
|
456
|
+
|
457
|
+
Get the number of bias in each layer in the network.
|
458
|
+
|
459
|
+
Parameters:
|
460
|
+
ann - A previously created neural network structure of
|
461
|
+
type <struct fann> pointer.
|
462
|
+
|
463
|
+
The bias array must be preallocated to at least
|
464
|
+
sizeof(unsigned int) * fann_num_layers() long.
|
465
|
+
|
466
|
+
This function appears in FANN >= 2.1.0
|
467
|
+
*/
|
468
|
+
FANN_EXTERNAL void FANN_API fann_get_bias_array(struct fann *ann, unsigned int *bias);
|
469
|
+
|
470
|
+
/* Function: fann_get_connection_array
|
471
|
+
|
472
|
+
Get the connections in the network.
|
473
|
+
|
474
|
+
Parameters:
|
475
|
+
ann - A previously created neural network structure of
|
476
|
+
type <struct fann> pointer.
|
477
|
+
|
478
|
+
The connections array must be preallocated to at least
|
479
|
+
sizeof(struct fann_connection) * fann_get_total_connections() long.
|
480
|
+
|
481
|
+
This function appears in FANN >= 2.1.0
|
482
|
+
*/
|
483
|
+
FANN_EXTERNAL void FANN_API fann_get_connection_array(struct fann *ann,
|
484
|
+
struct fann_connection *connections);
|
485
|
+
|
486
|
+
/* Function: fann_set_weight_array
|
487
|
+
|
488
|
+
Set connections in the network.
|
489
|
+
|
490
|
+
Parameters:
|
491
|
+
ann - A previously created neural network structure of
|
492
|
+
type <struct fann> pointer.
|
493
|
+
|
494
|
+
Only the weights can be changed, connections and weights are ignored
|
495
|
+
if they do not already exist in the network.
|
496
|
+
|
497
|
+
The array must have sizeof(struct fann_connection) * num_connections size.
|
498
|
+
|
499
|
+
This function appears in FANN >= 2.1.0
|
500
|
+
*/
|
501
|
+
FANN_EXTERNAL void FANN_API fann_set_weight_array(struct fann *ann,
|
502
|
+
struct fann_connection *connections, unsigned int num_connections);
|
503
|
+
|
504
|
+
/* Function: fann_set_weight
|
505
|
+
|
506
|
+
Set a connection in the network.
|
507
|
+
|
508
|
+
Parameters:
|
509
|
+
ann - A previously created neural network structure of
|
510
|
+
type <struct fann> pointer.
|
511
|
+
|
512
|
+
Only the weights can be changed. The connection/weight is
|
513
|
+
ignored if it does not already exist in the network.
|
514
|
+
|
515
|
+
This function appears in FANN >= 2.1.0
|
516
|
+
*/
|
517
|
+
FANN_EXTERNAL void FANN_API fann_set_weight(struct fann *ann,
|
518
|
+
unsigned int from_neuron, unsigned int to_neuron, fann_type weight);
|
519
|
+
|
520
|
+
/* Function: fann_set_user_data
|
521
|
+
|
522
|
+
Store a pointer to user defined data. The pointer can be
|
523
|
+
retrieved with <fann_get_user_data> for example in a
|
524
|
+
callback. It is the user's responsibility to allocate and
|
525
|
+
deallocate any data that the pointer might point to.
|
526
|
+
|
527
|
+
Parameters:
|
528
|
+
ann - A previously created neural network structure of
|
529
|
+
type <struct fann> pointer.
|
530
|
+
user_data - A void pointer to user defined data.
|
531
|
+
|
532
|
+
This function appears in FANN >= 2.1.0
|
533
|
+
*/
|
534
|
+
FANN_EXTERNAL void FANN_API fann_set_user_data(struct fann *ann, void *user_data);
|
535
|
+
|
536
|
+
/* Function: fann_get_user_data
|
537
|
+
|
538
|
+
Get a pointer to user defined data that was previously set
|
539
|
+
with <fann_set_user_data>. It is the user's responsibility to
|
540
|
+
allocate and deallocate any data that the pointer might point to.
|
541
|
+
|
542
|
+
Parameters:
|
543
|
+
ann - A previously created neural network structure of
|
544
|
+
type <struct fann> pointer.
|
545
|
+
|
546
|
+
Returns:
|
547
|
+
A void pointer to user defined data.
|
548
|
+
|
549
|
+
This function appears in FANN >= 2.1.0
|
550
|
+
*/
|
551
|
+
FANN_EXTERNAL void * FANN_API fann_get_user_data(struct fann *ann);
|
552
|
+
|
553
|
+
#ifdef FIXEDFANN
|
554
|
+
|
555
|
+
/* Function: fann_get_decimal_point
|
556
|
+
|
557
|
+
Returns the position of the decimal point in the ann.
|
558
|
+
|
559
|
+
This function is only available when the ANN is in fixed point mode.
|
560
|
+
|
561
|
+
The decimal point is described in greater detail in the tutorial <Fixed Point Usage>.
|
562
|
+
|
563
|
+
See also:
|
564
|
+
<Fixed Point Usage>, <fann_get_multiplier>, <fann_save_to_fixed>, <fann_save_train_to_fixed>
|
565
|
+
|
566
|
+
This function appears in FANN >= 1.0.0.
|
567
|
+
*/
|
568
|
+
FANN_EXTERNAL unsigned int FANN_API fann_get_decimal_point(struct fann *ann);
|
569
|
+
|
570
|
+
|
571
|
+
/* Function: fann_get_multiplier
|
572
|
+
|
573
|
+
returns the multiplier that fix point data is multiplied with.
|
574
|
+
|
575
|
+
This function is only available when the ANN is in fixed point mode.
|
576
|
+
|
577
|
+
The multiplier is the used to convert between floating point and fixed point notation.
|
578
|
+
A floating point number is multiplied with the multiplier in order to get the fixed point
|
579
|
+
number and visa versa.
|
580
|
+
|
581
|
+
The multiplier is described in greater detail in the tutorial <Fixed Point Usage>.
|
582
|
+
|
583
|
+
See also:
|
584
|
+
<Fixed Point Usage>, <fann_get_decimal_point>, <fann_save_to_fixed>, <fann_save_train_to_fixed>
|
585
|
+
|
586
|
+
This function appears in FANN >= 1.0.0.
|
587
|
+
*/
|
588
|
+
FANN_EXTERNAL unsigned int FANN_API fann_get_multiplier(struct fann *ann);
|
589
|
+
|
590
|
+
#endif /* FIXEDFANN */
|
591
|
+
|
592
|
+
#ifdef __cplusplus
|
593
|
+
#ifndef __cplusplus
|
594
|
+
/* to fool automatic indention engines */
|
595
|
+
{
|
596
|
+
|
597
|
+
#endif
|
598
|
+
}
|
599
|
+
#endif /* __cplusplus */
|
600
|
+
|
601
|
+
#endif /* __fann_h__ */
|
602
|
+
|
603
|
+
#endif /* NOT FANN_INCLUDE */
|
data/lib/ruby_fann/version.rb
CHANGED
data/neurotica1.png
CHANGED
Binary file
|
data/neurotica2.vrml
CHANGED
@@ -4,9 +4,9 @@ Group { children [
|
|
4
4
|
scale 0.028 0.028 0.028
|
5
5
|
children [
|
6
6
|
Background { skyColor 1.000 1.000 1.000 }
|
7
|
-
# node
|
7
|
+
# node 2148098720
|
8
8
|
Transform {
|
9
|
-
translation 6.000 46.000
|
9
|
+
translation 6.000 46.000 83.000
|
10
10
|
scale 2.000 2.000 2.000
|
11
11
|
children [
|
12
12
|
Transform {
|
@@ -24,9 +24,9 @@ Transform {
|
|
24
24
|
}
|
25
25
|
]
|
26
26
|
}
|
27
|
-
# node
|
27
|
+
# node 2148093340
|
28
28
|
Transform {
|
29
|
-
translation 50.000 6.000
|
29
|
+
translation 50.000 6.000 93.000
|
30
30
|
scale 2.000 2.000 2.000
|
31
31
|
children [
|
32
32
|
Transform {
|
@@ -44,7 +44,7 @@ Transform {
|
|
44
44
|
}
|
45
45
|
]
|
46
46
|
}
|
47
|
-
# edge
|
47
|
+
# edge 2148098720 -> 2148093340
|
48
48
|
Group { children [
|
49
49
|
Transform {
|
50
50
|
children [
|
@@ -79,9 +79,9 @@ Transform {
|
|
79
79
|
translation 24.000 17.000 0.000
|
80
80
|
}
|
81
81
|
] }
|
82
|
-
# node
|
82
|
+
# node 2148098020
|
83
83
|
Transform {
|
84
|
-
translation 28.000 46.000
|
84
|
+
translation 28.000 46.000 31.000
|
85
85
|
scale 2.000 2.000 2.000
|
86
86
|
children [
|
87
87
|
Transform {
|
@@ -99,7 +99,7 @@ Transform {
|
|
99
99
|
}
|
100
100
|
]
|
101
101
|
}
|
102
|
-
# edge
|
102
|
+
# edge 2148098020 -> 2148093340
|
103
103
|
Group { children [
|
104
104
|
Transform {
|
105
105
|
children [
|
@@ -134,9 +134,9 @@ Transform {
|
|
134
134
|
translation 35.000 17.000 0.000
|
135
135
|
}
|
136
136
|
] }
|
137
|
-
# node
|
137
|
+
# node 2148097880
|
138
138
|
Transform {
|
139
|
-
translation 50.000 46.000
|
139
|
+
translation 50.000 46.000 20.000
|
140
140
|
scale 2.000 2.000 2.000
|
141
141
|
children [
|
142
142
|
Transform {
|
@@ -154,7 +154,7 @@ Transform {
|
|
154
154
|
}
|
155
155
|
]
|
156
156
|
}
|
157
|
-
# edge
|
157
|
+
# edge 2148097880 -> 2148093340
|
158
158
|
Group { children [
|
159
159
|
Transform {
|
160
160
|
children [
|
@@ -189,9 +189,9 @@ Transform {
|
|
189
189
|
translation 46.000 17.000 0.000
|
190
190
|
}
|
191
191
|
] }
|
192
|
-
# node
|
192
|
+
# node 2148096860
|
193
193
|
Transform {
|
194
|
-
translation 72.000 46.000
|
194
|
+
translation 72.000 46.000 38.000
|
195
195
|
scale 2.000 2.000 2.000
|
196
196
|
children [
|
197
197
|
Transform {
|
@@ -209,7 +209,7 @@ Transform {
|
|
209
209
|
}
|
210
210
|
]
|
211
211
|
}
|
212
|
-
# edge
|
212
|
+
# edge 2148096860 -> 2148093340
|
213
213
|
Group { children [
|
214
214
|
Transform {
|
215
215
|
children [
|
@@ -244,9 +244,9 @@ Transform {
|
|
244
244
|
translation 57.000 17.000 0.000
|
245
245
|
}
|
246
246
|
] }
|
247
|
-
# node
|
247
|
+
# node 2148095220
|
248
248
|
Transform {
|
249
|
-
translation 94.000 46.000
|
249
|
+
translation 94.000 46.000 41.000
|
250
250
|
scale 2.000 2.000 2.000
|
251
251
|
children [
|
252
252
|
Transform {
|
@@ -264,7 +264,7 @@ Transform {
|
|
264
264
|
}
|
265
265
|
]
|
266
266
|
}
|
267
|
-
# edge
|
267
|
+
# edge 2148095220 -> 2148093340
|
268
268
|
Group { children [
|
269
269
|
Transform {
|
270
270
|
children [
|
@@ -300,5 +300,5 @@ Transform {
|
|
300
300
|
}
|
301
301
|
] }
|
302
302
|
] }
|
303
|
-
Viewpoint {position 1.852 0.963
|
303
|
+
Viewpoint {position 1.852 0.963 6.702}
|
304
304
|
] }
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>ruby-fann</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ruby-fann"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/ruby-fann" class="numbers">1.0.
|
36
|
+
<a href="http://rubyforge.org/projects/ruby-fann" class="numbers">1.0.2</a>
|
37
37
|
</div>
|
38
38
|
<p><em>Bindings to use <a href="http://leenissen.dk/fann/"><span class="caps">FANN</span></a> (Fast Artificial Neural Network) from within ruby/rails environment.</em></p>
|
39
39
|
<h2>Documentation</h2>
|
data/xor_cascade.net
CHANGED
@@ -30,5 +30,5 @@ cascade_activation_steepnesses_count=4
|
|
30
30
|
cascade_activation_steepnesses=2.50000000000000000000e-01 5.00000000000000000000e-01 7.50000000000000000000e-01 1.00000000000000000000e+00
|
31
31
|
layer_sizes=3 1 1 1
|
32
32
|
scale_included=0
|
33
|
-
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (3,
|
34
|
-
connections (connected_to_neuron, weight)=(0,
|
33
|
+
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (3, 8, 5.00000000000000000000e-01) (4, 3, 7.50000000000000000000e-01) (5, 5, 5.00000000000000000000e-01)
|
34
|
+
connections (connected_to_neuron, weight)=(0, 1.93441716139228003790e+00) (1, 1.70890924020654355608e+00) (2, 1.23564954660518554197e-02) (0, -8.14182709333025056431e-02) (1, -7.15250401659676127153e-02) (2, -2.38748796481204799136e+01) (3, -4.16798582203117828904e-01) (0, 4.46139384612332989821e-01) (1, 3.91859924128322711923e-01) (2, -9.99655042040694441496e-01) (3, 4.06572980026871846349e+01) (4, -5.10086273232595699412e-01)
|
data/xor_float.net
CHANGED
@@ -31,4 +31,4 @@ cascade_activation_steepnesses=2.50000000000000000000e-01 5.00000000000000000000
|
|
31
31
|
layer_sizes=3 4 2
|
32
32
|
scale_included=0
|
33
33
|
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (3, 5, 1.00000000000000000000e+00) (3, 5, 1.00000000000000000000e+00) (3, 5, 1.00000000000000000000e+00) (0, 5, 1.00000000000000000000e+00) (4, 5, 1.00000000000000000000e+00) (0, 5, 1.00000000000000000000e+00)
|
34
|
-
connections (connected_to_neuron, weight)=(0,
|
34
|
+
connections (connected_to_neuron, weight)=(0, 2.23371764591571020375e+00) (1, 1.58521562208138422356e+00) (2, 1.43955559831288093520e+00) (0, 1.63051204219772549742e+00) (1, -1.49354703398461952091e+00) (2, 2.37087930182826900349e+00) (0, 1.61957436211062755227e+00) (1, 2.28195297973940336433e+00) (2, -1.40962767164018121235e+00) (3, 4.58246629418312600990e+00) (4, -2.31578449129627728098e+00) (5, -4.54905458104575011191e+00) (6, -1.79180653141054779809e+00)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-fann
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Miers
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- ext/ruby_fann/fann_train.h
|
56
56
|
- ext/ruby_fann/fann_cascade.h
|
57
57
|
- ext/ruby_fann/fann_io.h
|
58
|
+
- ext/ruby_fann/fann.h
|
58
59
|
- ext/ruby_fann/fann.c
|
59
60
|
- ext/ruby_fann/doublefann.c
|
60
61
|
- ext/ruby_fann/fann_io.c
|