{"id":295939,"date":"2019-12-17T16:32:19","date_gmt":"2019-12-17T16:32:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=295939"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=295939","title":{"rendered":"\u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u2014 7 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 JavaScript \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0445, \u043a\u0430\u043a \u043c\u0430\u0448\u0438\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u00ab\u0443\u0447\u0438\u0442\u044c\u0441\u044f\u00bb"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/479220\/\">\n<p><a href=\"https:\/\/github.com\/trekhleb\/nano-neuron\" rel=\"nofollow\"><strong>\u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d<\/strong><\/a> \u2014 \u044d\u0442\u043e <em>\u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f<\/em> \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438\u0437 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0438\u0437 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 <a href=\"https:\/\/github.com\/trekhleb\/nano-neuron\/blob\/master\/NanoNeuron.js\" rel=\"nofollow\"><strong>NanoNeuron.js<\/strong><\/a> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 7 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 JavaScript \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435, \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435, \u043f\u0440\u044f\u043c\u043e\u0435 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043c\u043e\u0434\u0435\u043b\u0438. \u0426\u0435\u043b\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u044b\u043b\u043e \u0434\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435, \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 (\u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e) \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0436\u0435 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043c\u0430\u0448\u0438\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u00ab\u043e\u0431\u0443\u0447\u0430\u0442\u044c\u0441\u044f\u00bb. \u0412 \u043a\u043e\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041a\u0430\u043a-\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u00abvanilla\u00bb JavaScript \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438 <strong>\u043d\u0438 \u0432 \u043a\u043e\u0435\u0439 \u043c\u0435\u0440\u0435<\/strong> \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e. \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0438\u0445 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e \u0438\u043b\u0438 \u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043e! \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043e \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u2014 \u0434\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0441\u0430\u043c\u043e\u0435 <strong>\u0431\u0430\u0437\u043e\u0432\u043e\u0435<\/strong> \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u0430\u0448\u0438\u043d\u0430 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u0435\u0442 \u00ab\u0443\u0447\u0438\u0442\u044c\u0441\u044f\u00bb, \u0447\u0442\u043e\u0431\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u00ab\u041c\u0410\u0413\u0418\u042f \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f\u00bb \u0437\u0432\u0443\u0447\u0430\u043b\u0430 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u043a\u0430\u043a \u00ab\u041c\u0410\u0422\u0415\u041c\u0410\u0422\u0418\u041a\u0410 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f\u00bb.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/98d\/6c4\/69e\/98d6c469e1facbf97154fe29f698cd12.png\" alt=\"NanoNeuron\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"chto-vyuchit-nash-nano-neyron\">\u0427\u0442\u043e \u00ab\u0432\u044b\u0443\u0447\u0438\u0442\u00bb \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d<\/h2>\n<p>  <\/p>\n<p>\u0412\u044b, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430\u0445 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%98%D1%81%D0%BA%D1%83%D1%81%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%B0%D1%8F_%D0%BD%D0%B5%D0%B9%D1%80%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D1%81%D0%B5%D1%82%D1%8C\" rel=\"nofollow\">\u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439<\/a>. \u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0442\u043e\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441 \u043d\u0443\u043b\u044f. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0435\u0442\u044c \u0438\u0437 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432. \u041c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0438\u0437 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c \u0435\u0433\u043e <strong>\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c<\/strong> \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0426\u0435\u043b\u044c\u0441\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9fa\/2e8\/8b5\/9fa2e88b5a7324c8b9fc359b274ba091.png\" alt=\"Celsius to Fahrenheit\"><\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0431 \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442&#8230;<\/p>\n<p>  <\/p>\n<h3 id=\"model-nano-neyrona\">\u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 <code>x<\/code> \u0438 <code>y<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <code>y = w * x + b<\/code>. \u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u2014 \u044d\u0442\u043e \u0440\u0435\u0431\u0435\u043d\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 <code>XY<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <code>w<\/code> \u0438 <code>b<\/code> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <strong>\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438<\/strong> \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u0437\u043d\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u042d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a-\u0440\u0430\u0437 \u0438 \u0435\u0441\u0442\u044c \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 (\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f).<\/p>\n<p>  <\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0449\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u0414\u0435\u043b\u0430\u0435\u0442 \u043e\u043d \u044d\u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>predict()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>x<\/code> \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>y<\/code> \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435. \u041d\u0438\u043a\u0430\u043a\u043e\u0439 \u043c\u0430\u0433\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function NanoNeuron(w, b) {   this.w = w;   this.b = b;   this.predict = (x) =&gt; {     return x * this.w + this.b;   } }<\/code><\/pre>\n<p>  <\/p>\n<p>_(\u2026 \u043f\u043e\u0441\u0442\u043e\u0439\u2026 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Linear_regression\" rel=\"nofollow\">\u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f<\/a> \u044d\u0442\u043e \u0442\u044b, \u0447\u0442\u043e \u043b\u0438?)_<\/p>\n<p>  <\/p>\n<h3 id=\"konvertaciya-gradusov-celsiya-v-gradusy-farengeyta\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435: <code>f = 1.8 * c + 32<\/code>, \u0433\u0434\u0435 <code>c<\/code> \u2014 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0438 <code>f<\/code> \u2014 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function celsiusToFahrenheit(c) {   const w = 1.8;   const b = 32;   const f = c * w + b;   return f; };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u0441\u043c\u043e\u0433 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u0430\u043c \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f (\u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f), \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>w = 1.8<\/code> \u0438 <code>b = 32<\/code> \u043d\u0435 \u0437\u043d\u0430\u044f \u043e\u0431 \u044d\u0442\u043e\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u0435\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u00ab\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c\u00bb \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0439 \u00ab\u043c\u0430\u043b\u044b\u0448\u00bb: <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/68b\/0d6\/8bc\/68b0d68bcc7be00ec9526867b2fcecf3.png\" alt=\"Celsius to Fahrenheit conversion\"><\/p>\n<p>  <\/p>\n<h3 id=\"generirovanie-dannyh\">\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 (<code>x<\/code>) \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>w<\/code> \u0438 <code>b<\/code>), \u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (<code>y<\/code>). \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0412 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0436\u0435 \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u043b\u0438\u0448\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (<code>x<\/code> \u0438 <code>y<\/code>), \u0430 \u0432\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043e\u0442 <code>x<\/code> \u043a <code>y<\/code> \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>w<\/code> \u0438 <code>b<\/code>).<\/p>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f <strong>\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/strong> \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f <strong>\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/strong> \u043c\u043e\u0434\u0435\u043b\u0438. \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a <code>celsiusToFahrenheit()<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440 <code>x<\/code> \u0438 <code>y<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 <code>x = 2<\/code>, \u0442\u043e <code>y = 35,6<\/code> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  <\/p>\n<blockquote><p>\u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u043e\u0440\u0435\u0435-\u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0442 <em>\u0441\u043e\u0431\u0440\u0430\u043d\u044b<\/em>, \u0430 \u043d\u0435 <em>c\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b<\/em>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u043c\u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0440 \u00ab\u0444\u043e\u0442\u043e \u043b\u0438\u0446\u0430\u00bb &#8212;&gt; \u00ab\u0438\u043c\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430\u00bb.<\/p><\/blockquote>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0422\u0420\u0415\u041d\u0418\u0420\u041e\u0412\u041e\u0427\u041d\u042b\u0419 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0442\u043e\u0442 \u0432\u044b\u0440\u0430\u0441\u0442\u0435\u0442 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u00ab\u043f\u0440\u0430\u0432\u0434\u043e\u0439\u00bb, \u0430 \u0447\u0442\u043e \u00ab\u043b\u043e\u0436\u044c\u044e\u00bb \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u00ab\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435\u00bb \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430.<\/p>\n<p>  <\/p>\n<blockquote><p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0442\u0443\u0442 \u044f\u0432\u043d\u043e \u043f\u0440\u043e\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u00ab\u043c\u0443\u0441\u043e\u0440 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u2014 \u043c\u0443\u0441\u043e\u0440 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435\u00bb. \u0415\u0441\u043b\u0438 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0447\u0438\u043a\u0443 \u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u043e\u0434\u043a\u0438\u043d\u0443\u0442\u044c \u00ab\u043b\u043e\u0436\u044c\u00bb, \u0447\u0442\u043e 5\u00b0C \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 1000\u00b0F, \u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u043d\u043e\u0433\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u043d \u0441\u0442\u0430\u043d\u0435\u0442 \u044d\u0442\u043e\u043c\u0443 \u0432\u0435\u0440\u0438\u0442\u044c \u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b <strong>\u043a\u0440\u043e\u043c\u0435<\/strong> 5\u00b0C. \u041d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c\u0438 \u0441 \u0442\u0435\u043c\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0437\u0433\u043e\u0432\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u043e\u0447\u043a\u0435.<\/p><\/blockquote>\n<p>\u041e\u0442\u0432\u043b\u0435\u043a\u0441\u044f. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0422\u0415\u0421\u0422\u041e\u0412\u042b\u0419 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0431\u0443\u0447\u0438\u043b\u0441\u044f \u0438 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d \u043d\u0435 \u0432\u0438\u0434\u0435\u043b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function generateDataSets() {   \/\/ xTrain -&gt; [0, 1, 2, ...],   \/\/ yTrain -&gt; [32, 33.8, 35.6, ...]   const xTrain = [];   const yTrain = [];   for (let x = 0; x &lt; 100; x += 1) {     const y = celsiusToFahrenheit(x);     xTrain.push(x);     yTrain.push(y);   }    \/\/ xTest -&gt; [0.5, 1.5, 2.5, ...]   \/\/ yTest -&gt; [32.9, 34.7, 36.5, ...]   const xTest = [];   const yTest = [];   \/\/ \u041d\u0430\u0447\u0430\u0432 \u0441 0.5 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0448\u0430\u0433 1, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430    \/\/ \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f.   for (let x = 0.5; x &lt; 100; x += 1) {     const y = celsiusToFahrenheit(x);     xTest.push(x);     yTest.push(y);   }    return [xTrain, yTrain, xTest, yTest]; }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ocenka-pogreshnosti-predskazaniy\">\u041e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 (\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435, \u0447\u0438\u0441\u043b\u043e, \u043e\u0446\u0435\u043d\u043a\u0430), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u0438\u0437\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u043a \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u043c\u0443. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e\/\u043c\u0435\u0442\u0440\u0438\u043a\u0430\/\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043f\u0440\u0430\u0432 \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432. \u042d\u0442\u043e \u043a\u0430\u043a \u0432 \u0448\u043a\u043e\u043b\u0435, \u0443\u0447\u0435\u043d\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0437\u0430 \u0441\u0432\u043e\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443 <code>5<\/code> \u0438\u043b\u0438 <code>2<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u043e\u043c \u0435\u0433\u043e \u043e\u0448\u0438\u0431\u043a\u0430 (\u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c) \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <code>y<\/code> \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <code>prediction<\/code> \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8d8\/e50\/ac1\/8d8e50ac12d03614e65975f7b5d36931.png\" alt=\"Prediction Cost\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0427\u0435\u043c \u0431\u043b\u0438\u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443, \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u044d\u0442\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0437\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0437\u043d\u0430\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 <code>(1 - 2) ^ 2<\/code> \u0431\u044b\u043b\u043e \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e <code>(2 - 1) ^ 2<\/code>. \u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 <code>2<\/code> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 (\u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435).<\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function predictionCost(y, prediction) {   return (y - prediction) ** 2 \/ 2; \/\/ i.e. -&gt; 235.6 }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"pryamoe-rasprostranenie-signala\">\u041f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0430\u0440 \u0438\u0437 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 <code>xTrain<\/code> \u0438 <code>yTrain<\/code> \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u043e\u0448\u0438\u0431\u043a\u0443 (\u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c) \u044d\u0442\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u0434\u0430\u0435\u043c \u043d\u0430\u0448\u0435\u043c\u0443 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0443 \u00ab\u0432\u044b\u0441\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f\u00bb, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0435\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f (\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0448\u0438\u0431\u0430\u0442\u044c\u0441\u044f. \u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043d\u0430\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043b\u0435\u043a\u0430\/\u0431\u043b\u0438\u0437\u043a\u0430 \u043a \u0438\u0441\u0442\u0438\u043d\u0435 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0434\u0435\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>w<\/code> \u0438 <code>b<\/code> \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u044f \u043f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0441\u043d\u043e\u0432\u0430, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u043b \u043b\u0438 \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u00ab\u0443\u043c\u043d\u0435\u0435\u00bb \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/575\/db3\/e0a\/575db3e0a0c872b29582147e41231344.png\" alt=\"Average Cost\"><\/p>\n<p>  <\/p>\n<p>\u0413\u0434\u0435 <code>m<\/code> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 \u043d\u0430\u0441 <code>100<\/code> \u043f\u0430\u0440 \u0434\u0430\u043d\u043d\u044b\u0445).<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function forwardPropagation(model, xTrain, yTrain) {   const m = xTrain.length;   const predictions = [];   let cost = 0;   for (let i = 0; i &lt; m; i += 1) {     const prediction = nanoNeuron.predict(xTrain[i]);     cost += predictionCost(yTrain[i], prediction);     predictions.push(prediction);   }   \/\/ \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.   cost \/= m;   return [predictions, cost]; }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"obratnoe-rasprostranenie-signala\">\u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043f\u0440\u0430\u0432 \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f\u0445 (\u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438), \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c\u0438?<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0432 \u044d\u0442\u043e\u043c. \u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0446\u0435\u043d\u043a\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 <code>w<\/code> \u0438 <code>b<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043b\u0438 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0442\u043e\u0447\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0438\u043c \u043d\u0430 \u043c\u0430\u0433\u0438\u044e. \u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u0437\u0434\u0435\u0441\u044c \u2014 \u044d\u0442\u043e <strong>\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0448\u0430\u0433 \u0438 \u0432 \u043a\u0430\u043a\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u044c\u0441\u044f \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438).<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 (\u0441\u043c. \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u044b\u0448\u0435). \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>w<\/code> \u0438 <code>b<\/code> \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f\u043c\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u2014 \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0435 \u043f\u043e\u043a\u0440\u043e\u0435\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. <a href=\"https:\/\/www.mathsisfun.com\/calculus\/derivatives-introduction.html\" rel=\"nofollow\">MathIsFun<\/a> \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430 \u0432\u0435\u0449\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 <code>x<\/code> \u0438 <code>y<\/code>, \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u043a \u043a\u0440\u0438\u0432\u043e\u0439 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0442\u043e\u0447\u043a\u0435 <code>x<\/code> \u0438 <code>y<\/code> \u0438 <em>\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/em>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/66d\/bfd\/49a\/66dbfd49aaf1ced48d7f6b5917fddb12.svg\" alt=\"Derivative slope\"><\/p>\n<p>  <\/p>\n<p><em>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0442\u043e \u0438\u0437 <a href=\"https:\/\/www.mathsisfun.com\/calculus\/derivatives-introduction.html\" rel=\"nofollow\">MathIsFun<\/a><\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0432\u044b\u0448\u0435, \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432 \u0442\u043e\u0447\u043a\u0435 <code>(x=2, y=4)<\/code> \u043d\u0430\u043a\u043b\u043e\u043d \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f <code>\u0432\u043b\u0435\u0432\u043e<\/code> \u0438 <code>\u0432\u043d\u0438\u0437<\/code>, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043a\u043b\u043e\u043d \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043a \u0442\u043e\u0447\u043a\u0435 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u043d\u0430\u0448\u0435\u0439 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 <code>averageCost<\/code> \u043f\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c <code>w<\/code> \u0438 <code>b<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4cc\/bda\/ba1\/4ccbdaba120c399c1528e2bc38cf0efd.png\" alt=\"dW\"><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e02\/0cb\/125\/e020cb125449849009a9f565a32ff46f.png\" alt=\"dB\"><\/p>\n<p>  <\/p>\n<p>\u0413\u0434\u0435 <code>m<\/code> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 \u043d\u0430\u0441 <code>100<\/code> \u043f\u0430\u0440 \u0434\u0430\u043d\u043d\u044b\u0445).<\/p>\n<p>  <\/p>\n<p><em>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <a href=\"https:\/\/www.mathsisfun.com\/calculus\/derivatives-rules.html\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function backwardPropagation(predictions, xTrain, yTrain) {   const m = xTrain.length;   \/\/ \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b 'w' \u0438 'b'.   \/\/ \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430 \u043f\u043e\u043a\u0430 \u0440\u0430\u0432\u0435\u043d 0.   let dW = 0;   let dB = 0;   for (let i = 0; i &lt; m; i += 1) {     dW += (yTrain[i] - predictions[i]) * xTrain[i];     dB += yTrain[i] - predictions[i];   }   \/\/ \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.   dW \/= m;   dB \/= m;   return [dW, dB]; }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"trenirovka-modeli\">\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c\/\u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430). \u041c\u044b \u0442\u0430\u043a \u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 <code>w<\/code> \u0438 <code>b<\/code> \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 (\u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430), \u0447\u0442\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0435 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u0438 \u0432\u044b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0437\u0430\u043a\u043e\u043d\u044b \u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u0441 \u043e\u0434\u043d\u043e\u0434\u043d\u0435\u0432\u043d\u044b\u043c \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0448\u043a\u043e\u043b\u044b \u0443\u0447\u0435\u043d\u0438\u043a\u043e\u043c. \u041e\u043d\/\u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0448\u043a\u043e\u043b\u0443 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e, \u0434\u0435\u043d\u044c \u0437\u0430 \u0434\u043d\u0435\u043c, \u0433\u043e\u0434 \u0437\u0430 \u0433\u043e\u0434\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0443\u0447\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b <em>\u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c<\/em> \u043f\u0440\u044f\u043c\u043e\u0435 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437. \u042d\u0442\u0438\u043c \u043a\u0430\u043a-\u0440\u0430\u0437 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>trainModel()<\/code>. \u041e\u043d\u0430 \u0431\u0443\u0434\u0442\u043e \u00ab\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0438\u0446\u0430\u00bb \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043e\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (<code>epochs<\/code>) \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u0433\u043b\u0443\u043f\u0435\u043d\u044c\u043a\u0438\u043c \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u043e\u043c, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e,<\/li>\n<li>\u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043d\u0438\u0433\u0438 (<code>xTrain<\/code> \u0438 <code>yTrain<\/code> \u043d\u0430\u0431\u043e\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445) \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f,<\/li>\n<li>\u043e\u043d\u0430 \u0441\u0442\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u00ab\u0443\u0447\u0435\u043d\u0438\u043a\u0430\u00bb \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043b\u0435\u0436\u043d\u0435\u0435 (\u0431\u044b\u0441\u0442\u0440\u0435\u0435) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>alpha<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0441\u0443\u0442\u0438 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <code>alpha<\/code>. \u042d\u0442\u043e \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 (\u0443\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c) \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <code>dW<\/code> \u0438 <code>dB<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 (\u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0437\u043d\u0430\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>dW<\/code> \u0438 <code>dB<\/code>). \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043d\u0430\u043c \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>dW<\/code> \u0438 <code>dB<\/code>). \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430 \u043d\u0430 <code>alpha<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044f \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443 (\u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430). \u0418\u043d\u043e\u0433\u0434\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f <code>alpha<\/code>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0434\u0442\u0438 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0448\u0430\u0433\u0430\u043c\u0438, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 <em>\u043f\u0435\u0440\u0435\u0441\u0442\u0443\u043f\u0438\u0442\u044c<\/em> \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0432 \u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u00ab\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0438\u0446\u0435\u0439\u00bb, \u0447\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u043e\u043d\u0430 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0430 \u0431\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u00ab\u043d\u0430\u043d\u043e-\u0443\u0447\u0435\u043d\u0438\u043a\u0430\u00bb \u0443\u0447\u0438\u0442\u044c\u0441\u044f, \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0431\u044b \u043e\u043d \u0432\u044b\u0443\u0447\u0438\u043b\u0441\u044f, \u041d\u041e, \u0435\u0441\u043b\u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438 \u0434\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u00ab\u043d\u0430\u043d\u043e-\u0443\u0447\u0435\u043d\u0438\u043a\u0430\u00bb \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u0440\u0432\u043d\u044b\u0439 \u0441\u0440\u044b\u0432 \u0438 \u043f\u043e\u043b\u043d\u0430\u044f \u0430\u043f\u0430\u0442\u0438\u044f \u0438 \u043e\u043d \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0443\u0447\u0438\u0442.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <code>w<\/code> \u0438 <code>b<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c7b\/db8\/84f\/c7bdb884f2a940d62332246cdbcb44bc.png\" alt=\"w\"><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b57\/622\/0ab\/b576220ab6515d44255ef56699077bab.png\" alt=\"b\"><\/p>\n<p>  <\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0430\u043c\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function trainModel({model, epochs, alpha, xTrain, yTrain}) {   \/\/ \u042d\u0442\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u0414\u043d\u0435\u0432\u043d\u0438\u043a \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438.   const costHistory = [];    \/\/ \u041d\u0430\u0447\u043d\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043d\u0438 (\u044d\u043f\u043e\u0445\u0438) \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f   for (let epoch = 0; epoch &lt; epochs; epoch += 1) {     \/\/ \u041f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430.     const [predictions, cost] = forwardPropagation(model, xTrain, yTrain);     costHistory.push(cost);      \/\/ \u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430.     const [dW, dB] = backwardPropagation(predictions, xTrain, yTrain);      \/\/ \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439.     nanoNeuron.w += alpha * dW;     nanoNeuron.b += alpha * dB;   }    return costHistory; }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"soberem-vse-funkcii-vmeste\">\u0421\u043e\u0431\u0435\u0440\u0435\u043c \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u0435<\/h3>\n<p>  <\/p>\n<p>\u0412\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>w<\/code> \u0438 <code>b<\/code>. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c <code>w<\/code> \u0438 <code>b<\/code> \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const w = Math.random(); \/\/ i.e. -&gt; 0.9492 const b = Math.random(); \/\/ i.e. -&gt; 0.4570 const nanoNeuron = new NanoNeuron(w, b);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const [xTrain, yTrain, xTest, yTest] = generateDataSets();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0448\u0430\u0433\u0438 (<code>0.0005<\/code>) \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 <code>70000<\/code> \u044d\u043f\u043e\u0445. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u043e\u043d\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u044d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0443\u0442\u0435\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const epochs = 70000; const alpha = 0.0005; const trainingCostHistory = trainModel({model: nanoNeuron, epochs, alpha, xTrain, yTrain});<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u041c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0434\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u043b\u043e \u0431\u044b, \u0447\u0442\u043e \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043f\u043e\u0443\u043c\u043d\u0435\u043b. \u0412\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0442\u0430\u043a\u0436\u0435 \u0438 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438, \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0440\u043e\u0441\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u0448\u0430\u0433\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f <code>alpha<\/code>).<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">console.log('\u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438:', trainingCostHistory[0]); \/\/ i.e. -&gt; 4694.3335043 console.log('\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438:', trainingCostHistory[epochs - 1]); \/\/ i.e. -&gt; 0.0000024<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u041f\u043e \u043e\u0441\u0438 <code>x<\/code> \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u044d\u043f\u043e\u0445\u0438 (\u0432 \u0442\u044b\u0441\u044f\u0447\u0430\u0445). \u041e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u0433\u0440\u0430\u0444\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0438\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/191\/860\/d6f\/191860d6f0cd8cf7d24127f04f779462.png\" alt=\"Training process\"><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u00ab\u0432\u044b\u0443\u0447\u0438\u043b\u00bb \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d. \u041e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>w<\/code> \u0438 <code>b<\/code> \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>celsiusToFahrenheit()<\/code> (<code>w = 1.8<\/code> \u0438 <code>b = 32<\/code>), \u0432\u0435\u0434\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0435 \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">console.log('\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430:', {w: nanoNeuron.w, b: nanoNeuron.b}); \/\/ i.e. -&gt; {w: 1.8, b: 31.99}<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043e\u043a \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>celsiusToFahrenheit()<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u043d\u044b \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d \u043d\u0435 \u0432\u0438\u0434\u0435\u043b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0431\u043b\u0438\u0437\u043a\u043e\u0439 \u043a \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u0432\u044b\u0443\u0447\u0438\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u0438 \u043d\u0430 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0432 \u044d\u0442\u043e\u043c \u0432\u0435\u0434\u044c \u0432\u0441\u044f \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438). <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">[testPredictions, testCost] = forwardPropagation(nanoNeuron, xTest, yTest); console.log('\u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:', testCost); \/\/ i.e. -&gt; 0.0000023<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0448 \u00ab\u043d\u0430\u043d\u043e-\u043c\u0430\u043b\u044b\u0448\u00bb \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0431\u0443\u0447\u0438\u043b\u0441\u044f \u0432 \u00ab\u0448\u043a\u043e\u043b\u0435\u00bb \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d \u043d\u0435 \u0432\u0438\u0434\u0435\u043b, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u00ab\u0443\u043c\u043d\u0435\u043d\u044c\u043a\u0438\u043c\u00bb. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u0441\u043e\u0432\u0435\u0442\u0430 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b, \u0430 \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0438 \u0431\u044b\u043b\u0430 \u0446\u0435\u043b\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const tempInCelsius = 70; const customPrediction = nanoNeuron.predict(tempInCelsius); console.log(`\u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \"\u0434\u0443\u043c\u0430\u0435\u0442\", \u0447\u0442\u043e ${tempInCelsius}\u00b0C \u0432 \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430\u0445 \u0431\u0443\u0434\u0435\u0442:`, customPrediction); \/\/ -&gt; 158.0002 console.log('\u0410 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442:', celsiusToFahrenheit(tempInCelsius)); \/\/ -&gt; 158<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043a\u043e! \u041a\u0430\u043a \u0438 \u043b\u044e\u0434\u0438, \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u2014 \u0445\u043e\u0440\u043e\u0448, \u043d\u043e \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u0435\u043d \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u043d\u0433\u0430!<\/p>\n<p>  <\/p>\n<h2 id=\"kak-zapustit-i-protestirovat-nano-neyron\">\u041a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d<\/h2>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/trekhleb\/nano-neuron.git cd nano-neuron<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"bash\">node .\/NanoNeuron.js<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"upuschennye-koncepcii\">\u0423\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0443\u043f\u0443\u0449\u0435\u043d\u044b \u0438\u043b\u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><strong>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440\u044b \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438 70\/30. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u044b \u043f\u0435\u0440\u0435\u0434 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b), \u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440\u044b \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u044f\u0445 \u0431\u043b\u0438\u0437\u043a\u0438\u0445 \u043a 90\/10 \u0438\u043b\u0438 95\/5. <\/p>\n<p>  <\/p>\n<p><strong>\u0421\u0438\u043b\u0430 \u0432 \u0441\u0435\u0442\u0438<\/strong><\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u043d\u0435\u0439\u0440\u043e\u043d. \u0421\u0438\u043b\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Neural_network\" rel=\"nofollow\">\u0441\u0435\u0442\u0438<\/a> \u0442\u0430\u043a\u0438\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432. \u041d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0443\u0447\u0438\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435, \u043d\u0430\u0448 \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043a\u043e\u0440\u0435\u0435 \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u0430\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Linear_regression\" rel=\"nofollow\">\u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f<\/a>, \u0447\u0435\u043c \u043a\u0430\u043a \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c.<\/p>\n<p>  <\/p>\n<p><strong>\u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c <a href=\"https:\/\/www.jeremyjordan.me\/batch-normalization\/\" rel=\"nofollow\">\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/a>.<\/p>\n<p>  <\/p>\n<p><strong>\u0412\u0435\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 (\u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0435) \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u0446\u0438\u043a\u043b\u0430\u0445 <code>for<\/code>. \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u044f\u043c\u043e\u0435 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Python \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/numpy.org\/\" rel=\"nofollow\">Numpy<\/a>.<\/p>\n<p>  <\/p>\n<p><strong>\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438<\/strong><\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u043d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0430. \u041e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c <a href=\"https:\/\/stackoverflow.com\/questions\/32986123\/why-the-cost-function-of-logistic-regression-has-a-logarithmic-expression\/32998675\" rel=\"nofollow\">\u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b<\/a>. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0443\u043b \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438<\/strong><\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0435\u0449\u0435 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u043a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sigmoid_function\" rel=\"nofollow\">Sigmoid<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Rectifier_(neural_networks)\" rel=\"nofollow\">ReLU<\/a> \u0438 \u043f\u0440\u043e\u0447\u0438\u0435.<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \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\/479220\/\"> https:\/\/habr.com\/ru\/post\/479220\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/479220\/\">\n<p><a href=\"https:\/\/github.com\/trekhleb\/nano-neuron\" rel=\"nofollow\"><strong>\u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d<\/strong><\/a> \u2014 \u044d\u0442\u043e <em>\u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f<\/em> \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438\u0437 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041d\u0430\u043d\u043e-\u043d\u0435\u0439\u0440\u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0438\u0437 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 <a href=\"https:\/\/github.com\/trekhleb\/nano-neuron\/blob\/master\/NanoNeuron.js\" rel=\"nofollow\"><strong>NanoNeuron.js<\/strong><\/a> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 7 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 JavaScript \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435, \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435, \u043f\u0440\u044f\u043c\u043e\u0435 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043c\u043e\u0434\u0435\u043b\u0438. \u0426\u0435\u043b\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u044b\u043b\u043e \u0434\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435, \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 (\u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e) \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0436\u0435 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043c\u0430\u0448\u0438\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u00ab\u043e\u0431\u0443\u0447\u0430\u0442\u044c\u0441\u044f\u00bb. \u0412 \u043a\u043e\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041a\u0430\u043a-\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u00abvanilla\u00bb JavaScript \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438 <strong>\u043d\u0438 \u0432 \u043a\u043e\u0435\u0439 \u043c\u0435\u0440\u0435<\/strong> \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e. \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0438\u0445 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e \u0438\u043b\u0438 \u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043e! \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043e \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u2014 \u0434\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0441\u0430\u043c\u043e\u0435 <strong>\u0431\u0430\u0437\u043e\u0432\u043e\u0435<\/strong> \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u0430\u0448\u0438\u043d\u0430 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u0435\u0442 \u00ab\u0443\u0447\u0438\u0442\u044c\u0441\u044f\u00bb, \u0447\u0442\u043e\u0431\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u00ab\u041c\u0410\u0413\u0418\u042f \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f\u00bb \u0437\u0432\u0443\u0447\u0430\u043b\u0430 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u043a\u0430\u043a \u00ab\u041c\u0410\u0422\u0415\u041c\u0410\u0422\u0418\u041a\u0410 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f\u00bb.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/98d\/6c4\/69e\/98d6c469e1facbf97154fe29f698cd12.png\" alt=\"NanoNeuron\"><\/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-295939","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295939","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=295939"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295939\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}