b39cd9e8ce
git-svn-id: svn://kolibrios.org@9733 a494cfbc-eb01-0410-851d-a64ba20cac60
168 lines
5.8 KiB
HTML
168 lines
5.8 KiB
HTML
<html>
|
|
<head>
|
|
<title>áèáëèîòåêà äëÿ ðàáîòû ñ íåéðîñåòüþ (neural network perceptron)</title>
|
|
<meta charset="WINDOWS-1251">
|
|
<style>
|
|
body
|
|
{
|
|
font-size: 15px;
|
|
font-family: "Bookman Old Style";
|
|
color: black;
|
|
text-align: justify;
|
|
}
|
|
h1 { color: green; font-size: 23px; }
|
|
h2 { color: green; font-size: 21px; }
|
|
h3 { color: green; font-size: 19px; }
|
|
h4 { color: #803f00; font-size: 17px; }
|
|
i { color: #0099cc; }
|
|
b { color: #0099cc; }
|
|
p {
|
|
text-indent: 1em;
|
|
margin-top: 3px;
|
|
margin-bottom: 2px;
|
|
margin-left: 0px;
|
|
margin-right: 0px;
|
|
}
|
|
ol, ul, dl{
|
|
margin-top: 3px;
|
|
margin-bottom: 2px;
|
|
}
|
|
pre
|
|
{
|
|
padding: 2px;
|
|
padding-left: 20px;
|
|
margin-top: 5px;
|
|
margin-bottom: 5px;
|
|
margin-left: 0px;
|
|
margin-right: 0px;
|
|
font-family: "Courier New";
|
|
font-size: 15px;
|
|
color: #004000;
|
|
background-color: #ffd0ff;
|
|
}
|
|
table { font-size: 15px; }
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Îãëàâëåíèå</h1>
|
|
<ul>
|
|
<li>Âñòóïëåíèå</li>
|
|
<li><a href="#fun">Ôóíêöèè</a><br>
|
|
<ul>
|
|
<li><a href="#f_init">lib_init</a></li>
|
|
<li><a href="#f_create">NNP_Create</a></li>
|
|
<li><a href="#f_feedf">NNP_FeedForward</a></li>
|
|
<li><a href="#f_backp">NNP_BackPropagation</a></li>
|
|
<li><a href="#f_getmd">NNP_GetMemData</a></li>
|
|
<li><a href="#f_setmd">NNP_SetMemData</a></li>
|
|
<li><a href="#f_destroy">NNP_Destroy</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#const">Êîíñòàíòû</a></li>
|
|
<li><a href="#tabl_e">Òàáëèöà ýêñïîðòà</a></li>
|
|
<li><a href="#hist">Èñòîðèÿ</a></li>
|
|
</ul>
|
|
|
|
<h1>Âñòóïëåíèå</h1>
|
|
<p>Äîêóìåíòàöèÿ ê áèáëèîòåêå <b>nnp.obj</b>, äëÿ <b>ÎÑ Êîëèáðè</b>. Ýòà áèáëèîòåêà ñîçäàíà äëÿ ðàáîòû ñ íåéðîñåòÿìè (neural network perceptron). Âèäåî ïî íåéðîñåòÿì: <a href="https://www.youtube.com/watch?v=GNcGPw_Kb_0">1</a>,
|
|
<a href="https://www.youtube.com/watch?v=wzIOl4hWP3U">2</a>. Èñõîäíûé êîä (ÿçûê java), íà îñíîâå êîòîðîãî äåëàëñü áèáëèîòåêà: <a href="https://github.com/ArtemOnigiri/SimpleNN">3</a>.</p>
|
|
|
|
<p>Ïîñëåäíåå îáíîâëåíèå áèáëèîòåêè 01.03.22.</p>
|
|
|
|
<h1><a name="fun">Ôóíêöèè</a></h1>
|
|
|
|
<p>Âñå ôóíêöèè (êðîìå lib_init) 1-ì ïàðàìåòðîì ïðèíèìàþò óêàçàòåëü íà ñòðóêòóðó NeuralNetwork.
|
|
Îïèñàíèå ñòðóêòóðû NeuralNetwork:</p>
|
|
<pre>struct NeuralNetwork
|
|
learningRate dq ? ;+ 0 ñêîðîñòü îáó÷åíèÿ
|
|
layers dd ? ;+ 8 [] ñëîè
|
|
layers_length dd ? ;+12 ÷èñëî ñëîåâ
|
|
activation dd ? ;+16 óêàçàòåëü íà ôóíêöèþ àêòèâàöèè
|
|
derivative dd ? ;+20 óêàçàòåëü íà ôóíêöèþ
|
|
errors dd ? ;+24 ìàññèâ äëÿ âû÷èñëåíèé
|
|
errorsNext dd ? ;+28
|
|
gradients dd ? ;+32
|
|
deltas dd ? ;+36
|
|
ends</pre>
|
|
|
|
<h4><a name="f_init">lib_init</a></h4>
|
|
<p>Ýòà ôóíêöèÿ ïîëó÷àåò óêàçàòåëè íà ôóíêöèè ðàáîòû ñ ïàìÿòüþ, âûçûâàòñÿ äîëæíà ïðè çàãðóçêå áèáëèîòåêè. Ìîæåòå èñïîëüçîâàòü ìàêðîñ <b>@use_library</b>, äëÿ åå àâòîìàòè÷åñêîé íàñòðîéêè.</p>
|
|
|
|
<h4><a name="f_create">NNP_Create</a></h4>
|
|
<p>Ñîçäàåò ñëîè íåéðîñåòè è çàïîëíÿåò âåñà ñëó÷àéíûìè çíà÷åíèÿìè îò -1 äî 1. Ïðèìåð:</p>
|
|
<pre>NNLOPT_LEN equ 7
|
|
nnlopt dd 2,8,8,8,8,8,3
|
|
...
|
|
stdcall [NNP_Create], nnp_0, 0.01, 0, 0, nnlopt, NNLOPT_LEN</pre>
|
|
<p>ãäå nnp_0 - ñòðóêòóðà áóôåðà.</p>
|
|
<p>0.01 - ñêîðîñòü îáó÷åíèÿ.</p>
|
|
<p>0 - àäðåñ ôóíêöèè àêòèâàöèè, åñëè 0 òî áåðåòñÿ ñòàíäàðòíàÿ ôóíêöèÿ âíóòðè áèáëèîòåêè.</p>
|
|
<p>0 - àäðåñ ôóíêöèè ñâ¸ðòêè, åñëè 0 òî áåðåòñÿ ñòàíäàðòíàÿ ôóíêöèÿ âíóòðè áèáëèîòåêè.</p>
|
|
<p>nnlopt - ìàññèâ ñ ÷èñëîì íåéðîíîâ íà êàæäîì ñëîå.</p>
|
|
<p>NNLOPT_LEN - äëèííà ìàññèâà nnlopt.</p>
|
|
|
|
<h4><a name="f_feedf">NNP_FeedForward</a></h4>
|
|
<p>Ôóíêöèÿ ðàñ÷åòà çíà÷åíèé âûõîäíûõ íåéðîíîâ. Íà âõîä ïîäàþòüñÿ çíà÷åíèÿ âõîäíûõ íåéðîíîâ. Íà âûõîäå âîçâðàùàåòñÿ óêàçàòåëü íà ñëîé âûõîäíûõ íåéðîíîâ.</p>
|
|
<pre>n_input dq ?,?,?
|
|
...
|
|
stdcall [NNP_FeedForward], nnp_0,n_input</pre>
|
|
<p>ãäå nnp_0 - ñòðóêòóðà áóôåðà, n_input - óêàçàòåëü íà äàííûå âõîäíûõ íåéðîíîâ.</p>
|
|
|
|
<h4><a name="f_backp">NNP_BackPropagation</a></h4>
|
|
<p>Ôóíêöèÿ äëÿ îáó÷åíèÿ ñåòè. Ïðèìåð:</p>
|
|
<pre>n_targ dq ?,?,?
|
|
...
|
|
stdcall [NNP_BackPropagation], nnp_0, n_targ</pre>
|
|
<p>ãäå nnp_0 - ñòðóêòóðà áóôåðà, n_targ - óêàçàòåëü íà äàííûå äëÿ îáó÷åíèÿ ñåòè.</p>
|
|
|
|
<h4><a name="f_getmd">NNP_GetMemData</a></h4>
|
|
<p>Áåðåò äàííûå íåéðîñåòè è çàïèñûâàåò èõ â óêàçàííîå ìåñòî â ïàìÿòè. Ïðèìåð:</p>
|
|
<pre>f_data dd ?
|
|
...
|
|
stdcall [NNP_GetMemData], nnp_0, NNP_FF_JSON, [f_data]</pre>
|
|
<p>ãäå nnp_0 - ñòðóêòóðà áóôåðà, f_data - óêàçàòåëü íà äàííûå äëÿ çàïèñè ïàðàìåòðîâ ñåòè.</p>
|
|
|
|
<h4><a name="f_setmd">NNP_SetMemData</a></h4>
|
|
<p>Áåðåò äàííûå èç óêàçàííîãî ìåñòà ïàìÿòè è çàïèñûâàåò èõ â íåéðîñåòü. Ïðèìåð:</p>
|
|
<pre>f_data dd ?
|
|
...
|
|
stdcall [NNP_SetMemData], nnp_0, NNP_FF_JSON, [f_data]</pre>
|
|
<p>ãäå nnp_0 - ñòðóêòóðà áóôåðà, f_data - óêàçàòåëü íà äàííûå ñ ïàðàìåòðàìè ñåòè.</p>
|
|
|
|
<h4><a name="f_delete">NNP_Destroy</a></h4>
|
|
<p>Îñâîáîæäàåò ïàìÿòü çàíÿòóþ íåéðîñåòüþ.</p>
|
|
|
|
<h1><a name="const">Êîíñòàíòû</a></h1>
|
|
<h4>NNP_FF_BIN equ 0x6e6962</h4>
|
|
<p>Êîíñòàíòà äëÿ ôóíêöèé NNP_GetMemData è NNP_SetMemData. Óêàçûâàåò áèíàðíûé ôîðìàò ââîäà è âûâîäà äàííûõ.</p>
|
|
<h4>NNP_FF_JSON equ 0x6e6f736a</h4>
|
|
<p>Êîíñòàíòà äëÿ ôóíêöèé NNP_GetMemData è NNP_SetMemData. Óêàçûâàåò òåêñòîâûé (JSON) ôîðìàò ââîäà è âûâîäà äàííûõ.</p>
|
|
|
|
<h1><a name="tabl_e">Òàáëèöà ýêñïîðòà</a></h1>
|
|
<p>Ïðèìåð òàáëèöû ýêñïîðòà, ðàñ÷èòàííîé íà èñïîëüçîâàíèå ìàêðîñà <b>@use_library_mem</b>:</p>
|
|
<pre>align 4
|
|
import_nnp_lib:
|
|
dd sz_lib_init
|
|
NNP_Create dd sz_nnp_create
|
|
NNP_FeedForward dd sz_nnp_FeedForward
|
|
NNP_BackPropagation dd sz_nnp_BackPropagation
|
|
NNP_GetMemData dd sz_nnp_GetMemData
|
|
NNP_SetMemData dd sz_nnp_SetMemData
|
|
NNP_Destroy dd sz_nnp_Destroy
|
|
dd 0,0
|
|
sz_lib_init db 'lib_init',0
|
|
sz_nnp_create db 'NNP_Create',0
|
|
sz_nnp_FeedForward db 'NNP_FeedForward',0
|
|
sz_nnp_BackPropagation db 'NNP_BackPropagation',0
|
|
sz_nnp_GetMemData db 'NNP_GetMemData',0
|
|
sz_nnp_SetMemData db 'NNP_SetMemData',0
|
|
sz_nnp_Destroy db 'NNP_Destroy',0
|
|
</pre>
|
|
|
|
<h1><a name="hist">Èñòîðèÿ</a></h1>
|
|
<p>01.03.22 - ñàìàÿ ïåðâàÿ âåðñèÿ áèáëèîòåêè (ïðèìåðû èñïîëüçîâàíèÿ âîçìîæíî áóäóò ïîçæå).</p>
|
|
|
|
</body>
|
|
</html> |