mirror of
https://github.com/BlackLight/neuralpp.git
synced 2025-07-09 16:48:08 +02:00
Documentation re-generated, a lot of minor stuff
This commit is contained in:
parent
d52976e74e
commit
7861e56f35
144 changed files with 2589 additions and 851 deletions
66
doc/html/examples_2adderFromScratch_8cpp-example.html
Normal file
66
doc/html/examples_2adderFromScratch_8cpp-example.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<!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++: examples/adderFromScratch.cpp</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 Page</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><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>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>examples/adderFromScratch.cpp</h1>Similar to learnAdd.cpp, but this time the training XML is generated as a string and not saved to a file, and parsed by the program itself to build the network. Then, the program asks two real numbers, and performs both the sum and the difference between them, putting the sum's output on the first output neuron and the difference's on the second output neuron. Anyway, using more than one neuron in the output layer is strongly discouraged, as the network usually won't set correctly the synaptical weights to give satisfying and accurate answers for all of the operations.<p>
|
||||
<div class="fragment"><pre class="fragment">
|
||||
<span class="preprocessor">#include <iostream></span>
|
||||
<span class="preprocessor">#include <<a class="code" href="neural_09_09_8hpp.html">neural++.hpp</a>></span>
|
||||
|
||||
<span class="keyword">using namespace </span>std;
|
||||
<span class="keyword">using namespace </span>neuralpp;
|
||||
|
||||
<span class="keywordtype">int</span> main() {
|
||||
<a name="_a0"></a><a class="code" href="classneuralpp_1_1NeuralNet.html" title="Main project&#39;s class.">NeuralNet</a> net(2, 2, 2, 0.005, 100);
|
||||
<span class="keywordtype">string</span> xml;
|
||||
<span class="keywordtype">double</span> tmp;
|
||||
<span class="keywordtype">int</span> <span class="keywordtype">id</span> = 0;
|
||||
|
||||
<span class="comment">// XML initialization. Then, I say XML that 2+3=5, 3+3=6, 5+4=9</span>
|
||||
<span class="comment">// Strings' format is "input1,input2,...,inputn;output1,output2,...,outputm</span>
|
||||
NeuralNet::initXML(xml);
|
||||
xml += NeuralNet::XMLFromSet(<span class="keywordtype">id</span>, <span class="stringliteral">"3,2;5,1"</span>);
|
||||
xml += NeuralNet::XMLFromSet(<span class="keywordtype">id</span>, <span class="stringliteral">"4,2;6,2"</span>);
|
||||
xml += NeuralNet::XMLFromSet(<span class="keywordtype">id</span>, <span class="stringliteral">"6,3;9,3"</span>);
|
||||
NeuralNet::closeXML(xml);
|
||||
cout << xml << endl;
|
||||
|
||||
net.<a name="a1"></a><a class="code" href="classneuralpp_1_1NeuralNet.html#1c9e17437d41a7048611e21a3cc1c7dd" title="Train a network using a training set loaded from an XML file.">train</a>(xml, NeuralNet::str);
|
||||
vector<double> v;
|
||||
cout << <span class="stringliteral">"Network status: trained\n\n"</span>;
|
||||
|
||||
cout << <span class="stringliteral">"First number to add: "</span>;
|
||||
cin >> tmp;
|
||||
v.push_back(tmp);
|
||||
|
||||
cout << <span class="stringliteral">"Second number to add: "</span>;
|
||||
cin >> tmp;
|
||||
v.push_back(tmp);
|
||||
|
||||
net.<a name="a2"></a><a class="code" href="classneuralpp_1_1NeuralNet.html#405b32d2928344314ecf0469070b0f17" title="It sets the input for the network.">setInput</a>(v);
|
||||
net.<a name="a3"></a><a class="code" href="classneuralpp_1_1NeuralNet.html#c129c180647362da963758bfd1ba6890" title="It propagates values through the network.">propagate</a>();
|
||||
cout << <span class="stringliteral">"Output: "</span> << net.<a name="a4"></a><a class="code" href="classneuralpp_1_1NeuralNet.html#e6d2215ecc8b560db2f6797db642191c" title="It gets the output of the network in case the output layer contains more neurons...">getOutputs</a>()[0] << <span class="stringliteral">"; "</span> << net.<a class="code" href="classneuralpp_1_1NeuralNet.html#e6d2215ecc8b560db2f6797db642191c" title="It gets the output of the network in case the output layer contains more neurons...">getOutputs</a>()[1] << endl;
|
||||
<span class="keywordflow">return</span> 0;
|
||||
}
|
||||
|
||||
</pre></div> </div>
|
||||
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 16 20:53:42 2009 for Neural++ by
|
||||
<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>
|
Loading…
Add table
Add a link
Reference in a new issue