fann _create _train _from _callback
(PECL fann >= 1.0.0)
fann_create_train_from_callback — Creates the training data struct from a user supplied function
Description
$num_data
, int $num_input
, int $num_output
, callable $user_function
) : resourceCreates the training data struct from a user supplied function. As the training data are numerable (data 1, data 2...), the user must write a function that receives the number of the training data set (input, output) and returns the set.
Parameters
-
num_data
-
The number of training data
-
num_input
-
The number of inputs per training data
-
num_output
-
The number of ouputs per training data
-
user_function
-
The user supplied function with following parameters:
- num - The number of the training data set
- num_input - The number of inputs per training data
- num_output - The number of ouputs per training data
The function should return an associative array with keys input and output and two array values of input and output.
Examples
Example #1 fann_create_train_from_callback() example
<?php
function create_train_callback($num_data, $num_input, $num_output) {
return array(
"input" => array_fill(0, $num_input, 1),
"output" => array_fill(0, $num_output, 1),
);
}
$num_data = 3;
$num_input = 2;
$num_output = 1;
$train_data = fann_create_train_from_callback($num_data, $num_input, $num_output, "create_train_callback");
if ($train_data) {
// Do something with $train_data
}
?>
See Also
- fann_read_train_from_file() - Reads a file that stores training data
- fann_train_on_data() - Trains on an entire dataset for a period of time
- fann_destroy_train() - Destructs the training data
- fann_save_train() - Save the training structure to a file
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-fann-create-train-from-callback.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.