{"id":386022,"date":"2024-06-29T06:28:07","date_gmt":"2024-06-29T06:28:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=386022"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=386022","title":{"rendered":"<span>\u0427\u0442\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0443 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c c \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440, \u044f backend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0438\u043b\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u041a\u0430\u043a \u0432 \u043f\u0440\u0438\u0442\u0447\u0435 \u043e \u0441\u043b\u043e\u043d\u0435 \u0438 \u0441\u043b\u0435\u043f\u044b\u0445 \u043c\u0443\u0434\u0440\u0435\u0446\u0430\u0445.<\/p>\n<p>\u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u2013 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 c \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <em>tensorflow.keras<\/em>. \u0421\u0442\u0430\u0442\u044c\u044f \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043d\u0430 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u0438\u0435 \u044d\u0442\u0430\u043f\u044b \u043a\u0430\u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0431\u0449\u0438\u0435 \u0447\u0435\u0440\u0442\u044b. \u0422\u0430\u043a, \u0432\u0441\u0435 \u043e\u043d\u0438, \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043c\u043e\u0437\u0433 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u2013 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0442 \u043d\u0435\u0439\u0440\u043e\u043d\u044b \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u043c\u043e\u0437\u0433\u0430. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u0432 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0435\u0439\u0440\u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0443\u044e \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432, \u0432\u0435\u0441\u043e\u0432 \u044d\u0442\u0438\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0438 \u043d\u0435\u043a\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u043d\u044f\u0442\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043b\u044e\u0431\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f (\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f) \u043d\u0435\u0439\u0440\u043e\u043d, \u0442.\u0435. \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b. \u0410 \u043f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u043d\u0435\u0442. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<ol>\n<li>\n<p>\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(x,a)=ax\" alt=\"f(x,a)=ax\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a35\/65e\/f35\/a3565ef3563a30029130d1ae36a6917a.svg\" width=\"102\" height=\"22\"\/><\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0433\u043c\u043e\u0438\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"{f(x,a)} = {1\\over 1 + e^{-ax}}\" alt=\"{f(x,a)} = {1\\over 1 + e^{-ax}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7c8\/1ce\/12f\/7c81ce12f40ac3b29f27d1afa105b27d.svg\" width=\"158\" height=\"43\"\/><\/p>\n<\/li>\n<li>\n<p><u>ReLu<\/u> \u0432\u0438\u0434\u0430 <img class=\"formula inline\" source=\"f(x,a) = \\begin{cases}     x      &amp; \\quad \\text{x > 0}\\\\     ax  &amp; \\quad \\text{x &lt;= 0}   \\end{cases} &#187; alt=&#187;f(x,a) = \\begin{cases}     x      &amp; \\quad \\text{x > 0}\\\\     ax  &amp; \\quad \\text{x &lt;= 0}   \\end{cases} &#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c2\/61f\/793\/3c261f79322bbdc17fd304ad0463c664.svg&#187; width=&#187;221&#8243; height=&#187;49&#8243;\/>                                                                       <\/p>\n<\/li>\n<\/ol>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fc1\/bc7\/ac6\/fc1bc7ac64dd40fc4eadc61b9de2d064.png\" alt=\"\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f ReLu    \" title=\"\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f ReLu    \" width=\"751\" height=\"452\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fc1\/bc7\/ac6\/fc1bc7ac64dd40fc4eadc61b9de2d064.png\"\/><\/p>\n<div><figcaption>\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f ReLu    <\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0440\u0430\u0441\u0447\u0435\u0442\u0430\u0445 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e ReLu \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <em>a\u00a0<\/em>=\u00a01. \u0422.\u043a. \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <em>f(x) = x<\/em>, \u0434\u043b\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0447\u044c. <\/p>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u043f\u043e\u0434\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (<em>X<\/em>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u043c\u0435\u0436\u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u043c \u0441\u0432\u044f\u0437\u044f\u043c (\u0441\u0438\u043d\u0430\u043f\u0441\u0438\u0441\u0430\u043c). \u0423 \u0441\u0438\u043d\u0430\u043f\u0441\u043e\u0432 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 <em>W<\/em> (\u0432\u0435\u0441), \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443. <\/p>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ea\/1ed\/680\/2ea1ed680395084342cc3515dc3378fa.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430\" width=\"574\" height=\"294\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2ea\/1ed\/680\/2ea1ed680395084342cc3515dc3378fa.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430<\/figcaption><\/div>\n<\/figure>\n<p><em>X1<\/em> \u2026 <em>Xn<\/em> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432, <em>Y<\/em> \u2013 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b, <em>W1\u2026Wn<\/em> \u2013 \u0432\u0435\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0432\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u043d \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043d\u0435\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0438\u0434\u0430<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"S_n(X,W) = f({\\sum_{i=1}^n(X_iW_i)})\" alt=\"S_n(X,W) = f({\\sum_{i=1}^n(X_iW_i)})\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ee4\/675\/20b\/ee467520b6312750a09a96342780bbbb.svg\" width=\"224\" height=\"57\"\/><\/p>\n<p>\u0433\u0434\u0435 <em>f<\/em> \u2013 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u2013 \u044d\u0442\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d \u0441\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440. \u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c Y \u043e\u0442 \u0434\u0432\u0443\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 X1 \u0438 X2.<\/p>\n<p>\u0412 \u0445\u043e\u0434\u0435 \u043d\u0435\u043a\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">X1<\/p>\n<\/td>\n<td>\n<p align=\"left\">X2<\/p>\n<\/td>\n<td>\n<p align=\"left\">Y<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">3<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">3<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Y(X1,X2) = X1 + X2\" alt=\"Y(X1,X2) = X1 + X2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a24\/2b4\/85b\/a242b485b7879366a5a138d2a513e2f9.svg\" width=\"192\" height=\"22\"\/><br \/>\u041d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u043c. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>Y<\/em> \u043e\u0431\u0443\u0447\u0438\u0432 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c.                                               <\/p>\n<p>\u041c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 (\u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432), \u0430 \u0437\u0430\u0442\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 keras \u0432 python \u043d\u0430\u0439\u0434\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u0435\u0441\u0430. \u0414\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c.<\/p>\n<pre><code class=\"python\">from tensorflow.keras.models import Sequential model = Sequential()<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430   <\/p>\n<pre><code class=\"python\">for layer in model.layers:    print(layer.get_weights())<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0435 \u0441\u0445\u0435\u043c\u044b \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438:<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u0441\u043b\u043e\u044f, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0435\u0439\u0440\u043e\u043d\u0443 (\u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ef1\/0b0\/e55\/ef10b0e5594849b7ad7af87b0f6ccdd9.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 1\" title=\"\u0421\u0445\u0435\u043c\u0430 1\" width=\"845\" height=\"296\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef1\/0b0\/e55\/ef10b0e5594849b7ad7af87b0f6ccdd9.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 1<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"python\">model.add(Dense(1, input_shape=X.shape[1:], kernel_constraint=non_neg())) model.add(layers.Activation(keras.activations.relu)) model.add(Dense(1, activation='linear', kernel_constraint=non_neg()))<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0442.\u0435. \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d <em>Y = (X1 * W11 + X2 * W12) * W21<\/em><\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <strong>predict<\/strong><\/p>\n<pre><code class=\"python\">model.predict(\u2026)<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">X1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">X2<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">Y = X1 + X2<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">(1*0.7717732 + 1*0.7717735)*1.295717 = 2   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10*0.7717732 + 10*0.7717735)*1.295717 = 20   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">5.5<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">2.5<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">(5.5*0.7717732 + 2.5*0.7717735)*1.295717 = 8   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">10.3<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">2.1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">12.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10.3*0.7717732 + 2.1*0.7717735)*1.295717 = 12.4   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">8.3<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">20.1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">28.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(8.3*0.7717732 + 20.1*0.7717735)*1.295717 = 28.4   <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u0441\u043b\u043e\u044f, \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u043e\u0435 \u0434\u0432\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u0430, \u0430 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u043d\u0435\u0439\u0440\u043e\u043d (\u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435). <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ed9\/30a\/ecc\/ed930aecc55dd43659de65fdddf94bfd.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 2\" title=\"\u0421\u0445\u0435\u043c\u0430 2\" width=\"729\" height=\"389\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ed9\/30a\/ecc\/ed930aecc55dd43659de65fdddf94bfd.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 2<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"python\">model.add(Dense(1, input_shape=X.shape[1:], kernel_constraint=non_neg())) model.add(layers.Activation(keras.activations.relu)) model.add(Dense(1, activation='linear', kernel_constraint=non_neg()))<\/code><\/pre>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d <em>Y = (X1 * W11 + X2 * W12) * W21 + (X1 * W13 + X2 * W14) * W22<\/em><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">X1<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">X2<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">Y = X1 + X2<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">(1*0.75749624 + 1*0.7609735)* 0.67330104 + (1*0.6390331+ <br \/> 1* 0.88485044)*0.6438818 = 2   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10* 0.75749624 + 10* 0.7609735)*0.67330104 + <br \/> (10* 0.6390331+ 10* 0.88485044)*0.6438818 = 20   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">5.5<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">2.5<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">(5.5* 0.75749624 + 2.5* 0.7609735)*0.67330104 + <br \/> (5.5* 0.6390331+ 2.5* 0.88485044)*0.6438818 = 8   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">10.3<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">2.1<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">12.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10.3* 0.75749624 + 2.1* 0.7609735)*0.67330104 + <br \/> (10.3* 0.6390331+ 2.1* 0.88485044)*0.6438818 = 11.76   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">8.3<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">20.1<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">28.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(8.3* 0.75749624 + 20.1* 0.7609735)<em>0.67330104 + (8.3<\/em> 0.6390331+ 20.1* 0.88485044)*0.6438818 = 29.4<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u0432\u0435\u0441\u043e\u0432). \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/articles\/742386\/\"> https:\/\/habr.com\/ru\/articles\/742386\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440, \u044f backend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0438\u043b\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u041a\u0430\u043a \u0432 \u043f\u0440\u0438\u0442\u0447\u0435 \u043e \u0441\u043b\u043e\u043d\u0435 \u0438 \u0441\u043b\u0435\u043f\u044b\u0445 \u043c\u0443\u0434\u0440\u0435\u0446\u0430\u0445.<\/p>\n<p>\u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u2013 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 c \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <em>tensorflow.keras<\/em>. \u0421\u0442\u0430\u0442\u044c\u044f \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043d\u0430 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u0438\u0435 \u044d\u0442\u0430\u043f\u044b \u043a\u0430\u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0431\u0449\u0438\u0435 \u0447\u0435\u0440\u0442\u044b. \u0422\u0430\u043a, \u0432\u0441\u0435 \u043e\u043d\u0438, \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043c\u043e\u0437\u0433 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u2013 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0442 \u043d\u0435\u0439\u0440\u043e\u043d\u044b \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u043c\u043e\u0437\u0433\u0430. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u0432 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0435\u0439\u0440\u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0443\u044e \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432, \u0432\u0435\u0441\u043e\u0432 \u044d\u0442\u0438\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0438 \u043d\u0435\u043a\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u043d\u044f\u0442\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043b\u044e\u0431\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f (\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f) \u043d\u0435\u0439\u0440\u043e\u043d, \u0442.\u0435. \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b. \u0410 \u043f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u043d\u0435\u0442. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<ol>\n<li>\n<p>\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0433\u043c\u043e\u0438\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <\/p>\n<\/li>\n<li>\n<p><u>ReLu<\/u> \u0432\u0438\u0434\u0430  0}\\\\     ax  &amp; \\quad \\text{x &lt;= 0}   \\end{cases} &#187; alt=&#187;f(x,a) = \\begin{cases}     x      &amp; \\quad \\text{x > 0}\\\\     ax  &amp; \\quad \\text{x &lt;= 0}   \\end{cases} &#187; src=&#187;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c2\/61f\/793\/3c261f79322bbdc17fd304ad0463c664.svg&#187; width=&#187;221&#8243; height=&#187;49&#8243;\/>                                                                       <\/p>\n<\/li>\n<\/ol>\n<figure class=\"float full-width\">\n<div><figcaption>\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f ReLu    <\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0440\u0430\u0441\u0447\u0435\u0442\u0430\u0445 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e ReLu \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <em>a\u00a0<\/em>=\u00a01. \u0422.\u043a. \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <em>f(x) = x<\/em>, \u0434\u043b\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0447\u044c. <\/p>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u043f\u043e\u0434\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (<em>X<\/em>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u043c\u0435\u0436\u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u043c \u0441\u0432\u044f\u0437\u044f\u043c (\u0441\u0438\u043d\u0430\u043f\u0441\u0438\u0441\u0430\u043c). \u0423 \u0441\u0438\u043d\u0430\u043f\u0441\u043e\u0432 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 <em>W<\/em> (\u0432\u0435\u0441), \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443. <\/p>\n<figure class=\"float full-width\">\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430<\/figcaption><\/div>\n<\/figure>\n<p><em>X1<\/em> \u2026 <em>Xn<\/em> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432, <em>Y<\/em> \u2013 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b, <em>W1\u2026Wn<\/em> \u2013 \u0432\u0435\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0432\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u043d \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043d\u0435\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0438\u0434\u0430<\/p>\n<p>\u0433\u0434\u0435 <em>f<\/em> \u2013 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u2013 \u044d\u0442\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d \u0441\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440. \u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c Y \u043e\u0442 \u0434\u0432\u0443\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 X1 \u0438 X2.<\/p>\n<p>\u0412 \u0445\u043e\u0434\u0435 \u043d\u0435\u043a\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">X1<\/p>\n<\/td>\n<td>\n<p align=\"left\">X2<\/p>\n<\/td>\n<td>\n<p align=\"left\">Y<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">3<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">3<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c<br \/>\u041d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u043c. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>Y<\/em> \u043e\u0431\u0443\u0447\u0438\u0432 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c.                                               <\/p>\n<p>\u041c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 (\u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432), \u0430 \u0437\u0430\u0442\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 keras \u0432 python \u043d\u0430\u0439\u0434\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u0435\u0441\u0430. \u0414\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c.<\/p>\n<pre><code class=\"python\">from tensorflow.keras.models import Sequential model = Sequential()<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430   <\/p>\n<pre><code class=\"python\">for layer in model.layers:    print(layer.get_weights())<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0435 \u0441\u0445\u0435\u043c\u044b \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438:<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u0441\u043b\u043e\u044f, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0435\u0439\u0440\u043e\u043d\u0443 (\u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435).<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 1<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"python\">model.add(Dense(1, input_shape=X.shape[1:], kernel_constraint=non_neg())) model.add(layers.Activation(keras.activations.relu)) model.add(Dense(1, activation='linear', kernel_constraint=non_neg()))<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0442.\u0435. \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d <em>Y = (X1 * W11 + X2 * W12) * W21<\/em><\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <strong>predict<\/strong><\/p>\n<pre><code class=\"python\">model.predict(\u2026)<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">X1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">X2<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">Y = X1 + X2<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">(1*0.7717732 + 1*0.7717735)*1.295717 = 2   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10*0.7717732 + 10*0.7717735)*1.295717 = 20   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">5.5<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">2.5<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">(5.5*0.7717732 + 2.5*0.7717735)*1.295717 = 8   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">10.3<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">2.1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">12.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10.3*0.7717732 + 2.1*0.7717735)*1.295717 = 12.4   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"90\" width=\"90\">\n<p align=\"left\">8.3<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">20.1<\/p>\n<\/td>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">28.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(8.3*0.7717732 + 20.1*0.7717735)*1.295717 = 28.4   <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u0441\u043b\u043e\u044f, \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u043e\u0435 \u0434\u0432\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u0430, \u0430 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u043d\u0435\u0439\u0440\u043e\u043d (\u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435). <\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 2<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"python\">model.add(Dense(1, input_shape=X.shape[1:], kernel_constraint=non_neg())) model.add(layers.Activation(keras.activations.relu)) model.add(Dense(1, activation='linear', kernel_constraint=non_neg()))<\/code><\/pre>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d <em>Y = (X1 * W11 + X2 * W12) * W21 + (X1 * W13 + X2 * W14) * W22<\/em><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">X1<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">X2<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">Y = X1 + X2<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">(1*0.75749624 + 1*0.7609735)* 0.67330104 + (1*0.6390331+ <br \/> 1* 0.88485044)*0.6438818 = 2   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">10<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10* 0.75749624 + 10* 0.7609735)*0.67330104 + <br \/> (10* 0.6390331+ 10* 0.88485044)*0.6438818 = 20   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">5.5<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">2.5<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">(5.5* 0.75749624 + 2.5* 0.7609735)*0.67330104 + <br \/> (5.5* 0.6390331+ 2.5* 0.88485044)*0.6438818 = 8   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">10.3<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">2.1<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">12.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(10.3* 0.75749624 + 2.1* 0.7609735)*0.67330104 + <br \/> (10.3* 0.6390331+ 2.1* 0.88485044)*0.6438818 = 11.76   <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">8.3<\/p>\n<\/td>\n<td data-colwidth=\"64\" width=\"64\">\n<p align=\"left\">20.1<\/p>\n<\/td>\n<td data-colwidth=\"100\" width=\"100\">\n<p align=\"left\">28.4<\/p>\n<\/td>\n<td>\n<p align=\"left\">(8.3* 0.75749624 + 20.1* 0.7609735)<em>0.67330104 + (8.3<\/em> 0.6390331+ 20.1* 0.88485044)*0.6438818 = 29.4<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u0432\u0435\u0441\u043e\u0432). \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/articles\/742386\/\"> https:\/\/habr.com\/ru\/articles\/742386\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-386022","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/386022","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=386022"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/386022\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=386022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=386022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=386022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}