<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Sets the callback function for use during training</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.fann-set-bit-fail-limit.html">fann_set_bit_fail_limit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fann-set-cascade-activation-functions.html">fann_set_cascade_activation_functions</a></div> <div class="up"><a href="ref.fann.html">Fann Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.fann-set-callback" class="refentry"> <div class="refnamediv"> <h1 class="refname">fann_set_callback</h1> <p class="verinfo">(PECL fann >= 1.0.0)</p><p class="refpurpose"><span class="refname">fann_set_callback</span> — <span class="dc-title">Sets the callback function for use during training</span></p> </div> <div class="refsect1 description" id="refsect1-function.fann-set-callback-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>fann_set_callback</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$ann</code></span> , <span class="methodparam"><span class="type"><span class="type collable">collable</span></span> <code class="parameter">$callback</code></span> )</div> <p class="para rdfs-comment"> Sets the callback function for use during training. It means that it is called from <span class="function"><a href="function.fann-train-on-data.html" class="function">fann_train_on_data()</a></span> or <span class="function"><a href="function.fann-train-on-file.html" class="function">fann_train_on_file()</a></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.fann-set-callback-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">ann</code></em></span> <dd> <p class="para">Neural network <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span>.</p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">callback</code></em></span> <dd> <p class="para"> The supplied callback function takes following parameters: <ul class="simplelist"> <li class="member"><em>ann</em> - The neural network <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span></li> <li class="member"><em>train</em> - The train data <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> or <strong><code>NULL</code></strong> if called from <span class="function"><a href="function.fann-train-on-file.html" class="function">fann_train_on_file()</a></span></li> <li class="member"><em>max_epochs</em> - The maximum number of epochs the training should continue</li> <li class="member"><em>epochs_between_reports</em> - The number of epochs between calling this function</li> <li class="member"><em>desired_error</em> - The desired <span class="function"><a href="function.fann-get-mse.html" class="function">fann_get_MSE()</a></span> or <span class="function"><a href="function.fann-get-bit-fail.html" class="function">fann_get_bit_fail()</a></span>, depending on the stop function chosen by <span class="function"><a href="function.fann-set-train-stop-function.html" class="function">fann_set_train_stop_function()</a></span></li> <li class="member"><em>epochs</em> - The current epoch</li> </ul> </p> <p class="para"> The callback should return <strong><code>TRUE</code></strong>. If it returns <strong><code>FALSE</code></strong>, the training will terminate. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.fann-set-callback-returnvalues"> <h3 class="title">Return Values</h3> <p class="para">Returns <strong><code>TRUE</code></strong> on success, or <strong><code>FALSE</code></strong> otherwise.</p> </div> <div class="refsect1 seealso" id="refsect1-function.fann-set-callback-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.fann-train-on-data.html" class="function" rel="rdfs-seeAlso">fann_train_on_data()</a> - Trains on an entire dataset for a period of time</span></li> <li class="member"> <span class="function"><a href="function.fann-train-on-file.html" class="function" rel="rdfs-seeAlso">fann_train_on_file()</a> - Trains on an entire dataset, which is read from file, for a period of time</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.fann-set-bit-fail-limit.html">fann_set_bit_fail_limit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fann-set-cascade-activation-functions.html">fann_set_cascade_activation_functions</a></div> <div class="up"><a href="ref.fann.html">Fann Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>