Skip to content

Commit

Permalink
Doxygen documentation for Diwa::loadFromFile() and Diwa::saveToFile().
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Mar 28, 2024
1 parent aec2117 commit fad3ae1
Show file tree
Hide file tree
Showing 20 changed files with 166 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = DOXYGEN

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
6 changes: 4 additions & 2 deletions docs/class_diwa-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@
<tr class="odd"><td class="entry"><a class="el" href="class_diwa.html#a410c77ad562f6e49f9d79c4fde37ac3d">getActivationFunction</a>() const</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_diwa.html#a0677924dfd094ccc8f295feb896d96a7">inference</a>(double *inputs)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="class_diwa.html#a9647345843529f26c7ec3959697d73e0">initialize</a>(int inputNeurons, int hiddenLayers, int hiddenNeurons, int outputNeurons, bool randomizeWeights=true)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_diwa.html#a8777a2d67f101047f7dfd6fb3d92bb01">recommendedHiddenLayerCount</a>(int numSamples, int alpha)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="class_diwa.html#aee7f6dd835f93a7c88e890e5f329ccb6">recommendedHiddenNeuronCount</a>()</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_diwa.html#a2e620f1c3d3dd76dfe86feb9760fa465">loadFromFile</a>(T annFile)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="class_diwa.html#a8777a2d67f101047f7dfd6fb3d92bb01">recommendedHiddenLayerCount</a>(int numSamples, int alpha)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_diwa.html#aee7f6dd835f93a7c88e890e5f329ccb6">recommendedHiddenNeuronCount</a>()</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="class_diwa.html#a4ed3c24c07e00e37339139f46772b527">saveToFile</a>(T annFile)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_diwa.html#ab8474411623a6e505b6472ed08cf442d">setActivationFunction</a>(diwa_activation activation)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="class_diwa.html#a513dc40d5b18567013ea84185c91089b">train</a>(double learningRate, double *inputNeurons, double *outputNeurons)</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_diwa.html#a99a875efca6521c42d0a167b6d6d8d93">~Diwa</a>()</td><td class="entry"><a class="el" href="class_diwa.html">Diwa</a></td><td class="entry"></td></tr>
Expand Down
62 changes: 62 additions & 0 deletions docs/class_diwa.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@
<tr class="memitem:a513dc40d5b18567013ea84185c91089b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_diwa.html#a513dc40d5b18567013ea84185c91089b">train</a> (double learningRate, double *inputNeurons, double *outputNeurons)</td></tr>
<tr class="memdesc:a513dc40d5b18567013ea84185c91089b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Train the neural network using backpropagation. <br /></td></tr>
<tr class="separator:a513dc40d5b18567013ea84185c91089b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2e620f1c3d3dd76dfe86feb9760fa465"><td class="memItemLeft" align="right" valign="top"><a class="el" href="diwa_8h.html#a669df21efbcbba971edbc5d4e091061a">DiwaError</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_diwa.html#a2e620f1c3d3dd76dfe86feb9760fa465">loadFromFile</a> (T annFile)</td></tr>
<tr class="memdesc:a2e620f1c3d3dd76dfe86feb9760fa465"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load neural network model from file in Arduino environment. <br /></td></tr>
<tr class="separator:a2e620f1c3d3dd76dfe86feb9760fa465"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ed3c24c07e00e37339139f46772b527"><td class="memItemLeft" align="right" valign="top"><a class="el" href="diwa_8h.html#a669df21efbcbba971edbc5d4e091061a">DiwaError</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_diwa.html#a4ed3c24c07e00e37339139f46772b527">saveToFile</a> (T annFile)</td></tr>
<tr class="memdesc:a4ed3c24c07e00e37339139f46772b527"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save neural network model to file in Arduino environment. <br /></td></tr>
<tr class="separator:a4ed3c24c07e00e37339139f46772b527"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a22d9a6ed4e81f2f9d6b6845f0d076866"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_diwa.html#a22d9a6ed4e81f2f9d6b6845f0d076866">calculateAccuracy</a> (double *testInput, double *testExpectedOutput, int epoch)</td></tr>
<tr class="memdesc:a22d9a6ed4e81f2f9d6b6845f0d076866"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the accuracy of the neural network on test data. <br /></td></tr>
<tr class="separator:a22d9a6ed4e81f2f9d6b6845f0d076866"><td class="memSeparator" colspan="2">&#160;</td></tr>
Expand Down Expand Up @@ -386,6 +392,34 @@ <h2 class="memtitle"><span class="permalink"><a href="#a9647345843529f26c7ec3959
</dl>
<dl class="section return"><dt>Returns</dt><dd>DiwaError indicating the initialization status. </dd></dl>

</div>
</div>
<a id="a2e620f1c3d3dd76dfe86feb9760fa465" name="a2e620f1c3d3dd76dfe86feb9760fa465"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2e620f1c3d3dd76dfe86feb9760fa465">&#9670;&#160;</a></span>loadFromFile()</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="diwa_8h.html#a669df21efbcbba971edbc5d4e091061a">DiwaError</a> Diwa::loadFromFile </td>
<td>(</td>
<td class="paramtype">T&#160;</td>
<td class="paramname"><em>annFile</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">

<p>Load neural network model from file in Arduino environment. </p>
<p>This method loads a previously saved neural network model from the specified file in an Arduino environment. It reads the model data from the given file and initializes the <a class="el" href="class_diwa.html" title="Lightweight Feedforward Artificial Neural Network (ANN) library tailored for microcontrollers.">Diwa</a> object with the loaded model parameters and weights.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">annFile</td><td>File object representing the neural network model file. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>DiwaError indicating the loading status. </dd></dl>

</div>
</div>
<a id="a8777a2d67f101047f7dfd6fb3d92bb01" name="a8777a2d67f101047f7dfd6fb3d92bb01"></a>
Expand Down Expand Up @@ -446,6 +480,34 @@ <h2 class="memtitle"><span class="permalink"><a href="#aee7f6dd835f93a7c88e890e5
<p>This function computes the recommended number of hidden neurons for a neural network based on the number of input and output neurons. The recommendation is calculated using a heuristic formula that aims to strike a balance between model complexity and generalization ability. The recommended number of hidden neurons is determined as the square root of the product of the input and output neurons.</p>
<dl class="section return"><dt>Returns</dt><dd>The recommended number of hidden neurons, or -1 if the input or output neurons are non-positive. </dd></dl>

</div>
</div>
<a id="a4ed3c24c07e00e37339139f46772b527" name="a4ed3c24c07e00e37339139f46772b527"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4ed3c24c07e00e37339139f46772b527">&#9670;&#160;</a></span>saveToFile()</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="diwa_8h.html#a669df21efbcbba971edbc5d4e091061a">DiwaError</a> Diwa::saveToFile </td>
<td>(</td>
<td class="paramtype">T&#160;</td>
<td class="paramname"><em>annFile</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">

<p>Save neural network model to file in Arduino environment. </p>
<p>This method saves the current state of the neural network model to the specified file in an Arduino environment. It writes the model parameters and weights to the given file, allowing later retrieval and reuse of the trained model.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">annFile</td><td>File object representing the destination file for the model. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>DiwaError indicating the saving status. </dd></dl>

</div>
</div>
<a id="ab8474411623a6e505b6472ed08cf442d" name="ab8474411623a6e505b6472ed08cf442d"></a>
Expand Down
2 changes: 2 additions & 0 deletions docs/class_diwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ var class_diwa =
[ "getActivationFunction", "class_diwa.html#a410c77ad562f6e49f9d79c4fde37ac3d", null ],
[ "inference", "class_diwa.html#a0677924dfd094ccc8f295feb896d96a7", null ],
[ "initialize", "class_diwa.html#a9647345843529f26c7ec3959697d73e0", null ],
[ "loadFromFile", "class_diwa.html#a2e620f1c3d3dd76dfe86feb9760fa465", null ],
[ "recommendedHiddenLayerCount", "class_diwa.html#a8777a2d67f101047f7dfd6fb3d92bb01", null ],
[ "recommendedHiddenNeuronCount", "class_diwa.html#aee7f6dd835f93a7c88e890e5f329ccb6", null ],
[ "saveToFile", "class_diwa.html#a4ed3c24c07e00e37339139f46772b527", null ],
[ "setActivationFunction", "class_diwa.html#ab8474411623a6e505b6472ed08cf442d", null ],
[ "train", "class_diwa.html#a513dc40d5b18567013ea84185c91089b", null ]
];
Loading

0 comments on commit fad3ae1

Please sign in to comment.