bool fann_train(resource ann, mixed data, int max_iterations, double desired_error, int iterations_between_reports);
fann_train will train ann on the data supplied, returning TRUE
on success or FALSE on failure.
Resources is an artificial neural network returned by fann_create.
data must be either an array of training data, or the URI of a properly formatted training file.
fann_train will continue training until desired_error is
reached, or max_iterations is exceeded.
If iterations_between_reports is set, fann_create will output a
short progress report every iterations_between_reports. Default is 0 (meaning no
reports).
Example 6-1.
fann_create from training data
<?php
$ann = fann_create(array(2, 4, 1), 1.0, 0.7);
if ( fann_train($ann,
array(
array(
array(0,0), /* Input(s) */
array(0) /* Output(s) */
),
array(
array(0,1), /* Input(s) */
array(1) /* Output(s) */
),
array(
array(1,0), /* Input(s) */
array(1) /* Output(s) */
),
array(array(1,1), /* Input(s) */
array(0) /* Output(s) */
)
),
100000,
0.00001,
1000) == FALSE) {
exit('Could not train $ann.');
}
?>
This function appears in FANN-PHP >= 0.1.0.