neuralpp/doc/html/classneuralpp_1_1NeuralNet.html

981 lines
50 KiB
HTML
Raw Normal View History

2009-08-09 11:17:39 +02:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Neural++: neuralpp::NeuralNet Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
2009-08-09 11:17:39 +02:00
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceneuralpp.html">neuralpp</a>::<a class="el" href="classneuralpp_1_1NeuralNet.html">NeuralNet</a>
</div>
</div>
<div class="contents">
<h1>neuralpp::NeuralNet Class Reference</h1><!-- doxytag: class="neuralpp::NeuralNet" -->Main project's class.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="neural_09_09_8hpp-source.html">neural++.hpp</a>&gt;</code>
<p>
<p>
<a href="classneuralpp_1_1NeuralNet-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#94c36c94060e785ea67a0014c4182f8f">source</a> { <a class="el" href="classneuralpp_1_1NeuralNet.html#94c36c94060e785ea67a0014c4182f8f5ec2727c0756ddb097b53efe49b81afb">file</a>,
<a class="el" href="classneuralpp_1_1NeuralNet.html#94c36c94060e785ea67a0014c4182f8f6d06b4fe9414a158c97aee1a3679a904">str</a>
}</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Enum to choose the eventual training source for our network (XML from a file or from a string). <a href="classneuralpp_1_1NeuralNet.html#94c36c94060e785ea67a0014c4182f8f">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#92b145f2f6f00bf1ba645ce2235882c2">NeuralNet</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Empty constructor for the class - it just makes nothing. <a href="#92b145f2f6f00bf1ba645ce2235882c2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#3d602f3988a9a3e2c77dc6955674f412">NeuralNet</a> (size_t in_size, size_t hidden_size, size_t out_size, double l, int e, double th=0.0, double(*a)(double)=__actv)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <a href="#3d602f3988a9a3e2c77dc6955674f412"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#b4bfa407d28bb17abf7f735a049987d9">NeuralNet</a> (const std::string file) throw (NetworkFileNotFoundException)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <a href="#b4bfa407d28bb17abf7f735a049987d9"></a><br></td></tr>
2009-08-15 02:59:09 +02:00
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#961dce8913264bf64c899dce4e25f810">getOutput</a> () const </td></tr>
2009-08-09 11:17:39 +02:00
2009-08-15 02:59:09 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It gets the output of the network (note: the layer output should contain an only neuron). <a href="#961dce8913264bf64c899dce4e25f810"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::vector&lt; double &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#e6d2215ecc8b560db2f6797db642191c">getOutputs</a> ()</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It gets the output of the network in case the output layer contains more neurons. <a href="#e6d2215ecc8b560db2f6797db642191c"></a><br></td></tr>
2009-09-04 11:27:14 +02:00
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#e08cdcf4b70f987700e553d9914f6179">getThreshold</a> () const </td></tr>
2009-08-09 11:17:39 +02:00
2009-09-04 11:27:14 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the threshold of the neurons in the network. <a href="#e08cdcf4b70f987700e553d9914f6179"></a><br></td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#c129c180647362da963758bfd1ba6890">propagate</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It propagates values through the network. <a href="#c129c180647362da963758bfd1ba6890"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#405b32d2928344314ecf0469070b0f17">setInput</a> (std::vector&lt; double &gt; v)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It sets the input for the network. <a href="#405b32d2928344314ecf0469070b0f17"></a><br></td></tr>
2009-08-15 02:59:09 +02:00
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#fdf94c276720c25e565cac834fe8a407">save</a> (const char *fname) throw (NetworkFileWriteException)</td></tr>
2009-08-09 11:17:39 +02:00
2009-08-15 02:59:09 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Save a trained neural network to a binary file. <a href="#fdf94c276720c25e565cac834fe8a407"></a><br></td></tr>
2009-09-04 11:27:14 +02:00
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#a060e28b438613a6cc9e0895ddbc292b">loadFromBinary</a> (const std::string fname) throw (NetworkFileNotFoundException)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">DEPRECATED. <a href="#a060e28b438613a6cc9e0895ddbc292b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#520147d9b47b69565567bd3fdcfd8897">saveToBinary</a> (const char *fname) throw (NetworkFileWriteException)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">DEPRECATED. <a href="#520147d9b47b69565567bd3fdcfd8897"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#1c9e17437d41a7048611e21a3cc1c7dd">train</a> (std::string xml, <a class="el" href="classneuralpp_1_1NeuralNet.html#94c36c94060e785ea67a0014c4182f8f">source</a> src) throw (InvalidXMLException)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Train a network using a training set loaded from an XML file. <a href="#1c9e17437d41a7048611e21a3cc1c7dd"></a><br></td></tr>
2009-08-09 11:17:39 +02:00
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#96da6712a72051cf34ad961761ef6e08">initXML</a> (std::string &amp;xml)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize the training XML for the neural network. <a href="#96da6712a72051cf34ad961761ef6e08"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#0a2733037af912b3e6a10146e7b7172f">XMLFromSet</a> (int &amp;id, std::string set)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a training set from a string and copies it to an XML For example, these strings could be training sets for making sums: "2,3;5" - "5,6;11" - "2,2;4" - "4,5:9" This method called on the first string will return an XML such this: '&lt;training id="0"&gt;&lt;input id="0"&gt;2&lt;/input&gt;&lt;input id="1"&gt;3&lt;/input&gt;&lt;output id="0"&gt;5&lt;/output&gt; &amp;lt/training&gt;'. <a href="#0a2733037af912b3e6a10146e7b7172f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#e17732ed578bc4bd6032bfae58a5cf51">closeXML</a> (std::string &amp;xml)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Closes an open XML document generated by "initXML" and "XMLFromSet". <a href="#e17732ed578bc4bd6032bfae58a5cf51"></a><br></td></tr>
2009-08-15 02:59:09 +02:00
<tr><td colspan="2"><br><h2>Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classneuralpp_1_1Layer.html">Layer</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#e2b4e8405f9d25edab395d61502bdba9">input</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classneuralpp_1_1Layer.html">Layer</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#bbdaa1b6c0a1a95d2b18cd25fda2a266">hidden</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classneuralpp_1_1Layer.html">Layer</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#fa9b2dbcbb39d0fc70f790ac24069a74">output</a></td></tr>
2009-08-09 11:17:39 +02:00
<tr><td colspan="2"><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#94169c89a7cd47122ab5dbf1d5c5e108">updateWeights</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It updates the weights of the net's synapsis through back-propagation. <a href="#94169c89a7cd47122ab5dbf1d5c5e108"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#8a140d28e6dd4097470c7c138801ad01">error</a> (double ex)</td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the error made on the expected result as squared deviance. <a href="#8a140d28e6dd4097470c7c138801ad01"></a><br></td></tr>
2009-09-04 11:27:14 +02:00
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#562dfe9fb8d73bf25a23ce608451d3aa">expected</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the expected value (in case you have an only neuron in output layer). <a href="#562dfe9fb8d73bf25a23ce608451d3aa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::vector&lt; double &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#51a1851ed07b85bec091c9053ae99cf7">getExpected</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the expected value (in case you have an only neuron in output layer). <a href="#51a1851ed07b85bec091c9053ae99cf7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#b6475762b7e9eab086befdc511f7c236">setExpected</a> (double ex)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It sets the value you expect from your network (in case the network has an only neuron in its output layer). <a href="#b6475762b7e9eab086befdc511f7c236"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#e649edc3d86bec7c0e178d5c892b4fd7">setExpected</a> (std::vector&lt; double &gt; ex)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the values you expect from your network. <a href="#e649edc3d86bec7c0e178d5c892b4fd7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#b0bd1daadb06980dff1f50d33a7c098e">update</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It updates through back-propagation the weights of the synapsis and computes again the output value for <em>epochs</em> times, calling back updateWeights and commitChanges functions. <a href="#b0bd1daadb06980dff1f50d33a7c098e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#46f23f462318a4ffc037a4e806364c3f">link</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">It links the layers of the network (input, hidden, output). <a href="#46f23f462318a4ffc037a4e806364c3f"></a><br></td></tr>
2009-08-09 11:17:39 +02:00
<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#4cb52dae7b43d03fac73afca7b9f3a51">epochs</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#4f88106c9e542c39eac43b4ca1974a2a">ref_epochs</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#6bd7be443e46b2fdbf1da2edb8e611ab">l_rate</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#327dbfdd72b0a74293f8f29630525aa3">threshold</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::vector&lt; double &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#a9e4ff43427f56663739c4c7450de8ee">expect</a></td></tr>
2009-08-09 11:17:39 +02:00
<tr><td class="memItemLeft" nowrap align="right" valign="top">double(*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classneuralpp_1_1NeuralNet.html#c1469e6afd87d85b82f14bc246f82457">actv_f</a> )(double)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Private pointer to function, containing the function to be used as activation function. <a href="#c1469e6afd87d85b82f14bc246f82457"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Main project's class.
<p>
Use *ONLY* this class, unless you know what you're doing <dl compact><dt><b>Examples: </b></dt><dd>
<p>
2009-09-04 11:27:14 +02:00
<a class="el" href="examples_2adderFromString_8cpp-example.html#_a0">examples/adderFromString.cpp</a>, <a class="el" href="examples_2doAdd_8cpp-example.html#_a0">examples/doAdd.cpp</a>, <a class="el" href="examples_2learnAdd_8cpp-example.html#_a0">examples/learnAdd.cpp</a>, and <a class="el" href="examples_2networkForSumsAndSubtractions_8cpp-example.html#_a0">examples/networkForSumsAndSubtractions.cpp</a>.</dl><hr><h2>Member Enumeration Documentation</h2>
2009-08-09 11:17:39 +02:00
<a class="anchor" name="94c36c94060e785ea67a0014c4182f8f"></a><!-- doxytag: member="neuralpp::NeuralNet::source" ref="94c36c94060e785ea67a0014c4182f8f" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="classneuralpp_1_1NeuralNet.html#94c36c94060e785ea67a0014c4182f8f">neuralpp::NeuralNet::source</a> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Enum to choose the eventual training source for our network (XML from a file or from a string).
<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="94c36c94060e785ea67a0014c4182f8f5ec2727c0756ddb097b53efe49b81afb"></a><!-- doxytag: member="file" ref="94c36c94060e785ea67a0014c4182f8f5ec2727c0756ddb097b53efe49b81afb" args="" -->file</em>&nbsp;</td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="94c36c94060e785ea67a0014c4182f8f6d06b4fe9414a158c97aee1a3679a904"></a><!-- doxytag: member="str" ref="94c36c94060e785ea67a0014c4182f8f6d06b4fe9414a158c97aee1a3679a904" args="" -->str</em>&nbsp;</td><td>
</td></tr>
</table>
</dl>
</div>
</div><p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="92b145f2f6f00bf1ba645ce2235882c2"></a><!-- doxytag: member="neuralpp::NeuralNet::NeuralNet" ref="92b145f2f6f00bf1ba645ce2235882c2" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">neuralpp::NeuralNet::NeuralNet </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Empty constructor for the class - it just makes nothing.
<p>
</div>
</div><p>
<a class="anchor" name="3d602f3988a9a3e2c77dc6955674f412"></a><!-- doxytag: member="neuralpp::NeuralNet::NeuralNet" ref="3d602f3988a9a3e2c77dc6955674f412" args="(size_t in_size, size_t hidden_size, size_t out_size, double l, int e, double th=0.0, double(*a)(double)=__actv)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">neuralpp::NeuralNet::NeuralNet </td>
<td>(</td>
<td class="paramtype">size_t&nbsp;</td>
<td class="paramname"> <em>in_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&nbsp;</td>
<td class="paramname"> <em>hidden_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&nbsp;</td>
<td class="paramname"> <em>out_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double&nbsp;</td>
<td class="paramname"> <em>l</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>e</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double&nbsp;</td>
<td class="paramname"> <em>th</em> = <code>0.0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double(*)(double)&nbsp;</td>
<td class="paramname"> <em>a</em> = <code>__actv</code></td><td>&nbsp;</td>
2009-08-09 11:17:39 +02:00
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Constructor.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>in_size</em>&nbsp;</td><td>Size of the input layer </td></tr>
<tr><td valign="top"></td><td valign="top"><em>hidden_size</em>&nbsp;</td><td>Size of the hidden layer </td></tr>
<tr><td valign="top"></td><td valign="top"><em>out_size</em>&nbsp;</td><td>Size of the output layer </td></tr>
<tr><td valign="top"></td><td valign="top"><em>l</em>&nbsp;</td><td>learn rate (get it after doing some experiments, but generally try to keep its value quite low to be more accurate) </td></tr>
<tr><td valign="top"></td><td valign="top"><em>e</em>&nbsp;</td><td>Epochs (cycles) to execute (the most you execute, the most the network can be accurate for its purpose) </td></tr>
<tr><td valign="top"></td><td valign="top"><em>th</em>&nbsp;</td><td>Threshold, value in [0,1] that establishes how much a neuron must be 'sensitive' on variations of the input values </td></tr>
<tr><td valign="top"></td><td valign="top"><em>a</em>&nbsp;</td><td>Activation function to use (default: f(x)=x) </td></tr>
2009-08-09 11:17:39 +02:00
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="b4bfa407d28bb17abf7f735a049987d9"></a><!-- doxytag: member="neuralpp::NeuralNet::NeuralNet" ref="b4bfa407d28bb17abf7f735a049987d9" args="(const std::string file)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">neuralpp::NeuralNet::NeuralNet </td>
<td>(</td>
<td class="paramtype">const std::string&nbsp;</td>
2009-08-09 11:17:39 +02:00
<td class="paramname"> <em>file</em> </td>
<td>&nbsp;)&nbsp;</td>
<td> throw (<a class="el" href="classneuralpp_1_1NetworkFileNotFoundException.html">NetworkFileNotFoundException</a>)</td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
Constructor.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
2009-08-15 02:59:09 +02:00
<tr><td valign="top"></td><td valign="top"><em>file</em>&nbsp;</td><td>Binary file containing a neural network previously saved by <a class="el" href="classneuralpp_1_1NeuralNet.html#fdf94c276720c25e565cac834fe8a407" title="Save a trained neural network to a binary file.">save()</a> method </td></tr>
2009-08-09 11:17:39 +02:00
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classneuralpp_1_1NetworkFileNotFoundException.html" title="Exception thrown when doing an attempt to load a network from an invalid file.">NetworkFileNotFoundException</a></em>&nbsp;</td><td></td></tr>
2009-08-09 11:17:39 +02:00
</table>
</dl>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="94169c89a7cd47122ab5dbf1d5c5e108"></a><!-- doxytag: member="neuralpp::NeuralNet::updateWeights" ref="94169c89a7cd47122ab5dbf1d5c5e108" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void neuralpp::NeuralNet::updateWeights </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
It updates the weights of the net's synapsis through back-propagation.
<p>
In-class use only
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="8a140d28e6dd4097470c7c138801ad01"></a><!-- doxytag: member="neuralpp::NeuralNet::error" ref="8a140d28e6dd4097470c7c138801ad01" args="(double ex)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">double neuralpp::NeuralNet::error </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
2009-09-04 11:27:14 +02:00
<td class="paramtype">double&nbsp;</td>
<td class="paramname"> <em>ex</em> </td>
2009-08-09 11:17:39 +02:00
<td>&nbsp;)&nbsp;</td>
<td><code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
Get the error made on the expected result as squared deviance.
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
<dl compact><dt><b>Parameters:</b></dt><dd>
2009-08-09 11:17:39 +02:00
<table border="0" cellspacing="2" cellpadding="0">
2009-09-04 11:27:14 +02:00
<tr><td valign="top"></td><td valign="top"><em>ex</em>&nbsp;</td><td>Expected value </td></tr>
2009-08-09 11:17:39 +02:00
</table>
</dl>
2009-09-04 11:27:14 +02:00
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Mean error </dd></dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="562dfe9fb8d73bf25a23ce608451d3aa"></a><!-- doxytag: member="neuralpp::NeuralNet::expected" ref="562dfe9fb8d73bf25a23ce608451d3aa" args="() const " -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">double neuralpp::NeuralNet::expected </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
2009-09-04 11:27:14 +02:00
<td class="paramname"> </td>
2009-08-09 11:17:39 +02:00
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td> const<code> [private]</code></td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
Get the expected value (in case you have an only neuron in output layer).
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
Of course you should specify this when you build your network by using setExpected. <dl class="return" compact><dt><b>Returns:</b></dt><dd>The expected output value for a certain training phase </dd></dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="51a1851ed07b85bec091c9053ae99cf7"></a><!-- doxytag: member="neuralpp::NeuralNet::getExpected" ref="51a1851ed07b85bec091c9053ae99cf7" args="() const " -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">std::vector&lt;double&gt; neuralpp::NeuralNet::getExpected </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td> const<code> [private]</code></td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
Get the expected value (in case you have an only neuron in output layer).
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
Of course you should specify this when you build your network by using setExpected. <dl class="return" compact><dt><b>Returns:</b></dt><dd>The expected output value for a certain training phase </dd></dl>
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="b6475762b7e9eab086befdc511f7c236"></a><!-- doxytag: member="neuralpp::NeuralNet::setExpected" ref="b6475762b7e9eab086befdc511f7c236" args="(double ex)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">void neuralpp::NeuralNet::setExpected </td>
<td>(</td>
2009-09-04 11:27:14 +02:00
<td class="paramtype">double&nbsp;</td>
<td class="paramname"> <em>ex</em> </td>
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td><code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
It sets the value you expect from your network (in case the network has an only neuron in its output layer).
<p>
2009-09-04 11:27:14 +02:00
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ex</em>&nbsp;</td><td>Expected output value </td></tr>
</table>
</dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="e649edc3d86bec7c0e178d5c892b4fd7"></a><!-- doxytag: member="neuralpp::NeuralNet::setExpected" ref="e649edc3d86bec7c0e178d5c892b4fd7" args="(std::vector&lt; double &gt; ex)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">void neuralpp::NeuralNet::setExpected </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
2009-09-04 11:27:14 +02:00
<td class="paramtype">std::vector&lt; double &gt;&nbsp;</td>
<td class="paramname"> <em>ex</em> </td>
2009-08-09 11:17:39 +02:00
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td><code> [private]</code></td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
Set the values you expect from your network.
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ex</em>&nbsp;</td><td>Expected output values </td></tr>
</table>
</dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="b0bd1daadb06980dff1f50d33a7c098e"></a><!-- doxytag: member="neuralpp::NeuralNet::update" ref="b0bd1daadb06980dff1f50d33a7c098e" args="()" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">void neuralpp::NeuralNet::update </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td><code> [private]</code></td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
It updates through back-propagation the weights of the synapsis and computes again the output value for <em>epochs</em> times, calling back updateWeights and commitChanges functions.
<p>
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="46f23f462318a4ffc037a4e806364c3f"></a><!-- doxytag: member="neuralpp::NeuralNet::link" ref="46f23f462318a4ffc037a4e806364c3f" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">void neuralpp::NeuralNet::link </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td><code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
It links the layers of the network (input, hidden, output).
2009-08-09 11:17:39 +02:00
<p>
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="961dce8913264bf64c899dce4e25f810"></a><!-- doxytag: member="neuralpp::NeuralNet::getOutput" ref="961dce8913264bf64c899dce4e25f810" args="() const " -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">double neuralpp::NeuralNet::getOutput </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
2009-09-04 11:27:14 +02:00
<td class="paramname"> </td>
2009-08-09 11:17:39 +02:00
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td> const</td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
It gets the output of the network (note: the layer output should contain an only neuron).
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The output value of the network </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="examples_2adderFromString_8cpp-example.html#a4">examples/adderFromString.cpp</a>, and <a class="el" href="examples_2doAdd_8cpp-example.html#a5">examples/doAdd.cpp</a>.</dl>
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="e6d2215ecc8b560db2f6797db642191c"></a><!-- doxytag: member="neuralpp::NeuralNet::getOutputs" ref="e6d2215ecc8b560db2f6797db642191c" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">std::vector&lt;double&gt; neuralpp::NeuralNet::getOutputs </td>
<td>(</td>
2009-09-04 11:27:14 +02:00
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
It gets the output of the network in case the output layer contains more neurons.
<p>
2009-09-04 11:27:14 +02:00
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A vector containing the output values of the network </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="examples_2networkForSumsAndSubtractions_8cpp-example.html#a4">examples/networkForSumsAndSubtractions.cpp</a>.</dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="e08cdcf4b70f987700e553d9914f6179"></a><!-- doxytag: member="neuralpp::NeuralNet::getThreshold" ref="e08cdcf4b70f987700e553d9914f6179" args="() const " -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">double neuralpp::NeuralNet::getThreshold </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td> const</td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
Get the threshold of the neurons in the network.
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The threshold of the neurons </dd></dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
<a class="anchor" name="c129c180647362da963758bfd1ba6890"></a><!-- doxytag: member="neuralpp::NeuralNet::propagate" ref="c129c180647362da963758bfd1ba6890" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void neuralpp::NeuralNet::propagate </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
It propagates values through the network.
<p>
Use this when you want to give an already trained network some new values the get to the output <dl compact><dt><b>Examples: </b></dt><dd>
2009-09-04 11:27:14 +02:00
<a class="el" href="examples_2adderFromString_8cpp-example.html#a3">examples/adderFromString.cpp</a>, <a class="el" href="examples_2doAdd_8cpp-example.html#a4">examples/doAdd.cpp</a>, and <a class="el" href="examples_2networkForSumsAndSubtractions_8cpp-example.html#a3">examples/networkForSumsAndSubtractions.cpp</a>.</dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
<a class="anchor" name="405b32d2928344314ecf0469070b0f17"></a><!-- doxytag: member="neuralpp::NeuralNet::setInput" ref="405b32d2928344314ecf0469070b0f17" args="(std::vector&lt; double &gt; v)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void neuralpp::NeuralNet::setInput </td>
<td>(</td>
<td class="paramtype">std::vector&lt; double &gt;&nbsp;</td>
2009-08-09 11:17:39 +02:00
<td class="paramname"> <em>v</em> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
It sets the input for the network.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>v</em>&nbsp;</td><td>Vector of doubles, containing the values to give to your network </td></tr>
</table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
2009-09-04 11:27:14 +02:00
<a class="el" href="examples_2adderFromString_8cpp-example.html#a2">examples/adderFromString.cpp</a>, <a class="el" href="examples_2doAdd_8cpp-example.html#a3">examples/doAdd.cpp</a>, and <a class="el" href="examples_2networkForSumsAndSubtractions_8cpp-example.html#a2">examples/networkForSumsAndSubtractions.cpp</a>.</dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="fdf94c276720c25e565cac834fe8a407"></a><!-- doxytag: member="neuralpp::NeuralNet::save" ref="fdf94c276720c25e565cac834fe8a407" args="(const char *fname)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">void neuralpp::NeuralNet::save </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
2009-09-04 11:27:14 +02:00
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>fname</em> </td>
2009-08-09 11:17:39 +02:00
<td>&nbsp;)&nbsp;</td>
2009-09-04 11:27:14 +02:00
<td> throw (<a class="el" href="classneuralpp_1_1NetworkFileWriteException.html">NetworkFileWriteException</a>)</td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
Save a trained neural network to a binary file.
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>fname</em>&nbsp;</td><td>Binary file where you're going to save your network </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classneuralpp_1_1NetworkFileWriteException.html" title="Exception thrown when trying to write the network&#39;s information to a file that...">NetworkFileWriteException</a></em>&nbsp;</td><td>When you get an error writing the network's information to a file </td></tr>
</table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="examples_2learnAdd_8cpp-example.html#a2">examples/learnAdd.cpp</a>.</dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
2009-09-04 11:27:14 +02:00
<a class="anchor" name="a060e28b438613a6cc9e0895ddbc292b"></a><!-- doxytag: member="neuralpp::NeuralNet::loadFromBinary" ref="a060e28b438613a6cc9e0895ddbc292b" args="(const std::string fname)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-09-04 11:27:14 +02:00
<td class="memname">void neuralpp::NeuralNet::loadFromBinary </td>
<td>(</td>
<td class="paramtype">const std::string&nbsp;</td>
<td class="paramname"> <em>fname</em> </td>
<td>&nbsp;)&nbsp;</td>
<td> throw (<a class="el" href="classneuralpp_1_1NetworkFileNotFoundException.html">NetworkFileNotFoundException</a>)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
DEPRECATED.
<p>
Load a trained neural network from a binary file. This function is deprecated and kept for back-compatibility. Use the XML format instead to load and neural networks and, respectly, the NeuralNetwork(const std::string) constructor or the <a class="el" href="classneuralpp_1_1NeuralNet.html#fdf94c276720c25e565cac834fe8a407" title="Save a trained neural network to a binary file.">save(const char*)</a> methods. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>fname</em>&nbsp;</td><td>Name of the file to be loaded </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classneuralpp_1_1NetworkFileNotFoundException.html" title="Exception thrown when doing an attempt to load a network from an invalid file.">NetworkFileNotFoundException</a></em>&nbsp;</td><td>When you're trying to load an invalid network file </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="520147d9b47b69565567bd3fdcfd8897"></a><!-- doxytag: member="neuralpp::NeuralNet::saveToBinary" ref="520147d9b47b69565567bd3fdcfd8897" args="(const char *fname)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void neuralpp::NeuralNet::saveToBinary </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>fname</em> </td>
<td>&nbsp;)&nbsp;</td>
<td> throw (<a class="el" href="classneuralpp_1_1NetworkFileWriteException.html">NetworkFileWriteException</a>)</td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-09-04 11:27:14 +02:00
DEPRECATED.
2009-08-09 11:17:39 +02:00
<p>
2009-09-04 11:27:14 +02:00
Save a trained neural network to a binary file. This function is deprecated and kept for back-compatibility. Use the XML format instead to load and neural networks and, respectly, the NeuralNetwork(const std::string) constructor or the <a class="el" href="classneuralpp_1_1NeuralNet.html#fdf94c276720c25e565cac834fe8a407" title="Save a trained neural network to a binary file.">save(const char*)</a> methods. <dl compact><dt><b>Parameters:</b></dt><dd>
2009-08-09 11:17:39 +02:00
<table border="0" cellspacing="2" cellpadding="0">
2009-09-04 11:27:14 +02:00
<tr><td valign="top"></td><td valign="top"><em>fname</em>&nbsp;</td><td>Name of the file to be saved with the network information </td></tr>
2009-08-09 11:17:39 +02:00
</table>
</dl>
2009-08-15 02:59:09 +02:00
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
2009-09-04 11:27:14 +02:00
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classneuralpp_1_1NetworkFileWriteException.html" title="Exception thrown when trying to write the network&#39;s information to a file that...">NetworkFileWriteException</a></em>&nbsp;</td><td>When you try to write the network information to an invalid file </td></tr>
2009-08-15 02:59:09 +02:00
</table>
</dl>
2009-09-04 11:27:14 +02:00
2009-08-09 11:17:39 +02:00
</div>
</div><p>
<a class="anchor" name="1c9e17437d41a7048611e21a3cc1c7dd"></a><!-- doxytag: member="neuralpp::NeuralNet::train" ref="1c9e17437d41a7048611e21a3cc1c7dd" args="(std::string xml, source src)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void neuralpp::NeuralNet::train </td>
<td>(</td>
<td class="paramtype">std::string&nbsp;</td>
2009-08-09 11:17:39 +02:00
<td class="paramname"> <em>xml</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classneuralpp_1_1NeuralNet.html#94c36c94060e785ea67a0014c4182f8f">source</a>&nbsp;</td>
2009-08-15 02:59:09 +02:00
<td class="paramname"> <em>src</em></td><td>&nbsp;</td>
2009-08-09 11:17:39 +02:00
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td> throw (<a class="el" href="classneuralpp_1_1InvalidXMLException.html">InvalidXMLException</a>)</td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
Train a network using a training set loaded from an XML file.
<p>
A sample XML file is available in examples/adder.xml <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>xml</em>&nbsp;</td><td>XML file containing our training set </td></tr>
<tr><td valign="top"></td><td valign="top"><em>src</em>&nbsp;</td><td>Source type from which the XML will be loaded (from a file [default] or from a string) </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classneuralpp_1_1InvalidXMLException.html" title="Exception thrown when trying parsing an invalid XML.">InvalidXMLException</a></em>&nbsp;</td><td></td></tr>
2009-08-09 11:17:39 +02:00
</table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
2009-09-04 11:27:14 +02:00
<a class="el" href="examples_2adderFromString_8cpp-example.html#a1">examples/adderFromString.cpp</a>, <a class="el" href="examples_2learnAdd_8cpp-example.html#a1">examples/learnAdd.cpp</a>, and <a class="el" href="examples_2networkForSumsAndSubtractions_8cpp-example.html#a1">examples/networkForSumsAndSubtractions.cpp</a>.</dl>
2009-08-09 11:17:39 +02:00
</div>
</div><p>
<a class="anchor" name="96da6712a72051cf34ad961761ef6e08"></a><!-- doxytag: member="neuralpp::NeuralNet::initXML" ref="96da6712a72051cf34ad961761ef6e08" args="(std::string &amp;xml)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static void neuralpp::NeuralNet::initXML </td>
<td>(</td>
<td class="paramtype">std::string &amp;&nbsp;</td>
2009-08-09 11:17:39 +02:00
<td class="paramname"> <em>xml</em> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Initialize the training XML for the neural network.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>xml</em>&nbsp;</td><td>String that will contain the XML </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="0a2733037af912b3e6a10146e7b7172f"></a><!-- doxytag: member="neuralpp::NeuralNet::XMLFromSet" ref="0a2733037af912b3e6a10146e7b7172f" args="(int &amp;id, std::string set)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static std::string neuralpp::NeuralNet::XMLFromSet </td>
2009-08-09 11:17:39 +02:00
<td>(</td>
<td class="paramtype">int &amp;&nbsp;</td>
2009-08-09 11:17:39 +02:00
<td class="paramname"> <em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::string&nbsp;</td>
2009-08-09 11:17:39 +02:00
<td class="paramname"> <em>set</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Get a training set from a string and copies it to an XML For example, these strings could be training sets for making sums: "2,3;5" - "5,6;11" - "2,2;4" - "4,5:9" This method called on the first string will return an XML such this: '&lt;training id="0"&gt;&lt;input id="0"&gt;2&lt;/input&gt;&lt;input id="1"&gt;3&lt;/input&gt;&lt;output id="0"&gt;5&lt;/output&gt; &amp;lt/training&gt;'.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>id</em>&nbsp;</td><td>ID for the given training set (0,1,..,n) </td></tr>
<tr><td valign="top"></td><td valign="top"><em>set</em>&nbsp;</td><td>String containing input values and expected outputs </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>XML string </dd></dl>
</div>
</div><p>
<a class="anchor" name="e17732ed578bc4bd6032bfae58a5cf51"></a><!-- doxytag: member="neuralpp::NeuralNet::closeXML" ref="e17732ed578bc4bd6032bfae58a5cf51" args="(std::string &amp;xml)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static void neuralpp::NeuralNet::closeXML </td>
<td>(</td>
<td class="paramtype">std::string &amp;&nbsp;</td>
2009-08-09 11:17:39 +02:00
<td class="paramname"> <em>xml</em> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Closes an open XML document generated by "initXML" and "XMLFromSet".
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>xml</em>&nbsp;</td><td>XML string to be closed </td></tr>
</table>
</dl>
</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="4cb52dae7b43d03fac73afca7b9f3a51"></a><!-- doxytag: member="neuralpp::NeuralNet::epochs" ref="4cb52dae7b43d03fac73afca7b9f3a51" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classneuralpp_1_1NeuralNet.html#4cb52dae7b43d03fac73afca7b9f3a51">neuralpp::NeuralNet::epochs</a><code> [private]</code> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="4f88106c9e542c39eac43b4ca1974a2a"></a><!-- doxytag: member="neuralpp::NeuralNet::ref_epochs" ref="4f88106c9e542c39eac43b4ca1974a2a" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classneuralpp_1_1NeuralNet.html#4f88106c9e542c39eac43b4ca1974a2a">neuralpp::NeuralNet::ref_epochs</a><code> [private]</code> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="6bd7be443e46b2fdbf1da2edb8e611ab"></a><!-- doxytag: member="neuralpp::NeuralNet::l_rate" ref="6bd7be443e46b2fdbf1da2edb8e611ab" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double <a class="el" href="classneuralpp_1_1NeuralNet.html#6bd7be443e46b2fdbf1da2edb8e611ab">neuralpp::NeuralNet::l_rate</a><code> [private]</code> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="327dbfdd72b0a74293f8f29630525aa3"></a><!-- doxytag: member="neuralpp::NeuralNet::threshold" ref="327dbfdd72b0a74293f8f29630525aa3" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double <a class="el" href="classneuralpp_1_1NeuralNet.html#327dbfdd72b0a74293f8f29630525aa3">neuralpp::NeuralNet::threshold</a><code> [private]</code> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<a class="anchor" name="a9e4ff43427f56663739c4c7450de8ee"></a><!-- doxytag: member="neuralpp::NeuralNet::expect" ref="a9e4ff43427f56663739c4c7450de8ee" args="" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::vector&lt;double&gt; <a class="el" href="classneuralpp_1_1NeuralNet.html#a9e4ff43427f56663739c4c7450de8ee">neuralpp::NeuralNet::expect</a><code> [private]</code> </td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
2009-08-15 02:59:09 +02:00
<a class="anchor" name="c1469e6afd87d85b82f14bc246f82457"></a><!-- doxytag: member="neuralpp::NeuralNet::actv_f" ref="c1469e6afd87d85b82f14bc246f82457" args=")(double)" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-08-15 02:59:09 +02:00
<td class="memname">double(* <a class="el" href="classneuralpp_1_1NeuralNet.html#c1469e6afd87d85b82f14bc246f82457">neuralpp::NeuralNet::actv_f</a>)(double)<code> [private]</code> </td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
2009-08-15 02:59:09 +02:00
Private pointer to function, containing the function to be used as activation function.
2009-08-09 11:17:39 +02:00
<p>
</div>
</div><p>
2009-08-15 02:59:09 +02:00
<a class="anchor" name="e2b4e8405f9d25edab395d61502bdba9"></a><!-- doxytag: member="neuralpp::NeuralNet::input" ref="e2b4e8405f9d25edab395d61502bdba9" args="" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-08-15 02:59:09 +02:00
<td class="memname"><a class="el" href="classneuralpp_1_1Layer.html">Layer</a>* <a class="el" href="classneuralpp_1_1NeuralNet.html#e2b4e8405f9d25edab395d61502bdba9">neuralpp::NeuralNet::input</a> </td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
2009-08-15 02:59:09 +02:00
<a class="anchor" name="bbdaa1b6c0a1a95d2b18cd25fda2a266"></a><!-- doxytag: member="neuralpp::NeuralNet::hidden" ref="bbdaa1b6c0a1a95d2b18cd25fda2a266" args="" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-08-15 02:59:09 +02:00
<td class="memname"><a class="el" href="classneuralpp_1_1Layer.html">Layer</a>* <a class="el" href="classneuralpp_1_1NeuralNet.html#bbdaa1b6c0a1a95d2b18cd25fda2a266">neuralpp::NeuralNet::hidden</a> </td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
2009-08-15 02:59:09 +02:00
<a class="anchor" name="fa9b2dbcbb39d0fc70f790ac24069a74"></a><!-- doxytag: member="neuralpp::NeuralNet::output" ref="fa9b2dbcbb39d0fc70f790ac24069a74" args="" -->
2009-08-09 11:17:39 +02:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2009-08-15 02:59:09 +02:00
<td class="memname"><a class="el" href="classneuralpp_1_1Layer.html">Layer</a>* <a class="el" href="classneuralpp_1_1NeuralNet.html#fa9b2dbcbb39d0fc70f790ac24069a74">neuralpp::NeuralNet::output</a> </td>
2009-08-09 11:17:39 +02:00
</tr>
</table>
</div>
<div class="memdoc">
<p>
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="neural_09_09_8hpp-source.html">neural++.hpp</a></ul>
</div>
2009-09-04 11:27:14 +02:00
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Sep 4 11:25:49 2009 for Neural++ by&nbsp;
2009-08-09 11:17:39 +02:00
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>