{"id":322709,"date":"2021-05-06T21:00:34","date_gmt":"2021-05-06T21:00:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=322709"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=322709","title":{"rendered":"\u041d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0441 \u043d\u0443\u043b\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438. \u0427\u0430\u0441\u0442\u044c 3. Sad Or Happy?"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/post\/556180\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0432 \u0432\u0438\u0434\u0435 JS \u043a\u043b\u0430\u0441\u0441\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u0430\u0442\u044c \u0435\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435. \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043c\u0430\u0439\u043b, \u0430 \u043d\u0430\u0448\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0439 \u043e\u043d \u0438\u043b\u0438 \u0432\u0435\u0441\u0435\u043b\u044b\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0430\u0448\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0430 \u0432\u0435\u0440\u0441\u0442\u043a\u0430 \u0438 \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u043d\u0430\u0448\u0435\u0439 \u0442\u0435\u043c\u044b, \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u043d\u0430 \u043d\u0435\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438.<\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; &lt;html lang=\"en\"&gt; &lt;head&gt;  &lt;meta charset=\"UTF-8\"&gt;  &lt;meta name=\"viewport\"        content=\"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\"&gt;  &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"&gt;  &lt;script src=\"NeuralNetwork.js\"&gt;&lt;\/script&gt;  &lt;title&gt;Sad Or Happy?&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;  &lt;div id=\"wrapper\"&gt;    &lt;canvas width=\"400\" height=\"400\" id=\"paintField\"&gt;&lt;\/canvas&gt;    &lt;div id=\"controls\"&gt;      &lt;button class=\"control\" id=\"happy\"&gt;&lt;\/button&gt;      &lt;button class=\"control\" id=\"sad\"&gt;&lt;\/button&gt;      &lt;button class=\"control\" id=\"clear\"&gt;        Clear      &lt;\/button&gt;      &lt;button class=\"control\" id=\"train\"&gt;        Train      &lt;\/button&gt;      &lt;button class=\"control\" disabled id=\"predict\"&gt;        Predict      &lt;\/button&gt;    &lt;\/div&gt;  &lt;\/div&gt; &lt;\/body&gt;  &lt;style&gt;    #wrapper {        width: 400px;        margin: 0 auto;    }     #paintField {        height: 400px;        width: 100%;        border: 1px solid black;    }     #controls {        display: grid;        grid-gap: 10px;        grid-template-columns: 1fr 1fr;        margin-top: 30px;    }     #clear, #train, #predict {        grid-column: 1 \/ -1;    }     .control {        font-size: 20px;        padding: 4px;        cursor: pointer;    } &lt;\/style&gt;  &lt;script&gt;  &lt;\/script&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>\u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>Canvas \u0441 id <strong>paintField <\/strong>&#8212; \u044d\u0442\u043e \u043a\u0430\u043d\u0432\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 10 \u043d\u0430 10 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e 40 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u043a\u0430\u0436\u0434\u044b\u0439. \u041d\u0430 \u043d\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b\u0448\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0430\u0439\u043b \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043e\u0442 \u043d\u0435\u0435.<\/p>\n<p>\u041a\u043d\u043e\u043f\u043a\u0438 \u0441 id <strong>happy <\/strong>\u0438 <strong>sad <\/strong>\u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b \u0441\u043c\u0430\u0439\u043b, \u043d\u0430\u0436\u0430\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443, \u0441\u0435\u0442\u044c \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b\u0430 \u0438 \u0441\u0442\u0430\u043b\u0430 \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u0443\u043c\u043d\u0435\u0435.<\/p>\n<p>\u041a\u043d\u043e\u043f\u043a\u0430 <strong>Clear <\/strong>\u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u0432\u0432\u043e\u0434\u0430. \u0412\u0434\u0440\u0443\u0433 \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438.<\/p>\n<p>\u041a\u043d\u043e\u043f\u043a\u0430 <strong>Train <\/strong>\u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043a\u043d\u043e\u043f\u043a\u0430 <strong>Predict <\/strong>\u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u0434\u0443\u043c\u0430\u0435\u0442 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0438\u0441\u0443\u043d\u043a\u0430. \u041e\u043d\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0443\u0441\u0442\u043e\u0439 \u0442\u0435\u0433 &lt;script&gt; \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u0435\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c.<\/p>\n<pre><code class=\"javascript\">const canvas = document.querySelector('#paintField'); const clearBtn = document.querySelector('#clear'); const sadBtn = document.querySelector('#sad'); const happyBtn = document.querySelector('#happy'); const trainBtn = document.querySelector('#train'); const predictBtn = document.querySelector('#predict'); const ctx = canvas.getContext('2d'); const paintField = new Array(100); const trainData = []; const NN = new Network(100, 2); let mouseDown = false; let happyCount = 0; let sadCount = 0;  NN.learningRate = 0.8;<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0438\u043c \u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0439:<\/p>\n<p><strong>paintField <\/strong>&#8212; \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0438\u0441\u0443\u043d\u043a\u0430. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0431\u043b\u043e\u043a\u043e\u0432 \u043d\u0430 \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u043d\u0432\u0435.<\/p>\n<p><strong>trainData <\/strong>&#8212; \u0441\u044e\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0438.<\/p>\n<p><strong>NN <\/strong>&#8212; \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0448\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c. \u0423 \u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 100 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435 &#8212; \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 paintField \u0438 2 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435. \u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043d\u0430\u043c \u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0441\u043c\u0430\u0439\u043b, \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u0447\u0442\u043e \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0439.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u043c\u044b\u0448\u0438, \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0442\u043e\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a\u0438\u0445 \u043a\u0435\u0439\u0441\u043e\u0432 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0434\u0430\u0435\u043c learningRate \u0441\u0435\u0442\u0438 \u043f\u043e\u0432\u044b\u0448\u0435 \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043b\u0438\u043b\u043e\u0441\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u043e.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<pre><code class=\"javascript\">function drawGrid() {  ctx.strokeStyle = '#CCC'   for (let i = 1; i &lt; 10; i++) {    ctx.moveTo(0, i * 40);    ctx.lineTo(400, i * 40);    ctx.moveTo(i * 40, 0);    ctx.lineTo(i * 40, 400);  }   ctx.stroke(); }  function clearCanvas() {  ctx.fillStyle = '#FFF';  ctx.fillRect(0, 0, 400, 400);  drawGrid(); }  function drawSquare(row, column, color) {  ctx.fillStyle = color;  ctx.fillRect(column * 40 + 1, row * 40 + 1, 38, 38); }  function draw(event) {  const rowIndex = Math.floor(event.offsetY \/ 40);  const columnIndex = Math.floor(event.offsetX \/ 40);  const arrayIndex = rowIndex * 10 + columnIndex;  paintField[arrayIndex] = 1;  const color = paintField[arrayIndex] ? 'green' : 'white';  drawSquare(rowIndex, columnIndex, color); }  function clearField() {  paintField.fill(false);  clearCanvas(ctx) }  function updateInterface() {  happyBtn.innerText = `=) ${happyCount}`;  sadBtn.innerText = `=( ${sadCount}`; }  function storeResult(value) {  trainData.push([[...paintField], value]);  updateInterface() }<\/code><\/pre>\n<p><strong>drawGrid <\/strong>&#8212; \u0440\u0438\u0441\u0443\u0435\u0442 \u0441\u0435\u0442\u043a\u0443 \u043d\u0430 \u043a\u0430\u043d\u0432\u0435.<\/p>\n<p><strong>clearCanvas <\/strong>&#8212; \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u043a\u0430\u043d\u0432\u0443 \u043e\u0442 \u043d\u0430\u0448\u0438\u0445 \u0445\u0443\u0434\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<p><strong>drawSquare <\/strong>&#8212; \u0440\u0438\u0441\u0443\u0435\u0442 \u0446\u0432\u0435\u0442\u043d\u043e\u0439 \u0431\u043b\u043e\u043a \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u0441\u0435\u0442\u043a\u0438.<\/p>\n<p><strong>draw <\/strong>&#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043c\u044b\u0448\u0438. \u041e\u043d\u0430 \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u043d\u043e\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430, \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u043f\u043e\u0434 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c, \u0438 \u043f\u043e\u043a\u0440\u0430\u0441\u0438\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u0432 \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0446\u0432\u0435\u0442.<\/p>\n<p>clearField &#8212; \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043a\u0430\u043d\u0432\u0443.<\/p>\n<p><strong>updateInterface <\/strong>&#8212; \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430\u0445, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0435\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0445 \u0438 \u0432\u0435\u0441\u0435\u043b\u044b\u0445 \u0441\u043c\u0430\u0439\u043b\u043e\u0432 \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u043d\u0430\u0448\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438.<\/p>\n<p><strong>storeResult <\/strong>&#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430\u0432\u0435\u0441\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"javascript\">document.addEventListener('mousedown', (e) =&gt; {  mouseDown = true; });  document.addEventListener('mouseup', (e) =&gt; {  mouseDown = false; });  canvas.addEventListener('mousemove', (e) =&gt; {  if (!mouseDown) {    return;  }  draw(e); });  clearBtn.addEventListener('click', () =&gt; {  clearField(); });  happyBtn.addEventListener('click', () =&gt; {  happyCount += 1;  storeResult([1, 0]);  clearField(); });  sadBtn.addEventListener('click', () =&gt; {  sadCount += 1;  storeResult([0, 1]);  clearField(); });  predictBtn.addEventListener('click', () =&gt; {  NN.input = [...paintField];  const [happiness, sadness] = NN.prediction;  alert(`I think it's a ${happiness &gt; sadness ? 'happy' : 'sad'} face!\\n   Happiness: ${Math.round(happiness * 100)}% Sadness: ${Math.round(sadness * 100)}%`); });  trainBtn.addEventListener('click', () =&gt; {  NN.train(trainData, 1000).then(() =&gt; {    predictBtn.disabled = false;    alert('Trained!');  }) });  clearField(); updateInterface();<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u0447\u043d\u043e \u0432\u0441\u0435. \u041c\u043e\u0436\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438 \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0439 \u0438\u043b\u0438 \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0441\u043c\u0430\u0439\u043b, \u043d\u0430\u0436\u0430\u043b\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443, \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043b\u0438. \u0421\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0435\u0439\u0441\u043e\u0432, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0438\u0445 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u043e &#8212; \u0442\u0430\u043a \u0441\u0435\u0442\u044c \u043d\u0438\u0447\u0435\u043c\u0443 \u043d\u0435 \u043d\u0430\u0443\u0447\u0438\u0442\u0441\u044f, \u0438 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e &#8212; \u0442\u0430\u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u043e. \u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0448\u0438\u0442\u0435 \u0447\u0442\u043e \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0436\u043c\u0438\u0442\u0435 Train \u0438 \u043e\u0436\u0438\u0434\u0430\u0439\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u041f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c? \u0412\u0441\u0435! \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0430 \u0441\u0435\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0430\u0439\u043b \u0438 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0430 \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u0445\u043e\u0436 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043d\u043e\u043f\u043a\u0438 Predict.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c8f\/4a8\/675\/c8f4a8675a15842484a78d81ae5b5cda.jpg\" width=\"553\" height=\"640\"><figcaption><\/figcaption><\/figure>\n<h2>That\u2019s all, Folks!  <\/h2>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448\u0435 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u043a\u043e\u043d\u0446\u0443. \u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0435\u0435 \u0432 \u0434\u0435\u043b\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438 \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0421 \u043a\u0440\u0438\u0442\u0438\u043a\u043e\u0439 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0432\u0430\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0434\u0435\u043b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e <a href=\"https:\/\/andboh.github.io\/sad-or-happy\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435 <\/a><\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/AndBoh\/sad-or-happy\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438  <\/a><\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/556188\/\"> https:\/\/habr.com\/ru\/post\/556188\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/post\/556180\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0432 \u0432\u0438\u0434\u0435 JS \u043a\u043b\u0430\u0441\u0441\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u0430\u0442\u044c \u0435\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435. \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043c\u0430\u0439\u043b, \u0430 \u043d\u0430\u0448\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0439 \u043e\u043d \u0438\u043b\u0438 \u0432\u0435\u0441\u0435\u043b\u044b\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0430\u0448\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0430 \u0432\u0435\u0440\u0441\u0442\u043a\u0430 \u0438 \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u043d\u0430\u0448\u0435\u0439 \u0442\u0435\u043c\u044b, \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u043d\u0430 \u043d\u0435\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438.<\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; &lt;html lang=\"en\"&gt; &lt;head&gt;  &lt;meta charset=\"UTF-8\"&gt;  &lt;meta name=\"viewport\"        content=\"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\"&gt;  &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"&gt;  &lt;script src=\"NeuralNetwork.js\"&gt;&lt;\/script&gt;  &lt;title&gt;Sad Or Happy?&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;  &lt;div id=\"wrapper\"&gt;    &lt;canvas width=\"400\" height=\"400\" id=\"paintField\"&gt;&lt;\/canvas&gt;    &lt;div id=\"controls\"&gt;      &lt;button class=\"control\" id=\"happy\"&gt;&lt;\/button&gt;      &lt;button class=\"control\" id=\"sad\"&gt;&lt;\/button&gt;      &lt;button class=\"control\" id=\"clear\"&gt;        Clear      &lt;\/button&gt;      &lt;button class=\"control\" id=\"train\"&gt;        Train      &lt;\/button&gt;      &lt;button class=\"control\" disabled id=\"predict\"&gt;        Predict      &lt;\/button&gt;    &lt;\/div&gt;  &lt;\/div&gt; &lt;\/body&gt;  &lt;style&gt;    #wrapper {        width: 400px;        margin: 0 auto;    }     #paintField {        height: 400px;        width: 100%;        border: 1px solid black;    }     #controls {        display: grid;        grid-gap: 10px;        grid-template-columns: 1fr 1fr;        margin-top: 30px;    }     #clear, #train, #predict {        grid-column: 1 \/ -1;    }     .control {        font-size: 20px;        padding: 4px;        cursor: pointer;    } &lt;\/style&gt;  &lt;script&gt;  &lt;\/script&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>\u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>Canvas \u0441 id <strong>paintField <\/strong>&#8212; \u044d\u0442\u043e \u043a\u0430\u043d\u0432\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 10 \u043d\u0430 10 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u043e 40 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u043a\u0430\u0436\u0434\u044b\u0439. \u041d\u0430 \u043d\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b\u0448\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0430\u0439\u043b \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043e\u0442 \u043d\u0435\u0435.<\/p>\n<p>\u041a\u043d\u043e\u043f\u043a\u0438 \u0441 id <strong>happy <\/strong>\u0438 <strong>sad <\/strong>\u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b \u0441\u043c\u0430\u0439\u043b, \u043d\u0430\u0436\u0430\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443, \u0441\u0435\u0442\u044c \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b\u0430 \u0438 \u0441\u0442\u0430\u043b\u0430 \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u0443\u043c\u043d\u0435\u0435.<\/p>\n<p>\u041a\u043d\u043e\u043f\u043a\u0430 <strong>Clear <\/strong>\u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u0432\u0432\u043e\u0434\u0430. \u0412\u0434\u0440\u0443\u0433 \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438.<\/p>\n<p>\u041a\u043d\u043e\u043f\u043a\u0430 <strong>Train <\/strong>\u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043a\u043d\u043e\u043f\u043a\u0430 <strong>Predict <\/strong>\u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u0434\u0443\u043c\u0430\u0435\u0442 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0438\u0441\u0443\u043d\u043a\u0430. \u041e\u043d\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0443\u0441\u0442\u043e\u0439 \u0442\u0435\u0433 &lt;script&gt; \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u0435\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c.<\/p>\n<pre><code class=\"javascript\">const canvas = document.querySelector('#paintField'); const clearBtn = document.querySelector('#clear'); const sadBtn = document.querySelector('#sad'); const happyBtn = document.querySelector('#happy'); const trainBtn = document.querySelector('#train'); const predictBtn = document.querySelector('#predict'); const ctx = canvas.getContext('2d'); const paintField = new Array(100); const trainData = []; const NN = new Network(100, 2); let mouseDown = false; let happyCount = 0; let sadCount = 0;  NN.learningRate = 0.8;<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0438\u043c \u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0439:<\/p>\n<p><strong>paintField <\/strong>&#8212; \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0438\u0441\u0443\u043d\u043a\u0430. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0431\u043b\u043e\u043a\u043e\u0432 \u043d\u0430 \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u043d\u0432\u0435.<\/p>\n<p><strong>trainData <\/strong>&#8212; \u0441\u044e\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0438.<\/p>\n<p><strong>NN <\/strong>&#8212; \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0448\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c. \u0423 \u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 100 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435 &#8212; \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 paintField \u0438 2 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435. \u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043d\u0430\u043c \u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0441\u043c\u0430\u0439\u043b, \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u0447\u0442\u043e \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0439.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u043c\u044b\u0448\u0438, \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0442\u043e\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a\u0438\u0445 \u043a\u0435\u0439\u0441\u043e\u0432 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0434\u0430\u0435\u043c learningRate \u0441\u0435\u0442\u0438 \u043f\u043e\u0432\u044b\u0448\u0435 \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043b\u0438\u043b\u043e\u0441\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u043e.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<pre><code class=\"javascript\">function drawGrid() {  ctx.strokeStyle = '#CCC'   for (let i = 1; i &lt; 10; i++) {    ctx.moveTo(0, i * 40);    ctx.lineTo(400, i * 40);    ctx.moveTo(i * 40, 0);    ctx.lineTo(i * 40, 400);  }   ctx.stroke(); }  function clearCanvas() {  ctx.fillStyle = '#FFF';  ctx.fillRect(0, 0, 400, 400);  drawGrid(); }  function drawSquare(row, column, color) {  ctx.fillStyle = color;  ctx.fillRect(column * 40 + 1, row * 40 + 1, 38, 38); }  function draw(event) {  const rowIndex = Math.floor(event.offsetY \/ 40);  const columnIndex = Math.floor(event.offsetX \/ 40);  const arrayIndex = rowIndex * 10 + columnIndex;  paintField[arrayIndex] = 1;  const color = paintField[arrayIndex] ? 'green' : 'white';  drawSquare(rowIndex, columnIndex, color); }  function clearField() {  paintField.fill(false);  clearCanvas(ctx) }  function updateInterface() {  happyBtn.innerText = `=) ${happyCount}`;  sadBtn.innerText = `=( ${sadCount}`; }  function storeResult(value) {  trainData.push([[...paintField], value]);  updateInterface() }<\/code><\/pre>\n<p><strong>drawGrid <\/strong>&#8212; \u0440\u0438\u0441\u0443\u0435\u0442 \u0441\u0435\u0442\u043a\u0443 \u043d\u0430 \u043a\u0430\u043d\u0432\u0435.<\/p>\n<p><strong>clearCanvas <\/strong>&#8212; \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u043a\u0430\u043d\u0432\u0443 \u043e\u0442 \u043d\u0430\u0448\u0438\u0445 \u0445\u0443\u0434\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<p><strong>drawSquare <\/strong>&#8212; \u0440\u0438\u0441\u0443\u0435\u0442 \u0446\u0432\u0435\u0442\u043d\u043e\u0439 \u0431\u043b\u043e\u043a \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u0441\u0435\u0442\u043a\u0438.<\/p>\n<p><strong>draw <\/strong>&#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043c\u044b\u0448\u0438. \u041e\u043d\u0430 \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u043d\u043e\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430, \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u043f\u043e\u0434 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c, \u0438 \u043f\u043e\u043a\u0440\u0430\u0441\u0438\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u0432 \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0446\u0432\u0435\u0442.<\/p>\n<p>clearField &#8212; \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043a\u0430\u043d\u0432\u0443.<\/p>\n<p><strong>updateInterface <\/strong>&#8212; \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430\u0445, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0435\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0445 \u0438 \u0432\u0435\u0441\u0435\u043b\u044b\u0445 \u0441\u043c\u0430\u0439\u043b\u043e\u0432 \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u043d\u0430\u0448\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438.<\/p>\n<p><strong>storeResult <\/strong>&#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430\u0432\u0435\u0441\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"javascript\">document.addEventListener('mousedown', (e) =&gt; {  mouseDown = true; });  document.addEventListener('mouseup', (e) =&gt; {  mouseDown = false; });  canvas.addEventListener('mousemove', (e) =&gt; {  if (!mouseDown) {    return;  }  draw(e); });  clearBtn.addEventListener('click', () =&gt; {  clearField(); });  happyBtn.addEventListener('click', () =&gt; {  happyCount += 1;  storeResult([1, 0]);  clearField(); });  sadBtn.addEventListener('click', () =&gt; {  sadCount += 1;  storeResult([0, 1]);  clearField(); });  predictBtn.addEventListener('click', () =&gt; {  NN.input = [...paintField];  const [happiness, sadness] = NN.prediction;  alert(`I think it's a ${happiness &gt; sadness ? 'happy' : 'sad'} face!\\n   Happiness: ${Math.round(happiness * 100)}% Sadness: ${Math.round(sadness * 100)}%`); });  trainBtn.addEventListener('click', () =&gt; {  NN.train(trainData, 1000).then(() =&gt; {    predictBtn.disabled = false;    alert('Trained!');  }) });  clearField(); updateInterface();<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u0447\u043d\u043e \u0432\u0441\u0435. \u041c\u043e\u0436\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438 \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0439 \u0438\u043b\u0438 \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0441\u043c\u0430\u0439\u043b, \u043d\u0430\u0436\u0430\u043b\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443, \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043b\u0438. \u0421\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0435\u0439\u0441\u043e\u0432, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0438\u0445 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u043e &#8212; \u0442\u0430\u043a \u0441\u0435\u0442\u044c \u043d\u0438\u0447\u0435\u043c\u0443 \u043d\u0435 \u043d\u0430\u0443\u0447\u0438\u0442\u0441\u044f, \u0438 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e &#8212; \u0442\u0430\u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u043e. \u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0448\u0438\u0442\u0435 \u0447\u0442\u043e \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0436\u043c\u0438\u0442\u0435 Train \u0438 \u043e\u0436\u0438\u0434\u0430\u0439\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u041f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c? \u0412\u0441\u0435! \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0430 \u0441\u0435\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0430\u0439\u043b \u0438 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0430 \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u0445\u043e\u0436 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043d\u043e\u043f\u043a\u0438 Predict.  <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>That\u2019s all, Folks!  <\/h2>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448\u0435 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u043a\u043e\u043d\u0446\u0443. \u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0435\u0435 \u0432 \u0434\u0435\u043b\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438 \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0421 \u043a\u0440\u0438\u0442\u0438\u043a\u043e\u0439 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0432\u0430\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0434\u0435\u043b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e <a href=\"https:\/\/andboh.github.io\/sad-or-happy\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435 <\/a><\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/AndBoh\/sad-or-happy\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438  <\/a><\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/556188\/\"> https:\/\/habr.com\/ru\/post\/556188\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-322709","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=322709"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322709\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}