<!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>Reads a file that stores training data</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.fann-randomize-weights.html">fann_randomize_weights</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fann-reset-errno.html">fann_reset_errno</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-read-train-from-file" class="refentry"> <div class="refnamediv"> <h1 class="refname">fann_read_train_from_file</h1> <p class="verinfo">(PECL fann >= 1.0.0)</p><p class="refpurpose"><span class="refname">fann_read_train_from_file</span> — <span class="dc-title">Reads a file that stores training data</span></p> </div> <div class="refsect1 description" id="refsect1-function.fann-read-train-from-file-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <span class="methodname"><strong>fann_read_train_from_file</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span> )</div> <p class="para rdfs-comment"> Reads a file that stores training data. </p> </div> <div class="refsect1 parameters" id="refsect1-function.fann-read-train-from-file-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">filename</code></dt> <dd> <p class="para"> The input file in the following format: </p> <div class="example-contents"> <div class="txtcode"><pre class="txtcode">num_train_data num_input num_output inputdata seperated by space outputdata seperated by space . . . inputdata seperated by space outputdata seperated by space</pre> </div> </div> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.fann-read-train-from-file-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a train data <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> on success, or <strong><code>FALSE</code></strong> on error.</p> </div> <div class="refsect1 examples" id="refsect1-function.fann-read-train-from-file-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-4637"> <p><strong>Example #1 <span class="methodname"><strong>fann_read_train_from_file()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$train_data </span><span style="color: #007700">= </span><span style="color: #0000BB">fann_read_train_from_file</span><span style="color: #007700">(</span><span style="color: #DD0000">"xor.data"</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$train_data</span><span style="color: #007700">) {<br /> </span><span style="color: #FF8000">// Do something with $train_data for XOR function<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>Contents of xor.data</p></div> <div class="example-contents"> <div class="txtcode"><pre class="txtcode">4 2 1 -1 -1 -1 -1 1 1 1 -1 1 1 1 -1</pre> </div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.fann-read-train-from-file-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-destroy-train.html" class="function" rel="rdfs-seeAlso">fann_destroy_train()</a> - Destructs the training data</span></li> <li class="member"><span class="function"><a href="function.fann-save-train.html" class="function" rel="rdfs-seeAlso">fann_save_train()</a> - Save the training structure to a file</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-randomize-weights.html">fann_randomize_weights</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fann-reset-errno.html">fann_reset_errno</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>