/usr/include/fann_cascade.h is in libfann-dev 2.1.0~beta~dfsg-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | /*
Fast Artificial Neural Network Library (fann)
Copyright (C) 2003 Steffen Nissen (lukesky@diku.dk)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __fann_cascade_h__
#define __fann_cascade_h__
/* Section: FANN Cascade Training
Cascade training differs from ordinary training in the sense that it starts with an empty neural network
and then adds neurons one by one, while it trains the neural network. The main benefit of this approach,
is that you do not have to guess the number of hidden layers and neurons prior to training, but cascade
training have also proved better at solving some problems.
The basic idea of cascade training is that a number of candidate neurons are trained separate from the
real network, then the most promissing of these candidate neurons is inserted into the neural network.
Then the output connections are trained and new candidate neurons is prepared. The candidate neurons are
created as shorcut connected neurons in a new hidden layer, which means that the final neural network
will consist of a number of hidden layers with one shorcut connected neuron in each.
*/
/* Group: Cascade Training */
/* Function: fann_cascadetrain_on_data
Trains on an entire dataset, for a period of time using the Cascade2 training algorithm.
This algorithm adds neurons to the neural network while training, which means that it
needs to start with an ANN without any hidden layers. The neural network should also use
shortcut connections, so <fann_create_shortcut> should be used to create the ANN like this:
>struct fann *ann = fann_create_shortcut(2, fann_num_input_train_data(train_data), fann_num_output_train_data(train_data));
This training uses the parameters set using the fann_set_cascade_..., but it also uses another
training algorithm as it's internal training algorithm. This algorithm can be set to either
FANN_TRAIN_RPROP or FANN_TRAIN_QUICKPROP by <fann_set_training_algorithm>, and the parameters
set for these training algorithms will also affect the cascade training.
Parameters:
ann - The neural network
data - The data, which should be used during training
max_neuron - The maximum number of neurons to be added to neural network
neurons_between_reports - The number of neurons between printing a status report to stdout.
A value of zero means no reports should be printed.
desired_error - The desired <fann_get_MSE> or <fann_get_bit_fail>, depending on which stop function
is chosen by <fann_set_train_stop_function>.
Instead of printing out reports every neurons_between_reports, a callback function can be called
(see <fann_set_callback>).
See also:
<fann_train_on_data>, <fann_cascadetrain_on_file>, <Parameters>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_cascadetrain_on_data(struct fann *ann,
struct fann_train_data *data,
unsigned int max_neurons,
unsigned int neurons_between_reports,
float desired_error);
/* Function: fann_cascadetrain_on_file
Does the same as <fann_cascadetrain_on_data>, but reads the training data directly from a file.
See also:
<fann_cascadetrain_on_data>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_cascadetrain_on_file(struct fann *ann, const char *filename,
unsigned int max_neurons,
unsigned int neurons_between_reports,
float desired_error);
/* Group: Parameters */
/* Function: fann_get_cascade_output_change_fraction
The cascade output change fraction is a number between 0 and 1 determining how large a fraction
the <fann_get_MSE> value should change within <fann_get_cascade_output_stagnation_epochs> during
training of the output connections, in order for the training not to stagnate. If the training
stagnates, the training of the output connections will be ended and new candidates will be prepared.
This means:
If the MSE does not change by a fraction of <fann_get_cascade_output_change_fraction> during a
period of <fann_get_cascade_output_stagnation_epochs>, the training of the output connections
is stopped because the training has stagnated.
If the cascade output change fraction is low, the output connections will be trained more and if the
fraction is high they will be trained less.
The default cascade output change fraction is 0.01, which is equalent to a 1% change in MSE.
See also:
<fann_set_cascade_output_change_fraction>, <fann_get_MSE>, <fann_get_cascade_output_stagnation_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL float FANN_API fann_get_cascade_output_change_fraction(struct fann *ann);
/* Function: fann_set_cascade_output_change_fraction
Sets the cascade output change fraction.
See also:
<fann_get_cascade_output_change_fraction>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_output_change_fraction(struct fann *ann,
float cascade_output_change_fraction);
/* Function: fann_get_cascade_output_stagnation_epochs
The number of cascade output stagnation epochs determines the number of epochs training is allowed to
continue without changing the MSE by a fraction of <fann_get_cascade_output_change_fraction>.
See more info about this parameter in <fann_get_cascade_output_change_fraction>.
The default number of cascade output stagnation epochs is 12.
See also:
<fann_set_cascade_output_stagnation_epochs>, <fann_get_cascade_output_change_fraction>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_output_stagnation_epochs(struct fann *ann);
/* Function: fann_set_cascade_output_stagnation_epochs
Sets the number of cascade output stagnation epochs.
See also:
<fann_get_cascade_output_stagnation_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_output_stagnation_epochs(struct fann *ann,
unsigned int cascade_output_stagnation_epochs);
/* Function: fann_get_cascade_candidate_change_fraction
The cascade candidate change fraction is a number between 0 and 1 determining how large a fraction
the <fann_get_MSE> value should change within <fann_get_cascade_candidate_stagnation_epochs> during
training of the candidate neurons, in order for the training not to stagnate. If the training
stagnates, the training of the candidate neurons will be ended and the best candidate will be selected.
This means:
If the MSE does not change by a fraction of <fann_get_cascade_candidate_change_fraction> during a
period of <fann_get_cascade_candidate_stagnation_epochs>, the training of the candidate neurons
is stopped because the training has stagnated.
If the cascade candidate change fraction is low, the candidate neurons will be trained more and if the
fraction is high they will be trained less.
The default cascade candidate change fraction is 0.01, which is equalent to a 1% change in MSE.
See also:
<fann_set_cascade_candidate_change_fraction>, <fann_get_MSE>, <fann_get_cascade_candidate_stagnation_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL float FANN_API fann_get_cascade_candidate_change_fraction(struct fann *ann);
/* Function: fann_set_cascade_candidate_change_fraction
Sets the cascade candidate change fraction.
See also:
<fann_get_cascade_candidate_change_fraction>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_candidate_change_fraction(struct fann *ann,
float cascade_candidate_change_fraction);
/* Function: fann_get_cascade_candidate_stagnation_epochs
The number of cascade candidate stagnation epochs determines the number of epochs training is allowed to
continue without changing the MSE by a fraction of <fann_get_cascade_candidate_change_fraction>.
See more info about this parameter in <fann_get_cascade_candidate_change_fraction>.
The default number of cascade candidate stagnation epochs is 12.
See also:
<fann_set_cascade_candidate_stagnation_epochs>, <fann_get_cascade_candidate_change_fraction>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_candidate_stagnation_epochs(struct fann *ann);
/* Function: fann_set_cascade_candidate_stagnation_epochs
Sets the number of cascade candidate stagnation epochs.
See also:
<fann_get_cascade_candidate_stagnation_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_candidate_stagnation_epochs(struct fann *ann,
unsigned int cascade_candidate_stagnation_epochs);
/* Function: fann_get_cascade_weight_multiplier
The weight multiplier is a parameter which is used to multiply the weights from the candidate neuron
before adding the neuron to the neural network. This parameter is usually between 0 and 1, and is used
to make the training a bit less aggressive.
The default weight multiplier is 0.4
See also:
<fann_set_cascade_weight_multiplier>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL fann_type FANN_API fann_get_cascade_weight_multiplier(struct fann *ann);
/* Function: fann_set_cascade_weight_multiplier
Sets the weight multiplier.
See also:
<fann_get_cascade_weight_multiplier>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_weight_multiplier(struct fann *ann,
fann_type cascade_weight_multiplier);
/* Function: fann_get_cascade_candidate_limit
The candidate limit is a limit for how much the candidate neuron may be trained.
The limit is a limit on the proportion between the MSE and candidate score.
Set this to a lower value to avoid overfitting and to a higher if overfitting is
not a problem.
The default candidate limit is 1000.0
See also:
<fann_set_cascade_candidate_limit>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL fann_type FANN_API fann_get_cascade_candidate_limit(struct fann *ann);
/* Function: fann_set_cascade_candidate_limit
Sets the candidate limit.
See also:
<fann_get_cascade_candidate_limit>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_candidate_limit(struct fann *ann,
fann_type cascade_candidate_limit);
/* Function: fann_get_cascade_max_out_epochs
The maximum out epochs determines the maximum number of epochs the output connections
may be trained after adding a new candidate neuron.
The default max out epochs is 150
See also:
<fann_set_cascade_max_out_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_max_out_epochs(struct fann *ann);
/* Function: fann_set_cascade_max_out_epochs
Sets the maximum out epochs.
See also:
<fann_get_cascade_max_out_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_max_out_epochs(struct fann *ann,
unsigned int cascade_max_out_epochs);
/* Function: fann_get_cascade_max_cand_epochs
The maximum candidate epochs determines the maximum number of epochs the input
connections to the candidates may be trained before adding a new candidate neuron.
The default max candidate epochs is 150
See also:
<fann_set_cascade_max_cand_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_max_cand_epochs(struct fann *ann);
/* Function: fann_set_cascade_max_cand_epochs
Sets the max candidate epochs.
See also:
<fann_get_cascade_max_cand_epochs>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_max_cand_epochs(struct fann *ann,
unsigned int cascade_max_cand_epochs);
/* Function: fann_get_cascade_num_candidates
The number of candidates used during training (calculated by multiplying <fann_get_cascade_activation_functions_count>,
<fann_get_cascade_activation_steepnesses_count> and <fann_get_cascade_num_candidate_groups>).
The actual candidates is defined by the <fann_get_cascade_activation_functions> and
<fann_get_cascade_activation_steepnesses> arrays. These arrays define the activation functions
and activation steepnesses used for the candidate neurons. If there are 2 activation functions
in the activation function array and 3 steepnesses in the steepness array, then there will be
2x3=6 different candidates which will be trained. These 6 different candidates can be copied into
several candidate groups, where the only difference between these groups is the initial weights.
If the number of groups is set to 2, then the number of candidate neurons will be 2x3x2=12. The
number of candidate groups is defined by <fann_set_cascade_num_candidate_groups>.
The default number of candidates is 6x4x2 = 48
See also:
<fann_get_cascade_activation_functions>, <fann_get_cascade_activation_functions_count>,
<fann_get_cascade_activation_steepnesses>, <fann_get_cascade_activation_steepnesses_count>,
<fann_get_cascade_num_candidate_groups>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_num_candidates(struct fann *ann);
/* Function: fann_get_cascade_activation_functions_count
The number of activation functions in the <fann_get_cascade_activation_functions> array.
The default number of activation functions is 6.
See also:
<fann_get_cascade_activation_functions>, <fann_set_cascade_activation_functions>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_activation_functions_count(struct fann *ann);
/* Function: fann_get_cascade_activation_functions
The cascade activation functions array is an array of the different activation functions used by
the candidates.
See <fann_get_cascade_num_candidates> for a description of which candidate neurons will be
generated by this array.
The default activation functions is {FANN_SIGMOID, FANN_SIGMOID_SYMMETRIC, FANN_GAUSSIAN, FANN_GAUSSIAN_SYMMETRIC, FANN_ELLIOT, FANN_ELLIOT_SYMMETRIC}
See also:
<fann_get_cascade_activation_functions_count>, <fann_set_cascade_activation_functions>,
<fann_activationfunc_enum>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL enum fann_activationfunc_enum * FANN_API fann_get_cascade_activation_functions(
struct fann *ann);
/* Function: fann_set_cascade_activation_functions
Sets the array of cascade candidate activation functions. The array must be just as long
as defined by the count.
See <fann_get_cascade_num_candidates> for a description of which candidate neurons will be
generated by this array.
See also:
<fann_get_cascade_activation_steepnesses_count>, <fann_get_cascade_activation_steepnesses>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_activation_functions(struct fann *ann,
enum fann_activationfunc_enum *
cascade_activation_functions,
unsigned int
cascade_activation_functions_count);
/* Function: fann_get_cascade_activation_steepnesses_count
The number of activation steepnesses in the <fann_get_cascade_activation_functions> array.
The default number of activation steepnesses is 4.
See also:
<fann_get_cascade_activation_steepnesses>, <fann_set_cascade_activation_functions>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_activation_steepnesses_count(struct fann *ann);
/* Function: fann_get_cascade_activation_steepnesses
The cascade activation steepnesses array is an array of the different activation functions used by
the candidates.
See <fann_get_cascade_num_candidates> for a description of which candidate neurons will be
generated by this array.
The default activation steepnesses is {0.25, 0.50, 0.75, 1.00}
See also:
<fann_set_cascade_activation_steepnesses>, <fann_get_cascade_activation_steepnesses_count>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL fann_type * FANN_API fann_get_cascade_activation_steepnesses(struct fann *ann);
/* Function: fann_set_cascade_activation_steepnesses
Sets the array of cascade candidate activation steepnesses. The array must be just as long
as defined by the count.
See <fann_get_cascade_num_candidates> for a description of which candidate neurons will be
generated by this array.
See also:
<fann_get_cascade_activation_steepnesses>, <fann_get_cascade_activation_steepnesses_count>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_activation_steepnesses(struct fann *ann,
fann_type *
cascade_activation_steepnesses,
unsigned int
cascade_activation_steepnesses_count);
/* Function: fann_get_cascade_num_candidate_groups
The number of candidate groups is the number of groups of identical candidates which will be used
during training.
This number can be used to have more candidates without having to define new parameters for the candidates.
See <fann_get_cascade_num_candidates> for a description of which candidate neurons will be
generated by this parameter.
The default number of candidate groups is 2
See also:
<fann_set_cascade_num_candidate_groups>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL unsigned int FANN_API fann_get_cascade_num_candidate_groups(struct fann *ann);
/* Function: fann_set_cascade_num_candidate_groups
Sets the number of candidate groups.
See also:
<fann_get_cascade_num_candidate_groups>
This function appears in FANN >= 2.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_cascade_num_candidate_groups(struct fann *ann,
unsigned int cascade_num_candidate_groups);
#endif
|