{"id":444170,"date":"2025-01-08T03:00:47","date_gmt":"2025-01-08T03:00:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=444170"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-01-08T03:00:47","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=444170","title":{"rendered":"<span>\u0413\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435: \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438. \u0422\u0435\u043e\u0440\u0438\u044f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f. \u0421 \u043d\u0443\u043b\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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u043c\u0430\u0437 \u0425\u0443\u0441\u043d\u0443\u0442\u0434\u0438\u043d\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043f\u0440\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439.<\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435: \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\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 \u0440\u0443\u0447\u043d\u043e\u0439 \u0440\u0430\u0441\u0447\u0435\u0442, \u0432\u044b\u0432\u043e\u0434 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445, \u0432\u044b\u0432\u043e\u0434 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0440\u0443\u0447\u043d\u043e\u0439 \u0440\u0430\u0441\u0447\u0435\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f MNIST.<\/p>\n<h2>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430 \u0447\u0438\u0441\u0435\u043b \u2014 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (0, 1), \u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u00ab1\u00bb, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u00ab0\u00bb.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ca4\/b64\/af7\/ca4b64af711400a9e3e74ef6a4856486.png\" alt=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438\" title=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438\" width=\"1079\" height=\"352\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca4\/b64\/af7\/ca4b64af711400a9e3e74ef6a4856486.png\"\/><\/p>\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/figcaption><\/div>\n<\/figure>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"X = (x_1, x_2)^T = (0, 1)^T\" alt=\"X = (x_1, x_2)^T = (0, 1)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2e6\/47d\/098\/2e647d0981362197f297fbe772fece29.svg\" width=\"201\" height=\"25\"\/> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Z_1 = (z_1, z_2)^T\" alt=\"Z_1 = (z_1, z_2)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6e0\/b04\/891\/6e0b048916f85d1356fcbe2cf9090780.svg\" width=\"120\" height=\"25\"\/> &#8212; \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"H = (h_1, h_2)^T\" alt=\"H = (h_1, h_2)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c14\/76e\/d32\/c1476ed329c50faaea4618ce9c6bfbc1.svg\" width=\"120\" height=\"25\"\/> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Z_2 = (z_3, z_4)^T\" alt=\"Z_2 = (z_3, z_4)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d11\/125\/a7f\/d11125a7f9a662bcee693143da70be21.svg\" width=\"120\" height=\"25\"\/> &#8212; \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O = (o_1, o_2)^T\" alt=\"O = (o_1, o_2)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f19\/1ba\/bcb\/f191babcb255aaa4f001a2fbb1313df6.svg\" width=\"114\" height=\"25\"\/> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"T = (t_1, t_2)^T\" alt=\"T = (t_1, t_2)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c29\/fa9\/eac\/c29fa9eac47f0f064efae34add5351d8.svg\" width=\"108\" height=\"25\"\/> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u043c\u0435\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432).<\/p>\n<p>\u0412\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u0431\u0443\u043a\u0432\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"T\" alt=\"T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/828\/575\/9f1\/8285759f1fafba2a1a31fff95e08eb34.svg\" width=\"14\" height=\"17\"\/> \u0432 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435 &#8212; \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0438 \u0441\u043a\u0440\u044b\u0442\u044b\u043c \u0441\u043b\u043e\u044f\u043c\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"W_1 = \\begin{pmatrix} w_1 &amp; w_3 \\\\ w_2 &amp; w_4 \\end{pmatrix} = \\begin{pmatrix} 0.2 &amp; 0.3 \\\\ 0.4 &amp; 0.5 \\end{pmatrix}\" alt=\"W_1 = \\begin{pmatrix} w_1 &amp; w_3 \\\\ w_2 &amp; w_4 \\end{pmatrix} = \\begin{pmatrix} 0.2 &amp; 0.3 \\\\ 0.4 &amp; 0.5 \\end{pmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d2\/14b\/f8f\/9d214bf8f0cb523f43981f8f131446f5.svg\" width=\"286\" height=\"50\"\/><\/p>\n<p>\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u0440\u044b\u0442\u044b\u043c \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0441\u043b\u043e\u044f\u043c\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"W_2 = \\begin{pmatrix} w_5 &amp; w_7 \\\\ w_6 &amp; w_8 \\end{pmatrix} = \\begin{pmatrix} 0.9 &amp; 0.8 \\\\ 0.7 &amp; 0.6 \\end{pmatrix}\" alt=\"W_2 = \\begin{pmatrix} w_5 &amp; w_7 \\\\ w_6 &amp; w_8 \\end{pmatrix} = \\begin{pmatrix} 0.9 &amp; 0.8 \\\\ 0.7 &amp; 0.6 \\end{pmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/26e\/2fa\/ee3\/26e2faee371aebdb82337b4623c7b7c8.svg\" width=\"286\" height=\"50\"\/><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f(z) = \\frac{1}{1 + e^{-z}}\" alt=\"f(z) = \\frac{1}{1 + e^{-z}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad2\/58e\/816\/ad258e8160b801215e15ae0b0959c180.svg\" width=\"131\" height=\"45\"\/><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 MSE:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"E = \\sum_{i = 1}^{2} {(o_i - t_i)^2}\" alt=\"E = \\sum_{i = 1}^{2} {(o_i - t_i)^2}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/de1\/96e\/db2\/de196edb243c4cb501a124f9ef01ffdb.svg\" width=\"151\" height=\"60\"\/><\/p>\n<p>i \u2014 \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430, 2 \u2014 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432. \u041e\u0431\u044b\u0447\u043d\u043e \u0435\u0449\u0435 \u0432\u0441\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (\u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432), \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<h2>\u041f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e 6 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438) \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0442\u043e\u043b\u044c\u043a\u043e 2 \u0437\u043d\u0430\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u043b.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_1 = x_1 \\cdot w_1 + x_2 \\cdot w_3 = 0 \\cdot 0.2 + 1 \\cdot 0.3 = 0.3\" alt=\"z_1 = x_1 \\cdot w_1 + x_2 \\cdot w_3 = 0 \\cdot 0.2 + 1 \\cdot 0.3 = 0.3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/32d\/db5\/f4e\/32ddb5f4ebc39b08b6fdf2981c275224.svg\" width=\"383\" height=\"20\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_1 = f(z_1) = f(0.3) = 0.57\" alt=\"h_1 = f(z_1) = f(0.3) = 0.57\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e5f\/954\/e73\/e5f954e73ca9db2c3d9716d927fd3b91.svg\" width=\"229\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_2 = x_1 \\cdot w_2 + x_2 \\cdot w_4 = 0 \\cdot 0.4 + 1 \\cdot 0.5 = 0.5\" alt=\"z_2 = x_1 \\cdot w_2 + x_2 \\cdot w_4 = 0 \\cdot 0.4 + 1 \\cdot 0.5 = 0.5\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ef\/cfb\/eea\/0efcfbeeac26b0e34a3710d1499d57f0.svg\" width=\"383\" height=\"19\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_2 = f(z_2) = f(0.5) = 0.62\" alt=\"h_2 = f(z_2) = f(0.5) = 0.62\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cbd\/111\/561\/cbd1115617768e5125b14534c135be2a.svg\" width=\"229\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"H = f(W_1 \\cdot X) = (0.57, 0.62)^T\" alt=\"H = f(W_1 \\cdot X) = (0.57, 0.62)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/42d\/66b\/071\/42d66b0711845e4636336bd7e7cdac68.svg\" width=\"260\" height=\"25\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_3 = h_1 \\cdot w_5 + h_2 \\cdot w_7 = 0.57 \\cdot 0.9 + 0.62 \\cdot 0.8 = 1.01\" alt=\"z_3 = h_1 \\cdot w_5 + h_2 \\cdot w_7 = 0.57 \\cdot 0.9 + 0.62 \\cdot 0.8 = 1.01\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/569\/802\/07f\/56980207fe078320eea826cb11e9a7fa.svg\" width=\"443\" height=\"20\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o_1 = f(z_3) = f(1.01) = 0.73\" alt=\"o_1 = f(z_3) = f(1.01) = 0.73\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/284\/2f0\/62a\/2842f062adf761acb52daf4ff3a5ba02.svg\" width=\"237\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_4 = h_1 \\cdot w_6 + h_2 \\cdot w_8 = 0.57 \\cdot 0.7 + 0.62 \\cdot 0.6 = 0.77\" alt=\"z_4 = h_1 \\cdot w_6 + h_2 \\cdot w_8 = 0.57 \\cdot 0.7 + 0.62 \\cdot 0.6 = 0.77\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0f3\/203\/3f7\/0f32033f7063600d1a2f63f713cedb7b.svg\" width=\"443\" height=\"20\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o_2 = f(z_4) = f(0.77) = 0.68\" alt=\"o_2 = f(z_4) = f(0.77) = 0.68\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e5e\/51e\/6ac\/e5e51e6ac5b2d569a205149b3ab9c876.svg\" width=\"237\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O = f(W_2 \\cdot H) = (0.73, 0.68)^T\" alt=\"O = f(W_2 \\cdot H) = (0.73, 0.68)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c32\/ae7\/8b9\/c32ae78b945e08412d72d1be54554625.svg\" width=\"258\" height=\"25\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"T = (t_1, t_2)^T = (1, 0)^T\" alt=\"T = (t_1, t_2)^T = (1, 0)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6ec\/15d\/a6c\/6ec15da6cd1e4311a29587918eca9948.svg\" width=\"189\" height=\"25\"\/><\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b 2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438: 1 \u0438\u043b\u0438 0. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 2 \u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b 0 \u0438 1 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e 1, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430<\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"E = \\sum_{i = 1}^{2} {(o_i - t_i)^2} = (o_1 - t_1)^2 + (o_2 - t_1)^2 = (0.73 - 1)^2 + (0.68 - 0)^2 = 0.53\" alt=\"E = \\sum_{i = 1}^{2} {(o_i - t_i)^2} = (o_1 - t_1)^2 + (o_2 - t_1)^2 = (0.73 - 1)^2 + (0.68 - 0)^2 = 0.53\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/97e\/033\/56b\/97e03356b6b3741329727435e3d9b20e.svg\" width=\"664\" height=\"60\"\/><\/p>\n<h2>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 (\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c), \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 (\u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438). \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438), \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0434\u043e\u043c\u043d\u043e\u0436\u0438\u0432 \u043d\u0430 \u0448\u0430\u0433 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 &#8212; <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\alpha\" alt=\"\\alpha\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b06\/7c5\/26c\/b067c526ce866430758200b05cf02f21.svg\" width=\"13\" height=\"12\"\/>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f29\/a54\/d3d\/f29a54d3d6701a81469654b895ba8d53.png\" alt=\"\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 E \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \" title=\"\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 E \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \" width=\"589\" height=\"485\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f29\/a54\/d3d\/f29a54d3d6701a81469654b895ba8d53.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 E \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_k\" alt=\"w_k\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/147\/778\/582\/1477785826fc41384978698950a34695.svg\" width=\"19\" height=\"12\"\/><\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 (\u0432 \u0442\u043e\u0447\u043a\u0435 (<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E_{wk2}\" alt=\"E_{wk2}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ecf\/bf8\/ddb\/ecfbf8ddbb24ef841f8bb2f97bb90cb0.svg\" width=\"41\" height=\"20\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_{k2}\" alt=\"w_{k2}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5f0\/faa\/e94\/5f0faae94eaa9ccd83d519a572510270.svg\" width=\"30\" height=\"15\"\/>)), \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432\u043b\u0435\u0432\u043e (\u0442\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c), \u0438 \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0431\u044b\u0432\u0430\u0435\u0442 (\u0432 \u0442\u043e\u0447\u043a\u0435 (<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E_{wk1}\" alt=\"E_{wk1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1f7\/f15\/2e1\/1f7f152e18581ecc28ecf6fe078c3a69.svg\" width=\"41\" height=\"20\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_{k1}\" alt=\"w_{k1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/467\/e83\/921\/467e839216b0fee7e3f442b9fcd645d0.svg\" width=\"30\" height=\"15\"\/>), \u0442\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432\u043f\u0440\u0430\u0432\u043e (\u0442\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0438 \u043f\u0440\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u043b\u044e\u0441). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \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 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043e.<\/p>\n<p>\u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_k = w_k - \\alpha \\cdot E'_{wk}\" alt=\"w_k = w_k - \\alpha \\cdot E'_{wk}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b5a\/90e\/473\/b5a90e473bc1fe20d3e8cdd494c888f7.svg\" width=\"157\" height=\"23\"\/><\/p>\n<h2>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u043f\u043e z<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"f'_z(z) = \\left(\\frac{1}{1 + e^{-z}}\\right)'_z = \\frac{(1)'_z (1 + e^{-z}) - (1)(1 + e^{-z})'_z}{(1 + e^{-z})^2} =\" alt=\"f'_z(z) = \\left(\\frac{1}{1 + e^{-z}}\\right)'_z = \\frac{(1)'_z (1 + e^{-z}) - (1)(1 + e^{-z})'_z}{(1 + e^{-z})^2} =\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/143\/3f4\/641\/1433f46413744fbaaf3f0663a19b5ea7.svg\" width=\"476\" height=\"53\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"= \\frac{0(1 + e^{-z}) - ((1)'_z + (e^{-z})'_z)}{(1 + e^{-z})^2} = \\frac{-(e^{-z})'_z}{(1 + e^{-z})^2} =\" alt=\"= \\frac{0(1 + e^{-z}) - ((1)'_z + (e^{-z})'_z)}{(1 + e^{-z})^2} = \\frac{-(e^{-z})'_z}{(1 + e^{-z})^2} =\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/80d\/c94\/010\/80dc94010faca77eaf5383146fd6d109.svg\" width=\"405\" height=\"52\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"= \\frac{-(e^{-z} (-z)'_z)}{(1 + e^{-z})^2} = (-z)'_z \\frac{-e^{-z}}{(1 + e^{-z})^2} =\" alt=\"= \\frac{-(e^{-z} (-z)'_z)}{(1 + e^{-z})^2} = (-z)'_z \\frac{-e^{-z}}{(1 + e^{-z})^2} =\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a4\/81a\/4a1\/8a481a4a1552590a737469d4c8b3281c.svg\" width=\"324\" height=\"52\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"= (-z)'_z \\frac{-e^{-z} -1 + 1}{(1 + e^{-z})^2} = (-z)'_z \\left(\\frac{-e^{-z} + 1}{(1 + e^{-z})^2} + \\frac{1}{(1 + e^{-z})^2} \\right) =\" alt=\"= (-z)'_z \\frac{-e^{-z} -1 + 1}{(1 + e^{-z})^2} = (-z)'_z \\left(\\frac{-e^{-z} + 1}{(1 + e^{-z})^2} + \\frac{1}{(1 + e^{-z})^2} \\right) =\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/910\/c58\/14d\/910c5814d41983efa35db545dab7df2b.svg\" width=\"526\" height=\"51\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"= (-z)'_z \\left(-\\frac{1}{1 + e^{-z}} + \\frac{1}{(1 + e^{-z})^2} \\right) = \" alt=\"= (-z)'_z \\left(-\\frac{1}{1 + e^{-z}} + \\frac{1}{(1 + e^{-z})^2} \\right) = \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1d6\/17d\/8cf\/1d617d8cfb864d58b70a90528cf1c12a.svg\" width=\"324\" height=\"51\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"= -(-z)'_z f(z)(1 - f(z)) = (z)'_z f(z)(1 - f(z))\" alt=\"= -(-z)'_z f(z)(1 - f(z)) = (z)'_z f(z)(1 - f(z))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/61c\/eee\/7c4\/61ceee7c4b28be24506bd97d1cc2eba2.svg\" width=\"383\" height=\"22\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"(-z)'_z = (-1)'_z(z) + (-1)(z)'_z = (-1)(z)'_z\" alt=\"(-z)'_z = (-1)'_z(z) + (-1)(z)'_z = (-1)(z)'_z\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/296\/54a\/9ee\/29654a9ee488b41e1075d85cdb5793ae.svg\" width=\"345\" height=\"22\"\/><\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u043f\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0443: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f'_z(z) = (z)'_z f(z)(1 - f(z))\" alt=\"f'_z(z) = (z)'_z f(z)(1 - f(z))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/911\/7bd\/9c4\/9117bd9c4575b1518398895c90046c9e.svg\" width=\"221\" height=\"22\"\/><\/p>\n<h2>\u0427\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u043f\u043e w5 \u0438 w1<\/h2>\n<p>\u0427\u0430\u0441\u0442\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_5\" alt=\"w_5\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ab8\/0da\/ae4\/ab80daae49346e957b744ea18438a8c5.svg\" width=\"23\" height=\"15\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"E'_{w5} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{w5} = 2 \\left(\\sum_{i = 1}^{2} (o_i - t_i) (o_i - t_i)'_{w5} \\right) =\" alt=\"E'_{w5} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{w5} = 2 \\left(\\sum_{i = 1}^{2} (o_i - t_i) (o_i - t_i)'_{w5} \\right) =\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f2\/c3a\/18f\/8f2c3a18fe291455bc865254a6075bcc.svg\" width=\"494\" height=\"65\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"= 2 \\sum_{i = 1}^{2} (o_i - t_i) ((o_i)'_{w5} - (t_i)'_{w5}) = 2 \\sum_{i = 1}^{2} (o_i - t_i) (f'_{w5}(z_{i+2}) - 0)\" alt=\"= 2 \\sum_{i = 1}^{2} (o_i - t_i) ((o_i)'_{w5} - (t_i)'_{w5}) = 2 \\sum_{i = 1}^{2} (o_i - t_i) (f'_{w5}(z_{i+2}) - 0)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e89\/f85\/d5f\/e89f85d5f128139c5a5ad0b5f19ccd46.svg\" width=\"533\" height=\"60\"\/><\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(z_3)\" alt=\"f(z_3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/29f\/022\/b52\/29f022b523132fd629cb6d82716ab98d.svg\" width=\"44\" height=\"22\"\/>, <img decoding=\"async\" class=\"formula inline\" source=\"f(z_4)\" alt=\"f(z_4)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/3c\/3cf\/3cf35491f8b75da55696493fa46ba164.svg\" width=\"auto\" height=\"auto\"\/> \u043f\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_5\" alt=\"w_5\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/405\/751\/5ba\/4057515ba0d8349c247eaacb13281c03.svg\" width=\"23\" height=\"15\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f'_{w5}(z_3)\" alt=\"f'_{w5}(z_3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/621\/78d\/c5c\/62178dc5ce3a42734b53074255fbe759.svg\" width=\"62\" height=\"24\"\/><em> = <\/em><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(z_3)'_{w5} f(z_3)(1 - f(z_3))\" alt=\"(z_3)'_{w5} f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9e4\/d1e\/e5f\/9e4d1ee5f38bbbe947bf95cab31582ce.svg\" width=\"190\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(h_1 w_5 + h_2 w_7)'_{w5} f(z_3)(1 - f(z_3))\" alt=\"(h_1 w_5 + h_2 w_7)'_{w5} f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a01\/1b3\/74d\/a011b374d47a4b8f62eab46ed8dfa6c7.svg\" width=\"282\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_1 f(z_3)(1 - f(z_3))\" alt=\"h_1 f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/942\/6db\/978\/9426db97883575e77622de2fe3200dcf.svg\" width=\"158\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f'_{w5}(z_4)\" alt=\"f'_{w5}(z_4)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1e1\/45e\/ef0\/1e145eef094eee1d7318227302f4feb5.svg\" width=\"62\" height=\"24\"\/><em> = <\/em><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(z_4)'_{w5} f(z_4)(1 - f(z_4))\" alt=\"(z_4)'_{w5} f(z_4)(1 - f(z_4))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/923\/603\/459\/9236034593b313f2b0310f501729e30e.svg\" width=\"190\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(h_1 w_6 + h_2 w_8)'_{w5} f(z_4)(1 - f(z_4))\" alt=\"(h_1 w_6 + h_2 w_8)'_{w5} f(z_4)(1 - f(z_4))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/681\/1da\/72a\/6811da72ac30a86e1155f275947a3099.svg\" width=\"282\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"0\" alt=\"0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/624\/d5e\/36c\/624d5e36c4c2afc05ff2307e7e38473e.svg\" width=\"10\" height=\"17\"\/><\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_5\" alt=\"w_5\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7a2\/745\/492\/7a274549264439d3c08b6fd06621a8f4.svg\" width=\"23\" height=\"15\"\/>: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w5} = 2 (o_1 - t_1) h_1 f(z_3)(1 - f(z_3))\" alt=\"E'_{w5} = 2 (o_1 - t_1) h_1 f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f7a\/536\/eee\/f7a536eee608b12ae713898c418043f5.svg\" width=\"301\" height=\"24\"\/><\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_1\" alt=\"w_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cf8\/ada\/d3a\/cf8adad3abab662a578e1010349b1033.svg\" width=\"23\" height=\"14\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"E'_{w1} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{w1} = 2 \\left(\\sum_{i = 1}^{2} (o_i - t_i) (o_i - t_i)'_{w1} \\right) =\" alt=\"E'_{w1} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{w1} = 2 \\left(\\sum_{i = 1}^{2} (o_i - t_i) (o_i - t_i)'_{w1} \\right) =\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c86\/04e\/c0c\/c8604ec0cd737dcab33646e9e287c41e.svg\" width=\"494\" height=\"65\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"= 2 \\sum_{i = 1}^{2} (o_i - t_i) ((o_i)'_{w1} - (t_i)'_{w1}) = 2 \\sum_{i = 1}^{2} (o_i - t_i) (f'_{w1}(z{i+2}) - 0)\" alt=\"= 2 \\sum_{i = 1}^{2} (o_i - t_i) ((o_i)'_{w1} - (t_i)'_{w1}) = 2 \\sum_{i = 1}^{2} (o_i - t_i) (f'_{w1}(z{i+2}) - 0)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bcc\/bfd\/ef1\/bccbfdef16224bbfbb1f62e6b93501df.svg\" width=\"549\" height=\"60\"\/><\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(z_3)\" alt=\"f(z_3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/936\/d0e\/458\/936d0e458ed5ee9feab77bd0c87e59be.svg\" width=\"44\" height=\"22\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(z_4)\" alt=\"f(z_4)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a94\/0dc\/61b\/a940dc61b3fbee43ba2b2d680156f8c2.svg\" width=\"44\" height=\"22\"\/> \u043f\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_1\" alt=\"w_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2f6\/68a\/da1\/2f668ada1ad5a37575d9748bab20bfa9.svg\" width=\"23\" height=\"14\"\/>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f'_{w1}(z_3)\" alt=\"f'_{w1}(z_3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/22e\/554\/c27\/22e554c2770ac68662f370afb19f65b7.svg\" width=\"62\" height=\"24\"\/><em> = <\/em><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(z_3)'_{w1}f(z_3)(1- f(z_3))\" alt=\"(z_3)'_{w1}f(z_3)(1- f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c18\/c2e\/0ad\/c18c2e0ad9edf9947b1080a6a110d130.svg\" width=\"190\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(h_1 w_5 + h_2 w_7)'_{w1} f(z_3)(1 - f(z_3))\" alt=\"(h_1 w_5 + h_2 w_7)'_{w1} f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/84c\/838\/aa7\/84c838aa7db73fe2ba5421f53abcc25f.svg\" width=\"282\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"((h_1 w_5)'_{w1} + (h_2 w_7)'_{w1}) f(z_3)(1 - f(z_3))\" alt=\"((h_1 w_5)'_{w1} + (h_2 w_7)'_{w1}) f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/74a\/dd2\/b19\/74add2b192b3543cb6bd45c91ce9e7ec.svg\" width=\"331\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(f(z_1) w_5)'_{w1} + (f(z_2) w_7)'_{w1} f(z_3)(1 - f(z_3))\" alt=\"(f(z_1) w_5)'_{w1} + (f(z_2) w_7)'_{w1} f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c01\/7f0\/3f1\/c017f03f159159740b561cfd6ac6c6e0.svg\" width=\"364\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(f'_{w1}(z_1) w_5 + f'_{w1}(z_2) w_7) f(z_3)(1 - f(z_3))\" alt=\"(f'_{w1}(z_1) w_5 + f'_{w1}(z_2) w_7) f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/423\/bb8\/0d6\/423bb80d67bab53b350250e802c0914a.svg\" width=\"346\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(z_1)'_{w1} f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" alt=\"(z_1)'_{w1} f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bf0\/68a\/a4d\/bf068aa4d3f0883bee8342f28ade92a8.svg\" width=\"350\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(x_1 w_1 + x_2 w_3)'_{w1} f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" alt=\"(x_1 w_1 + x_2 w_3)'_{w1} f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/290\/e86\/08d\/290e8608d4c1c82b5c4f1b08d47d5f27.svg\" width=\"442\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x_1 f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" alt=\"x_1 f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/538\/26a\/d94\/53826ad948af3d094c063c3b62f9123e.svg\" width=\"318\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f'_{w1}(z_3) = 2 x_1 f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" alt=\"f'_{w1}(z_3) = 2 x_1 f(z_1)(1 - f(z_1)) w_5 f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b8b\/37f\/a86\/b8b37fa8643ce0e3cd872b6f78c9fb26.svg\" width=\"416\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f'_{w1}(z_4) = 2 x_1 f(z_1)(1 - f(z_1)) w_6 f(z_4)(1 - f(z_4))\" alt=\"f'_{w1}(z_4) = 2 x_1 f(z_1)(1 - f(z_1)) w_6 f(z_4)(1 - f(z_4))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/94f\/3aa\/329\/94f3aa329119c28d2348eb91564b015b.svg\" width=\"416\" height=\"24\"\/><\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u043f\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_1\" alt=\"w_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/db2\/cfa\/df1\/db2cfadf122ef48fc9c429bea3ca5e7c.svg\" width=\"23\" height=\"14\"\/>: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w1}\" alt=\"E'_{w1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e63\/a67\/640\/e63a6764048de520359cf5540220ad36.svg\" width=\"33\" height=\"23\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 (o_1 - t_1) x_1 f(z_1)(1 - f(z_1)) (w_5 f(z_3)(1 - f(z_3))\" alt=\"2 (o_1 - t_1) x_1 f(z_1)(1 - f(z_1)) (w_5 f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/99d\/41f\/a31\/99d41fa31c5c9a66257ea28ef94e8676.svg\" width=\"409\" height=\"22\"\/> + <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_6 f(z_4)(1 - f(z_4)))\" alt=\"w_6 f(z_4)(1 - f(z_4)))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/93f\/c07\/215\/93fc0721549b735d4420d558768f6198.svg\" width=\"168\" height=\"22\"\/><\/p>\n<h2>\u0427\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u043f\u043e z1, z2, z3, z4<\/h2>\n<p>\u0414\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"E'_{z_3} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{z_3} = 2 ((o_1 - t_1)(f'_{z3}(z_3) - 0) + (o_2 - t_2)(f'_{z3}(z_4) - 0)) =\" alt=\"E'_{z_3} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{z_3} = 2 ((o_1 - t_1)(f'_{z3}(z_3) - 0) + (o_2 - t_2)(f'_{z3}(z_4) - 0)) =\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/baf\/09d\/529\/baf09d529c3aaba15d00ee39ff329f52.svg\" width=\"667\" height=\"67\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 (o_1 - t_1) f'_{z3}(z_3)\" alt=\"2 (o_1 - t_1) f'_{z3}(z_3)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b6b\/166\/feb\/b6b166feb1f45d3463f54f344e2f349a.svg\" width=\"142\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 (o_1 - t_1) (z_3)'_{z3} f(z_3)(1 - f(z_3))\" alt=\"2 (o_1 - t_1) (z_3)'_{z3} f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cac\/7d7\/440\/cac7d7440ebfd11e15dcec5cf534e434.svg\" width=\"270\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 (o_1 - t_1) f(z_3)(1 - f(z_3))\" alt=\"2 (o_1 - t_1) f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e7e\/844\/47d\/e7e84447d855a277cac8ea394d632009.svg\" width=\"221\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z3} = 2 (o_1 - t_1) f(z_3)(1 - f(z_3))\" alt=\"E'_{z3} = 2 (o_1 - t_1) f(z_3)(1 - f(z_3))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1ad\/c8c\/e5f\/1adc8ce5f54d47f20fbcabaf2255a3f5.svg\" width=\"277\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z_4} = 2 (o_2 - t_2) f(z_4)(1 - f(z_4))\" alt=\"E'_{z_4} = 2 (o_2 - t_2) f(z_4)(1 - f(z_4))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/08b\/970\/1e8\/08b9701e8cbd021e6a94ba62425986a1.svg\" width=\"276\" height=\"23\"\/><\/p>\n<p>\u0414\u043b\u044f \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z1} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{z1} = 2 ((o_1 - t_1) f'_{z1}(z_3) + (o_2 - t_2) f'_{z1}(z_4))\" alt=\"E'_{z1} = \\left(\\sum_{i = 1}^{2} (o_i - t_i)^2 \\right)'_{z1} = 2 ((o_1 - t_1) f'_{z1}(z_3) + (o_2 - t_2) f'_{z1}(z_4))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df2\/d09\/dd3\/df2d09dd332efa4dd77d32e1b4359fac.svg\" width=\"549\" height=\"65\"\/> =<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"2 (o_1 - t_1) (z_3)'_{z1} f(z_3)(1 - f(z_3)) + (o_2 - t_2) (z_4)'_{z1} f(z_4)(1 - f(z_4))\" alt=\"2 (o_1 - t_1) (z_3)'_{z1} f(z_3)(1 - f(z_3)) + (o_2 - t_2) (z_4)'_{z1} f(z_4)(1 - f(z_4))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae6\/e98\/e65\/ae6e98e65ad62dd8e1aefd5ee65f511d.svg\" width=\"554\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z3}(z_3)'_{z1} + E'_{z4} (z_4)'_{z1}\" alt=\"E'_{z3}(z_3)'_{z1} + E'_{z4} (z_4)'_{z1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac7\/e01\/590\/ac7e01590cb82843aa2b8a9c55502b74.svg\" width=\"181\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z3} (h_1 w_5 + h_2 w_7)'_{z1} + E'_{z4} (h_1 w_6 + h_2 w_8)'_{z1}\" alt=\"E'_{z3} (h_1 w_5 + h_2 w_7)'_{z1} + E'_{z4} (h_1 w_6 + h_2 w_8)'_{z1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/893\/7b8\/19e\/8937b819eb45ab8dbd1d1460c6a33c5d.svg\" width=\"366\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z3} (f(z_1) w_5 + f(z_2) w_7)'_{z1} + E'_{z4} (f(z_1) w_6 + f(z_2) w_8)'_{z1}\" alt=\"E'_{z3} (f(z_1) w_5 + f(z_2) w_7)'_{z1} + E'_{z4} (f(z_1) w_6 + f(z_2) w_8)'_{z1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e68\/746\/803\/e68746803f5cfe3c4d31c6aa1b9a60c6.svg\" width=\"462\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z3} f'_{z1}(z_1) w_5 + E'_{z4} f'_{z1}(z_1) w_6\" alt=\"E'_{z3} f'_{z1}(z_1) w_5 + E'_{z4} f'_{z1}(z_1) w_6\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d81\/5b3\/5be\/d815b35bedba8d92ac3adbe7ddab5da5.svg\" width=\"247\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z3} (z_1)'_{z1} f(z_1)(1 - f(z_1)) w_5 + E'_{z4} (z_1)'_{z1} f(z_1)(1 - f(z_1)) w_6\" alt=\"E'_{z3} (z_1)'_{z1} f(z_1)(1 - f(z_1)) w_5 + E'_{z4} (z_1)'_{z1} f(z_1)(1 - f(z_1)) w_6\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7a7\/456\/6e4\/7a74566e4046c171822fc9d3aad381c1.svg\" width=\"502\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(z_1)(1 - f(z_1)) (E'_{z3} w_5 + E'_{z4} w_6)\" alt=\"f(z_1)(1 - f(z_1)) (E'_{z3} w_5 + E'_{z4} w_6)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/612\/961\/b47\/612961b475b2ae01036c3fc6801b74a2.svg\" width=\"283\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z1} = f(z_1)(1 - f(z_1)) (E'_{z3} w_5 + E'_{z_4} w_6)\" alt=\"E'_{z1} = f(z_1)(1 - f(z_1)) (E'_{z3} w_5 + E'_{z_4} w_6)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e03\/916\/6ce\/e039166ce111f164e4215725d1a70216.svg\" width=\"338\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z2} = f(z_2)(1 - f(z_2)) (E'_{z3} w_7 + E'_{z_4} w_8)\" alt=\"E'_{z2} = f(z_2)(1 - f(z_2)) (E'_{z3} w_7 + E'_{z_4} w_8)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/641\/10d\/0d7\/64110d0d7726fc8ee944080a575417b3.svg\" width=\"338\" height=\"24\"\/><\/p>\n<p>\u0412\u044b\u043d\u0435\u0441\u0435\u043c \u0447\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_1\" alt=\"z_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/178\/3a9\/576\/1783a9576e92dfff1c9ca82023b8dc99.svg\" width=\"18\" height=\"14\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_2\" alt=\"z_2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c89\/d00\/aa4\/c89d00aa4623cb41f77990e520b43764.svg\" width=\"18\" height=\"14\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_3\" alt=\"z_3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f36\/4a3\/10f\/f364a310f23197b4475ca22fe548948f.svg\" width=\"18\" height=\"15\"\/>, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_4\" alt=\"z_4\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/96f\/067\/7b0\/96f0677b075081dfa1181bbd1ee1d616.svg\" width=\"18\" height=\"14\"\/> \u0438\u0437 \u0444\u043e\u0440\u043c\u0443\u043b \u0434\u043b\u044f <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_5\" alt=\"w_5\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/202\/2aa\/0a4\/2022aa0a4587cfae7d1b658b27824b64.svg\" width=\"23\" height=\"15\"\/> \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_1\" alt=\"w_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d8\/16e\/e4c\/9d816ee4c39829c6c32a8c92c44f4be2.svg\" width=\"23\" height=\"14\"\/> \u0438 \u043e\u0431\u043e\u0431\u0449\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0432 \u0432\u0438\u0434\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p>E&#8217;<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"_{w5} = 2 (o_1 - t_1) h_1 f(z_3)(1 - f(z_3)) = E'_{z3} h_1\" alt=\"_{w5} = 2 (o_1 - t_1) h_1 f(z_3)(1 - f(z_3)) = E'_{z3} h_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ae\/a1c\/037\/3aea1c037ff59ec05ddcd282c848a651.svg\" width=\"363\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w1} = 2 (o_1 - t_1) x_1 f(z_1)(1 - f(z_1)) (w_5 f(z_3)(1 - f(z_3)) + w_6 f(z_4)(1 - f(z_4)))\" alt=\"E'_{w1} = 2 (o_1 - t_1) x_1 f(z_1)(1 - f(z_1)) (w_5 f(z_3)(1 - f(z_3)) + w_6 f(z_4)(1 - f(z_4)))\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/26e\/d3b\/762\/26ed3b762eb217c0fa64ad12b8486cda.svg\" width=\"661\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z1} x_1\" alt=\"E'_{z1} x_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae7\/aed\/ff2\/ae7aedff2e1a3b8eb23ba8e8e9a2df94.svg\" width=\"50\" height=\"23\"\/><\/p>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438.<\/strong><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E = \\sum_{i = 1}^{n} {(o_i - t_i)^2}\" alt=\"E = \\sum_{i = 1}^{n} {(o_i - t_i)^2}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c81\/a70\/039\/c81a7003928c95a2bc2ac7bcaf8d9284.svg\" width=\"151\" height=\"57\"\/>, n \u2014 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{zi} = 2 (o_i - t_i) (o_i)'_{zi} = 2(o_i - t_i)o_i(1 - o_i)\" alt=\"E'_{zi} = 2 (o_i - t_i) (o_i)'_{zi} = 2(o_i - t_i)o_i(1 - o_i)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1c4\/c48\/df5\/1c4c48df545e2ba1914211c482091735.svg\" width=\"365\" height=\"24\"\/><\/p>\n<p><em>i <\/em>\u2014 \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o_i\" alt=\"o_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/355\/8e3\/8a0\/3558e38a0cb4f49b142b051eae89155f.svg\" width=\"16\" height=\"15\"\/> \u2014 i-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{zi} = (h_i)'_{zi} \\sum_{j = 1}^{m} w_j E'_{zj} = h_i(1 - h_i) \\sum_{j = 1}^{m} w_j E'_{zj}\" alt=\"E'_{zi} = (h_i)'_{zi} \\sum_{j = 1}^{m} w_j E'_{zj} = h_i(1 - h_i) \\sum_{j = 1}^{m} w_j E'_{zj}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d36\/121\/5b7\/d361215b732fd64464154a77a001562f.svg\" width=\"383\" height=\"60\"\/><\/p>\n<p>m \u2014 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043b\u043e\u0435, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_j\" alt=\"w_j\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/41b\/8e9\/d0f\/41b8e9d0fc9c29915b48bd3f4cc073e0.svg\" width=\"22\" height=\"17\"\/> \u2014 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u043c i \u0441\u043b\u043e\u044f h \u0438 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u043c j \u0441\u043b\u043e\u044f h+1, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_i\" alt=\"h_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/efa\/6ed\/871\/efa6ed871af38cda5402a2d3a8c659ee.svg\" width=\"18\" height=\"20\"\/> \u2014 \u043d\u0435\u0439\u0440\u043e\u043d \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043b\u043e\u0435, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_j\" alt=\"h_j\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/219\/730\/d8d\/219730d8dd39e4a0c4c72662684785ca.svg\" width=\"19\" height=\"22\"\/> \u2014 \u043d\u0435\u0439\u0440\u043e\u043d \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043b\u043e\u0435. \u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0441\u043a\u0440\u044b\u0442\u043e\u043c \u0441\u043b\u043e\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_j\" alt=\"h_j\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d27\/f8d\/7c7\/d27f8d7c7326746a6285b22d11d9bd73.svg\" width=\"19\" height=\"22\"\/> \u0431\u0443\u0434\u0435\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o_j\" alt=\"o_j\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d0\/18f\/b99\/9d018fb9989566214d25b3ed8dcadd47.svg\" width=\"17\" height=\"17\"\/>.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0441\u043e\u0432: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{wij} = h_i E'_{zj}\" alt=\"E'_{wij} = h_i E'_{zj}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/635\/fa7\/676\/635fa7676c959bfddf39eb0f01c78914.svg\" width=\"110\" height=\"25\"\/><\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u043e\u0435 \u0432\u0435\u0441\u043e\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_i\" alt=\"h_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dd7\/8d5\/d4c\/dd78d5d4ce0b5950d2b87c3208f3750b.svg\" width=\"18\" height=\"20\"\/> \u0431\u0443\u0434\u0435\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x_i\" alt=\"x_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1fc\/038\/586\/1fc038586c4e9db8f65240c3e9d4ca59.svg\" width=\"18\" height=\"15\"\/> (<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"f(z_i)\" alt=\"f(z_i)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b31\/14c\/7de\/b3114c7de2aa3af7bbd7e8bc0ad8e482.svg\" width=\"42\" height=\"22\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_i\" alt=\"h_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/71b\/a34\/838\/71ba34838142825581a4d680b0527e46.svg\" width=\"18\" height=\"20\"\/>).<\/p>\n<h2>\u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/47a\/a63\/538\/47aa63538fa406155424b4e39ea6debc.png\" width=\"1079\" height=\"352\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/47a\/a63\/538\/47aa63538fa406155424b4e39ea6debc.png\"\/><\/figure>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"W_1 = \\begin{pmatrix} w_1 &amp; w_3 \\\\ w_2 &amp; w_4 \\end{pmatrix} = \\begin{pmatrix} 0.2 &amp; 0.3 \\\\ 0.4 &amp; 0.5 \\end{pmatrix}\" alt=\"W_1 = \\begin{pmatrix} w_1 &amp; w_3 \\\\ w_2 &amp; w_4 \\end{pmatrix} = \\begin{pmatrix} 0.2 &amp; 0.3 \\\\ 0.4 &amp; 0.5 \\end{pmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9fd\/78d\/be5\/9fd78dbe5e3084c19193c3c77505430e.svg\" width=\"286\" height=\"50\"\/><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"W_2 = \\begin{pmatrix} w_5 &amp; w_7 \\\\ w_6 &amp; w_8 \\end{pmatrix} = \\begin{pmatrix} 0.9 &amp; 0.8 \\\\ 0.7 &amp; 0.6 \\end{pmatrix}\" alt=\"W_2 = \\begin{pmatrix} w_5 &amp; w_7 \\\\ w_6 &amp; w_8 \\end{pmatrix} = \\begin{pmatrix} 0.9 &amp; 0.8 \\\\ 0.7 &amp; 0.6 \\end{pmatrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/18a\/343\/595\/18a343595ed55a13e8d4b8b9631324ba.svg\" width=\"286\" height=\"50\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"X = (x_1, x_2)^T = (0, 1)^T\" alt=\"X = (x_1, x_2)^T = (0, 1)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d86\/05a\/3ed\/d8605a3ed56d4431a04d77b7e3e0b352.svg\" width=\"201\" height=\"25\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"H = f(W_1 \\cdot X) = (0.57, 0.62)^T\" alt=\"H = f(W_1 \\cdot X) = (0.57, 0.62)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dcd\/598\/b8e\/dcd598b8e6fe6d0699550616d856c703.svg\" width=\"260\" height=\"25\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O = f(W_2 \\cdot H) = (0.73, 0.68)^T\" alt=\"O = f(W_2 \\cdot H) = (0.73, 0.68)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cd5\/3a5\/41b\/cd53a541b4b90ba1da88d04776795dbc.svg\" width=\"258\" height=\"25\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z3} = (o_1 - t_1) f(z_3)(1 - f(z_3)) = 2(0.73 - 1) (0.73)(1 - 0.73) = -0.10\" alt=\"E'_{z3} = (o_1 - t_1) f(z_3)(1 - f(z_3)) = 2(0.73 - 1) (0.73)(1 - 0.73) = -0.10\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/308\/1ea\/148\/3081ea148a2f97fedda9993bd6d8927e.svg\" width=\"598\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z4} = (o_2 - t_2) f(z_4)(1 - f(z_4)) = 2(0.68 - 0)(0.68)(1 - 0.68) = 0.29\" alt=\"E'_{z4} = (o_2 - t_2) f(z_4)(1 - f(z_4)) = 2(0.68 - 0)(0.68)(1 - 0.68) = 0.29\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f01\/616\/e2f\/f01616e2f059359cb014e2903e419ffb.svg\" width=\"583\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z1} = f(z_1)(1 - f(z_1)) (E'_{z3} w_5 + E'_{z4} w_6)\" alt=\"E'_{z1} = f(z_1)(1 - f(z_1)) (E'_{z3} w_5 + E'_{z4} w_6)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ad\/5ea\/dc0\/9ad5eadc0a3ea12be78b0b077361bf63.svg\" width=\"339\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(0.57)(1 - 0.57)((-0.10) \\cdot 0.9 + 0.29 \\cdot 0.7) = 0.02\" alt=\"(0.57)(1 - 0.57)((-0.10) \\cdot 0.9 + 0.29 \\cdot 0.7) = 0.02\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/69d\/c15\/bc9\/69dc15bc9aa03fb6ff7cc8c94e5be22b.svg\" width=\"414\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{z2} = f(z_2)(1 - f(z_2)) (E'_{z3} w_7 + E'_{z_4} w_8)\" alt=\"E'_{z2} = f(z_2)(1 - f(z_2)) (E'_{z3} w_7 + E'_{z_4} w_8)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca5\/fce\/436\/ca5fce436fb4cb998bf9b852ee1315f7.svg\" width=\"338\" height=\"24\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(0.62)(1 - 0.62)((-0.10) \\cdot 0.8 + 0.29 \\cdot 0.6) = 0.02\" alt=\"(0.62)(1 - 0.62)((-0.10) \\cdot 0.8 + 0.29 \\cdot 0.6) = 0.02\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/036\/d70\/481\/036d70481ca4733073d1eed1c193722a.svg\" width=\"414\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w5} = E'_{z3} h_1 = -0.10 \\cdot 0.57 = -0.05\" alt=\"E'_{w5} = E'_{z3} h_1 = -0.10 \\cdot 0.57 = -0.05\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/563\/e30\/a84\/563e30a844713c951f63cc1fbfb0b7c3.svg\" width=\"312\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w6} = E'_{z4} h_1 = 0.29 \\cdot 0.57 = 0.16\" alt=\"E'_{w6} = E'_{z4} h_1 = 0.29 \\cdot 0.57 = 0.16\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/24a\/5c6\/16e\/24a5c616e1748df75d316429e576ab53.svg\" width=\"281\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w7} = E'_{z3} h_2 = -0.10 \\cdot 0.62 = -0.06\" alt=\"E'_{w7} = E'_{z3} h_2 = -0.10 \\cdot 0.62 = -0.06\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/482\/440\/ae4\/482440ae4dae2f49f2d904d27a3903b7.svg\" width=\"312\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w8} = E'_{z4} h_2 = 0.29 \\cdot 0.62 = 0.18\" alt=\"E'_{w8} = E'_{z4} h_2 = 0.29 \\cdot 0.62 = 0.18\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e8f\/e1a\/ae8\/e8fe1aae8cb4714c23d4109c28a1d639.svg\" width=\"281\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w1} = E'_{z1} x_1 = 0.02 \\cdot 0 = 0\" alt=\"E'_{w1} = E'_{z1} x_1 = 0.02 \\cdot 0 = 0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/06a\/6a1\/2bf\/06a6a12bf307ab5f61d1577e38bd38a0.svg\" width=\"231\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w2} = E'_{z2} x_1 = 0.02 \\cdot 0 = 0\" alt=\"E'_{w2} = E'_{z2} x_1 = 0.02 \\cdot 0 = 0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/236\/d73\/d10\/236d73d101843ab006bb4bd1a2c5746f.svg\" width=\"231\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w3} = E'_{z1} x_2 = 0.02 \\cdot 1 = 0.02\" alt=\"E'_{w3} = E'_{z1} x_2 = 0.02 \\cdot 1 = 0.02\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9b5\/127\/3f7\/9b51273f7c3d964e4d1893c7fc7b2fbc.svg\" width=\"256\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E'_{w4} = E'_{z2} x_2 = 0.02 \\cdot 1 = 0.02\" alt=\"E'_{w4} = E'_{z2} x_2 = 0.02 \\cdot 1 = 0.02\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d07\/6cd\/c98\/d076cdc98d61db71ac0736292a88c526.svg\" width=\"256\" height=\"23\"\/><\/p>\n<h2>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\alpha\" alt=\"\\alpha\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b4\/f23\/02c\/0b4f2302c214177c8a00a155eab4e3fd.svg\" width=\"13\" height=\"12\"\/> \u2014 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (\u0448\u0430\u0433 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430), \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 0 \u0438 1, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 0.68.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_1 = w_1 - \\alpha \\cdot E'_{w1} = 0.2 - 1 \\cdot 0 = 0.2\" alt=\"w_1 = w_1 - \\alpha \\cdot E'_{w1} = 0.2 - 1 \\cdot 0 = 0.2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/863\/6e5\/034\/8636e503422100d8901b2c27e317223b.svg\" width=\"317\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_2 = w_2 - \\alpha \\cdot E'_{w2} = 0.4 - 1 \\cdot 0 = 0.4\" alt=\"w_2 = w_2 - \\alpha \\cdot E'_{w2} = 0.4 - 1 \\cdot 0 = 0.4\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/512\/e97\/b61\/512e97b6112e85e71ac94ee152180fda.svg\" width=\"317\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_3 = w_3 - \\alpha \\cdot E'_{w3} = 0.3 - 1 \\cdot 0.02 = 0.27\" alt=\"w_3 = w_3 - \\alpha \\cdot E'_{w3} = 0.3 - 1 \\cdot 0.02 = 0.27\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/63a\/d2a\/01a\/63ad2a01aff6f67f91bcc6e4821d070b.svg\" width=\"352\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_4 = w_4 - \\alpha \\cdot E'_{w4} = 0.5 - 1 \\cdot 0.02 = 0.47\" alt=\"w_4 = w_4 - \\alpha \\cdot E'_{w4} = 0.5 - 1 \\cdot 0.02 = 0.47\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac2\/dc1\/ad1\/ac2dc1ad17680c02f0673da0b795410e.svg\" width=\"352\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_5 = w_5 - \\alpha \\cdot E'_{w5} = 0.9 - 1 \\cdot (-0.05) = 0.95\" alt=\"w_5 = w_5 - \\alpha \\cdot E'_{w5} = 0.9 - 1 \\cdot (-0.05) = 0.95\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3e2\/41a\/f9b\/3e241af9bb5f2236c4456d4cd271b606.svg\" width=\"382\" height=\"24\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_6 = w_6 - \\alpha \\cdot E'_{w6} = 0.7 - 1 \\cdot 0.16 = 0.53\" alt=\"w_6 = w_6 - \\alpha \\cdot E'_{w6} = 0.7 - 1 \\cdot 0.16 = 0.53\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/349\/cdd\/914\/349cdd9147054c070f9d2202f3ad4fcf.svg\" width=\"352\" height=\"23\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"w_7 = w_7 - \\alpha \\cdot E'_{w7} = 0.8 - 1 \\cdot (-0.06) = 0.86\" alt=\"w_7 = w_7 - \\alpha \\cdot E'_{w7} = 0.8 - 1 \\cdot (-0.06) = 0.86\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6c4\/b80\/a45\/6c4b80a4589c37faf20d04253832c0ab.svg\" width=\"382\" height=\"24\"\/><\/p>\n<p>w<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"_8 = w_8 - \\alpha \\cdot E'_{w8} = 0.6 - 1 \\cdot 0.184 = 0.41\" alt=\"_8 = w_8 - \\alpha \\cdot E'_{w8} = 0.6 - 1 \\cdot 0.184 = 0.41\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/46b\/b46\/0f0\/46bb460f01ff04059eb427711c3f8a03.svg\" width=\"347\" height=\"23\"\/><\/p>\n<h2>\u041f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_1 = x_1 \\cdot w_1 + x_2 \\cdot w_3 = 0 \\cdot 0.2 + 1 \\cdot 0.27 = 0.27\" alt=\"z_1 = x_1 \\cdot w_1 + x_2 \\cdot w_3 = 0 \\cdot 0.2 + 1 \\cdot 0.27 = 0.27\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5be\/ca7\/f8d\/5beca7f8d8d8e512a9479e35584f9606.svg\" width=\"402\" height=\"20\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_1 = f(z_1) = f(0.27) = 0.56\" alt=\"h_1 = f(z_1) = f(0.27) = 0.56\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3fd\/4f6\/488\/3fd4f648881323900a9fd97ec04c6736.svg\" width=\"239\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_2 = x_1 \\cdot w_2 + x_2 \\cdot w_4 = 0 \\cdot 0.4 + 1 \\cdot 0.47 = 0.47\" alt=\"z_2 = x_1 \\cdot w_2 + x_2 \\cdot w_4 = 0 \\cdot 0.4 + 1 \\cdot 0.47 = 0.47\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9e9\/dc9\/fe6\/9e9dc9fe6296834d873ba84c054cb4e3.svg\" width=\"402\" height=\"19\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"h_2 = f(z_2) = f(0.47) = 0.61\" alt=\"h_2 = f(z_2) = f(0.47) = 0.61\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7c4\/36b\/80a\/7c436b80afb7f44b51f8d31b30cc455f.svg\" width=\"239\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"H = f(W_1 \\cdot X) = (0.56,  0.61)^T\" alt=\"H = f(W_1 \\cdot X) = (0.56,  0.61)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/842\/0f2\/305\/8420f2305562fbc369cc563d2f174c7b.svg\" width=\"260\" height=\"25\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_3 = h_1 \\cdot w_5 + h_2 \\cdot w_7 = 0.56 \\cdot 0.95 + 0.61 \\cdot 0.86 = 1.07\" alt=\"z_3 = h_1 \\cdot w_5 + h_2 \\cdot w_7 = 0.56 \\cdot 0.95 + 0.61 \\cdot 0.86 = 1.07\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/932\/9ad\/74d\/9329ad74d58353aab8c8ccd3b750434e.svg\" width=\"463\" height=\"20\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o_1 = f(z_3) = f(1.07) = 0.74\" alt=\"o_1 = f(z_3) = f(1.07) = 0.74\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/310\/88f\/402\/31088f402477f934cd6ba8ea072ce79c.svg\" width=\"237\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"z_4 = h_1 \\cdot w_6 + h_2 \\cdot w_8 = 0.56 \\cdot 0.53 + 0.61 \\cdot 0.41 = 0.55\" alt=\"z_4 = h_1 \\cdot w_6 + h_2 \\cdot w_8 = 0.56 \\cdot 0.53 + 0.61 \\cdot 0.41 = 0.55\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/77e\/a9a\/60a\/77ea9a60adbdd61287bb72bbe11c70ca.svg\" width=\"463\" height=\"20\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"o_2 = f(z_4) = f(0.55) = 0.63\" alt=\"o_2 = f(z_4) = f(0.55) = 0.63\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/160\/3e4\/b82\/1603e4b824545a4ec1ec0bf87d52d7fa.svg\" width=\"237\" height=\"22\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"O = f(W_2 \\cdot H) = (0.74, 0.63)^T\" alt=\"O = f(W_2 \\cdot H) = (0.74, 0.63)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d80\/df4\/8e5\/d80df48e531d7ccaeb2fb1c3a314fd5c.svg\" width=\"258\" height=\"25\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"T = (t_1, t_2)^T = (1, 0)^T\" alt=\"T = (t_1, t_2)^T = (1, 0)^T\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0df\/b2d\/fb2\/0dfb2dfb243525ad6ffb049c1da92cab.svg\" width=\"189\" height=\"25\"\/><\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"E = \\sum_{i = 1}^{2} {(o_i - t_i)^2}\" alt=\"E = \\sum_{i = 1}^{2} {(o_i - t_i)^2}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/556\/1bc\/247\/5561bc247a0bc76c01c9e685e61ae8d7.svg\" width=\"151\" height=\"60\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(o_1 - t_1)^2 + (o_2 - t_1)^2\" alt=\"(o_1 - t_1)^2 + (o_2 - t_1)^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9e8\/5b6\/aea\/9e85b6aea6dd0d3429add97e8b0d544d.svg\" width=\"189\" height=\"25\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"(0.74 - 1)^2 + (0.63 - 0)^2\" alt=\"(0.74 - 1)^2 + (0.63 - 0)^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a75\/e46\/11b\/a75e4611b0ed6067d199dc8441fccd89.svg\" width=\"210\" height=\"25\"\/> = <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"0.46\" alt=\"0.46\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/401\/236\/980\/401236980956c6f79b7aa1d7cba3e30a.svg\" width=\"35\" height=\"17\"\/><\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u043e\u0441\u044c \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0441\u0442\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 1, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 0. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0438\u043c \u043c\u0435\u0442\u043a\u0430\u043c, \u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043e\u0431\u043e\u0431\u0449\u0430\u0442\u044c \u0438\u043b\u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438.<\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 binary_or.py \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0434 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432\u0435\u0441\u043e\u0432 \u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043c  \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 binary_or, \u0431\u0435\u0440\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 (0, 1), \u043a\u0430\u043a \u0432 \u0440\u0443\u0447\u043d\u043e\u043c \u0440\u0430\u0441\u0447\u0435\u0442\u0435. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0435\u0437\u043a\u0443 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 inputs, targets, labels, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\">inputs, targets, labels = binary_or() inputs = inputs[:1] targets = targets[:1] labels = labels[:1]  w1 = [[0.2, 0.3], [0.4, 0.5]]  # weights for h1 and h2 w2 = [[0.9, 0.8], [0.7, 0.6]]  # weights for o1 and o2  lr = 1  # learning rate  test(inputs, targets, w1, w2)  for epoch in range(1):     for i, inp in enumerate(inputs):         hidden_vector, output_vector = forward(inp, w1, w2)          print(hidden_vector, output_vector)          out_der = output_derivative(output_vector, targets[i])         hid_der = hidden_derivative(hidden_vector, w2, out_der)          update_weights_matrix(inp, w1, hid_der, lr, bias=False)         update_weights_matrix(hidden_vector, w2, out_der, lr, bias=False)  print() for i, inp in enumerate(inputs):     hidden_vector, output_vector = forward(inp, w1, w2)      print(hidden_vector, output_vector) test(inputs, targets, w1, w2)<\/code><\/pre>\n<pre><code>output: output: [0.73, 0.68],error: 0.54 [0.574442516811659, 0.6224593312018546] [0.7339908254341614, 0.6847278790385614]  [0.5676489083985418, 0.6172386733724463] [0.7462017913227571, 0.6359233499954247] output: [0.75, 0.64],error: 0.469<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0440\u0443\u0447\u043d\u043e\u043c \u0440\u0430\u0441\u0441\u0447\u0435\u0442\u0435. \u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u0434\u0435\u0441\u044c 3 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u00ab0\u00bb, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u00ab1\u00bb \u0432\u0441\u0435\u0433\u043e 3 \u043f\u0440\u0438\u043c\u0435\u0440\u0430.<\/p>\n<pre><code class=\"python\">def binary_or():     x = [[0, 1], [0, 0], [0, 0], [0, 0], [1, 0], [1, 1]]  # input data     t = [[1, 0], [0, 1], [0, 1], [0, 1], [1, 0], [1, 0]]  # target data     labels = [1, 0, 0, 0, 1, 1]     return x, t, labels<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f test \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"python\">def test(inputs, target_vector, w1, w2):     for i, inp in enumerate(inputs):         _, output = forward(inp, w1, w2)         print(f\"output: {[round(o, 2) for o in output]},\"               f\"error: {round(mse(output, target_vector[i]), 3)}\")<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f mse. \u0421\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0440\u0430\u0437\u043d\u0438\u0446 \u0432\u044b\u0445\u043e\u0434\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"python\">def mse(output_vector, target_vector):     res = 0      for i in range(len(output_vector)):         res += (output_vector[i] - target_vector[i]) ** 2      return res<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f forward. \u041c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"W_1\" alt=\"W_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/668\/11b\/b38\/66811bb38cfb01e6aec6964eebf98943.svg\" width=\"27\" height=\"19\"\/> \u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 inp, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440 z, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f h. \u041f\u043e\u0442\u043e\u043c \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"W_2\" alt=\"W_2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/50a\/eff\/4e7\/50aeff4e7a133d7f9aa313d63603cd7c.svg\" width=\"27\" height=\"19\"\/>, \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440 o.<\/p>\n<pre><code class=\"python\">def forward(inp, w1, w2):  # forward propagation     z = matrix_by_vector(w1, inp)     hidden_vector = vector_activation(z)      output_vector = matrix_by_vector(w2, hidden_vector)     output_vector = vector_activation(output_vector)      return hidden_vector, output_vector<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f output_derivative. \u0412 \u043d\u0435\u0439 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0432\u044b\u0448\u0435).<\/p>\n<pre><code class=\"python\">def output_derivative(output_vector, target_vertor):     out_der = [0 for _ in range(len(output_vector))]      for i in range(len(output_vector)):         out_der[i] = (output_vector[i] - target_vertor[i]) * sigmoid_der(output_vector[i]) * 2      return out_der<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f hidden_derivative. \u0412 \u043d\u0435\u0439 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u043e\u044f, \u0442\u043e\u0436\u0435 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435.<\/p>\n<pre><code class=\"python\">def hidden_derivative(current_layer, weights_matrix, next_layer_der):     current_layer_der = [0 for _ in range(len(current_layer))]      for i in range(len(current_layer)):         next_layer_der_sum = 0          for j in range(len(next_layer_der)):             next_layer_der_sum += weights_matrix[j][i] * next_layer_der[j]          current_layer_der[i] = sigmoid_der(current_layer[i]) * next_layer_der_sum      return current_layer_der<\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u0438\u043b\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f. \u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u0435\u0441 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u0443\u043c\u043d\u043e\u0436\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u0440\u044f\u043c\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438, \u0438 \u0442\u0430\u043a\u0436\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">def update_weights_matrix(input_vector, weights_matrix, out_der, lr, bias=True):     for j in range(len(out_der)):  # number of output neuron         for i in range(len(input_vector)):  # number of input neuron             weights_matrix[j][i] -= lr * input_vector[i] * out_der[j]                  if bias: weights_matrix[j][-1] -= lr * out_der[j]<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043a\u043e\u0434\u043e\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<h2>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438. \u0412 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0435\u0441\u043e\u0432, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043b\u043e\u0435 \u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u0441\u043b\u043e\u0435\u0432 \u043f\u0440\u0438 \u043f\u0440\u044f\u043c\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0435\u0432.<\/p>\n<pre><code class=\"python\">class Network:     def __init__(self, nn_structure):  # [inp_size, hid1_size, hid2_size, ... , out_size]         self.weights = []          for layer_n in range(len(nn_structure) - 1):             w = init_weights_matrix(                 inp_size=nn_structure[layer_n],                 out_size=nn_structure[layer_n + 1]             )             self.weights.append(w)          self.layers_z = [[] for _ in range(len(self.weights))]         self.layers = [[] for _ in range(len(self.weights))]<\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 forward \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 x. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432. \u0412\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432.<\/p>\n<pre><code class=\"python\">def _forward(self, x):     self.layers_z[0] = matrix_by_vector(self.weights[0], x)     self.layers[0] = vector_activation(self.layers_z[0])      for i in range(1, len(self.weights)):         self.layers_z[i] = matrix_by_vector(self.weights[i], self.layers[i - 1])         self.layers[i] = vector_activation(self.layers_z[i])<\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 train \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \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 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440, \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0448\u0430\u0433\u0430 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430. \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 forward, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u043b\u043e\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 output_derivative \u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043b\u043e\u0435\u0432. \u0417\u0430\u0442\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0435\u0441\u0430 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0438 \u0434\u043b\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f.<\/p>\n<pre><code class=\"python\">def train(self, x, t, lr=0.5):  # lr - learning rate     self._forward(x)      layers_der = [[] for _ in range(len(self.layers))]  # derivatives      layers_der[-1] = output_derivative(self.layers[-1], t)     for i in range(1, len(self.layers)):         idx = -(i + 1)         layers_der[idx] = hidden_derivative(self.layers[idx], self.weights[idx + 1], layers_der[idx + 1])      update_weights_matrix(x, self.weights[0], layers_der[0], lr)     for i in range(1, len(self.weights)):         update_weights_matrix(self.layers[i - 1], self.weights[i], layers_der[i], lr)<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 predict \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0432\u044b\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 (\u043c\u0435\u0442\u043a\u0435).<\/p>\n<pre><code class=\"python\">def predict(self, x):     self._forward(x)     return [round(self.layers[-1][i], 2) for i in range(len(self.layers[-1]))]<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441. \u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0435\u0432 \u2014 3, \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435 784 \u043d\u0435\u0439\u0440\u043e\u043d\u0430, \u0432 \u0441\u043a\u0440\u044b\u0442\u043e\u043c \u2014 100 \u0438 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u2014 10. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 MNIST \u2014 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u0435 (\u043e\u0434\u043d\u043e\u043a\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0435) \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f 28 \u043d\u0430 28 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 (28*28=784). \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 10 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (\u0446\u0438\u0444\u0440\u044b \u043e\u0442 0 \u0434\u043e 9) \u043f\u043e \u0448\u043a\u0430\u043b\u0435 \u043e\u0442 0 \u0434\u043e 1. \u041e\u0442\u0432\u0435\u0442\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430 \u0446\u0438\u0444\u0440\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">model = Network(nn_structure=[784, 100, 10]) x, t, labels = mnist_100(samples_n=3)  epochs_n = 20  print(\"\\nlabels =\", labels) test(model, x, t) print()  for epoch in range(1, epochs_n + 1):     for i, inp in enumerate(x):         model.train(inp, t[i], lr=0.1)      print(f\"epoch: {epoch}, error: {round(batch_mse(model, x, t), 4)}\")      test(model, x, t)     print()  print(\"\\nlabels =\", labels) test(model, x, t)<\/code><\/pre>\n<pre><code>output: labels = [5, 0, 4] output: [0.42, 0.58, 0.34, 0.57, 0.74, 0.55, 0.6, 0.32, 0.44, 0.54], error: 2.6487 output: [0.41, 0.55, 0.34, 0.57, 0.78, 0.56, 0.61, 0.34, 0.43, 0.54], error: 2.9893 output: [0.44, 0.58, 0.32, 0.55, 0.76, 0.55, 0.6, 0.34, 0.46, 0.53], error: 2.2664 \u2026 labels = [5, 0, 4] output: [0.27, 0.04, 0.04, 0.04, 0.13, 0.63, 0.04, 0.04, 0.04, 0.04], error: 0.2373 output: [0.71, 0.04, 0.04, 0.04, 0.16, 0.18, 0.05, 0.04, 0.04, 0.04], error: 0.1556 output: [0.17, 0.04, 0.04, 0.04, 0.83, 0.17, 0.04, 0.04, 0.04, 0.04], error: 0.0992<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0445\u0430\u043e\u0442\u0438\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u043a\u043e\u043b\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0.5, \u044d\u0442\u043e \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u0440\u0430\u0432\u043d\u043e 0.5, \u0430 \u0432\u0435\u0441\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043e\u0442 -1 \u0434\u043e 1, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u0435\u0437\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 z \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u043e\u043a\u043e\u043b\u043e \u043d\u0443\u043b\u044f.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0435\u0445 \u0446\u0438\u0444\u0440\u0430\u0445: 5, 0, 4. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0437 10 \u0447\u0438\u0441\u0435\u043b. \u0414\u043b\u044f \u043c\u0435\u0442\u043a\u0438 \u00ab5\u00bb &#8212; \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0434\u043b\u044f \u043c\u0435\u0442\u043a\u0438 \u00ab4\u00bb &#8212; \u0442\u0440\u0435\u0442\u0438\u0439. \u041e\u0442\u0432\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0446\u0438\u0444\u0440\u0430 \u00ab5\u00bb, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 0.55, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f 0.63. \u0414\u043b\u044f \u043c\u0435\u0442\u043a\u0438 \u00ab4\u00bb &#8212; \u0434\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f 0.76, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f 0.83. \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0446\u0438\u0444\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c\u0441\u044f, \u0430 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c\u0441\u044f. \u041e\u0431\u0449\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0442\u043e\u0436\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code>output: epoch: 1, error: 0.9574 ... epoch: 20, error: 0.1641<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f mnist_100. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 digits, \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0435 100 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 MNIST. \u041e\u043d\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 matplotlib.pyplot. \u041a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443 \u043d\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 28\u02df28\u02df3 \u043d\u0430 1\u02df784, \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f (\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442 1 \u0434\u043e 255) \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 255, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 0 \u0434\u043e 1. \u041f\u043e\u0442\u043e\u043c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">def mnist_100(samples_n=5):     import matplotlib.pyplot as plt     # max samples == 100     x = []  # input data      for i in range(samples_n):  # loading images         img = plt.imread(f\"digits\/images\/{i}.jpg\")         img = img[:, :, 0].reshape(784) \/ 255  # change shape from 28x28x3 to 1x784         x.append(list(img))      t = []  # target data     labels = []     with open(\"digits\/labels.txt\", 'r') as file:  # loading labels         for i in range(samples_n):             t.append([0 for _ in range(10)])             digit_label = int(file.readline())             labels.append(digit_label)             t[i][digit_label] = 1      return x, t, labels<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042f \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u043e\u0431\u043e\u0431\u0449\u0438\u043b \u0438\u0445 \u0432\u044b\u0432\u043e\u0434 \u0432 \u0432\u0438\u0434\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u043e\u043a\u0430\u0437\u0430\u043b \u0440\u0443\u0447\u043d\u043e\u0439 \u0440\u0430\u0441\u0447\u0435\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u043d\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043b\u0443\u0447\u0448\u0435, \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u043d\u0443\u043b\u044f. \u042d\u0442\u043e \u043b\u0438\u0448\u044c \u0443\u0447\u0435\u0431\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0434\u043b\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u043e\u0439\u0442\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043d\u043e\u0432\u044b\u0445 \u0438\u0434\u0435\u0439 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0441 \u043d\u0443\u043b\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0418\u0418.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0442\u043e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0439\u0442\u0435. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043c\u043e\u0439 <a href=\"https:\/\/t.me\/tdi_project_community_channel\" rel=\"noopener noreferrer nofollow\">\u0422\u0413\u041a<\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043c\u043e\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0435\u043c\u044b \u043f\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u0438 \u0438\u0434\u0435\u0438 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0430.<\/p>\n<p><a href=\"https:\/\/github.com\/neuromancertdi\/tdi-project\/tree\/main\/%D0%93%D0%BB%D1%83%D0%B1%D0%BE%D0%BA%D0%BE%D0%B5%20%D0%BE%D0%B1%D1%83%D1%87%D0%B5%D0%BD%D0%B8%D0%B5\/back_propagation\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043a\u043e\u0434\u043e\u043c \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 \u0413\u0438\u0442\u0425\u0430\u0431\u0435.<\/p>\n<\/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\/871648\/\"> https:\/\/habr.com\/ru\/articles\/871648\/<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u043c\u0430\u0437 \u0425\u0443\u0441\u043d\u0443\u0442\u0434\u0438\u043d\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043f\u0440\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439.<\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435: \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\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 \u0440\u0443\u0447\u043d\u043e\u0439 \u0440\u0430\u0441\u0447\u0435\u0442, \u0432\u044b\u0432\u043e\u0434 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445, \u0432\u044b\u0432\u043e\u0434 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0440\u0443\u0447\u043d\u043e\u0439 \u0440\u0430\u0441\u0447\u0435\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f MNIST.<\/p>\n<h2>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430 \u0447\u0438\u0441\u0435\u043b \u2014 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (0, 1), \u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u00ab1\u00bb, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u00ab0\u00bb.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/figcaption><\/div>\n<\/figure>\n<p> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p> &#8212; \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p> &#8212; \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f,<\/p>\n<p> &#8212; \u0432\u0435\u043a\u0442\u043e\u0440 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u043c\u0435\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432).<\/p>\n<p>\u0412\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u0431\u0443\u043a\u0432\u0430  \u0432 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435 &#8212; \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0438 \u0441\u043a\u0440\u044b\u0442\u044b\u043c \u0441\u043b\u043e\u044f\u043c\u0438:<\/p>\n<p>\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0435\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u0440\u044b\u0442\u044b\u043c \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0441\u043b\u043e\u044f\u043c\u0438:<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430:<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 MSE:<\/p>\n<p>i \u2014 \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430, 2 \u2014 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432. \u041e\u0431\u044b\u0447\u043d\u043e \u0435\u0449\u0435 \u0432\u0441\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (\u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432), \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<h2>\u041f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e 6 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438) \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0442\u043e\u043b\u044c\u043a\u043e 2 \u0437\u043d\u0430\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u043b.<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b 2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438: 1 \u0438\u043b\u0438 0. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 2 \u043d\u0435\u0439\u0440\u043e\u043d\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b 0 \u0438 1 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e 1, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430<\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<h2>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 (\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c), \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 (\u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438). \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438), \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0434\u043e\u043c\u043d\u043e\u0436\u0438\u0432 \u043d\u0430 \u0448\u0430\u0433 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 &#8212; .<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 E \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 (\u0432 \u0442\u043e\u0447\u043a\u0435 (, )), \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432\u043b\u0435\u0432\u043e (\u0442\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c), \u0438 \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0431\u044b\u0432\u0430\u0435\u0442 (\u0432 \u0442\u043e\u0447\u043a\u0435 (, ), \u0442\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432\u043f\u0440\u0430\u0432\u043e (\u0442\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0438 \u043f\u0440\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u043b\u044e\u0441). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \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 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043e.<\/p>\n<p>\u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: <\/p>\n<h2>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u043f\u043e z<\/h2>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u043f\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0443: <\/p>\n<h2>\u0427\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u043f\u043e w5 \u0438 w1<\/h2>\n<p>\u0427\u0430\u0441\u0442\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u043b\u044f :<\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0434\u043b\u044f ,  \u043f\u043e :<\/p>\n<p><em> = <\/em> =  = <\/p>\n<p><em> = <\/em> =  = <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0434\u043b\u044f : <\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u0434\u043b\u044f :<\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0434\u043b\u044f ,  \u043f\u043e :<\/p>\n<p><em> = <\/em> =  =  =  =  =  =  = <\/p>\n<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u043f\u043e :  =  + <\/p>\n<h2>\u0427\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u043f\u043e z1, z2, z3, z4<\/h2>\n<p>\u0414\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f:<\/p>\n<p> =  = <\/p>\n<\/p>\n<p>\u0414\u043b\u044f \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f:<\/p>\n<p> =<\/p>\n<p> =  =  =  =  =  = <\/p>\n<\/p>\n<p>\u0412\u044b\u043d\u0435\u0441\u0435\u043c \u0447\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 , , ,  \u0438\u0437 \u0444\u043e\u0440\u043c\u0443\u043b \u0434\u043b\u044f  \u0438  \u0438 \u043e\u0431\u043e\u0431\u0449\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0432 \u0432\u0438\u0434\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p>E&#8217;<\/p>\n<p> = <\/p>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438.<\/strong><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438: , n \u2014 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043b\u043e\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432:<\/p>\n<\/p>\n<p><em>i <\/em>\u2014 \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430,  \u2014 i-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432:<\/p>\n<\/p>\n<p>m \u2014 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043b\u043e\u0435,  \u2014 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u043c i \u0441\u043b\u043e\u044f h \u0438 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u043c j \u0441\u043b\u043e\u044f h+1,  \u2014 \u043d\u0435\u0439\u0440\u043e\u043d \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043b\u043e\u0435,  \u2014 \u043d\u0435\u0439\u0440\u043e\u043d \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043b\u043e\u0435. \u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0441\u043a\u0440\u044b\u0442\u043e\u043c \u0441\u043b\u043e\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435  \u0431\u0443\u0434\u0435\u0442 .<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0441\u043e\u0432: <\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u043e\u0435 \u0432\u0435\u0441\u043e\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435  \u0431\u0443\u0434\u0435\u0442  ( = ).<\/p>\n<h2>\u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435<\/h2>\n<figure class=\"full-width\"><\/figure>\n<\/p>\n<\/p>\n<\/p>\n<p> = <\/p>\n<p> = <\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<h2>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432<\/h2>\n<p> \u2014 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (\u0448\u0430\u0433 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430), \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 0 \u0438 1, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 0.68.<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<p>w<\/p>\n<h2>\u041f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432<\/h2>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432:<\/p>\n<p> =  =  = <\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u043e\u0441\u044c \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0441\u0442\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 1, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 0. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0438\u043c \u043c\u0435\u0442\u043a\u0430\u043c, \u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043e\u0431\u043e\u0431\u0449\u0430\u0442\u044c \u0438\u043b\u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438.<\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 binary_or.py \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0434 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432\u0435\u0441\u043e\u0432 \u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043c  \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u00ab\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043b\u0438\u00bb.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 binary_or, \u0431\u0435\u0440\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 (0, 1), \u043a\u0430\u043a \u0432 \u0440\u0443\u0447\u043d\u043e\u043c \u0440\u0430\u0441\u0447\u0435\u0442\u0435. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0435\u0437\u043a\u0443 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 inputs, targets, labels, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\">inputs, targets, labels = binary_or() inputs = inputs[:1] targets = targets[:1] labels = labels[:1]  w1 = [[0.2, 0.3], [0.4, 0.5]]  # weights for h1 and h2 w2 = [[0.9, 0.8], [0.7, 0.6]]  # weights for o1 and o2  lr = 1  # learning rate  test(inputs, targets, w1, w2)  for epoch in range(1):     for i, inp in enumerate(inputs):         hidden_vector, output_vector = forward(inp, w1, w2)          print(hidden_vector, output_vector)          out_der = output_derivative(output_vector, targets[i])         hid_der = hidden_derivative(hidden_vector, w2, out_der)          update_weights_matrix(inp, w1, hid_der, lr, bias=False)         update_weights_matrix(hidden_vector, w2, out_der, lr, bias=False)  print() for i, inp in enumerate(inputs):     hidden_vector, output_vector = forward(inp, w1, w2)      print(hidden_vector, output_vector) test(inputs, targets, w1, w2)<\/code><\/pre>\n<pre><code>output: output: [0.73, 0.68],error: 0.54 [0.574442516811659, 0.6224593312018546] [0.7339908254341614, 0.6847278790385614]  [0.5676489083985418, 0.6172386733724463] [0.7462017913227571, 0.6359233499954247] output: [0.75, 0.64],error: 0.469<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0440\u0443\u0447\u043d\u043e\u043c \u0440\u0430\u0441\u0441\u0447\u0435\u0442\u0435. \u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u0434\u0435\u0441\u044c 3 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u00ab0\u00bb, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u00ab1\u00bb \u0432\u0441\u0435\u0433\u043e 3 \u043f\u0440\u0438\u043c\u0435\u0440\u0430.<\/p>\n<pre><code class=\"python\">def binary_or():     x = [[0, 1], [0, 0], [0, 0], [0, 0], [1, 0], [1, 1]]  # input data     t = [[1, 0], [0, 1], [0, 1], [0, 1], [1, 0], [1, 0]]  # target data     labels = [1, 0, 0, 0, 1, 1]     return x, t, labels<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f test \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"python\">def test(inputs, target_vector, w1, w2):     for i, inp in enumerate(inputs):         _, output = forward(inp, w1, w2)         print(f\"output: {[round(o, 2) for o in output]},\"               f\"error: {round(mse(output, target_vector[i]), 3)}\")<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f mse. \u0421\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0440\u0430\u0437\u043d\u0438\u0446 \u0432\u044b\u0445\u043e\u0434\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"python\">def mse(output_vector, target_vector):     res = 0      for i in range(len(output_vector)):         res += (output_vector[i] - target_vector[i]) ** 2      return res<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f forward. \u041c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b  \u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 inp, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440 z, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f h. \u041f\u043e\u0442\u043e\u043c \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 , \u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440 o.<\/p>\n<pre><code class=\"python\">def forward(inp, w1, w2):  # forward propagation     z = matrix_by_vector(w1, inp)     hidden_vector = vector_activation(z)      output_vector = matrix_by_vector(w2, hidden_vector)     output_vector = vector_activation(output_vector)      return hidden_vector, output_vector<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f output_derivative. \u0412 \u043d\u0435\u0439 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0432\u044b\u0448\u0435).<\/p>\n<pre><code class=\"python\">def output_derivative(output_vector, target_vertor):     out_der = [0 for _ in range(len(output_vector))]      for i in range(len(output_vector)):         out_der[i] = (output_vector[i] - target_vertor[i]) * sigmoid_der(output_vector[i]) * 2      return out_der<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f hidden_derivative. \u0412 \u043d\u0435\u0439 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u043e\u044f, \u0442\u043e\u0436\u0435 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435.<\/p>\n<pre><code class=\"python\">def hidden_derivative(current_layer, weights_matrix, next_layer_der):     current_layer_der = [0 for _ in range(len(current_layer))]      for i in range(len(current_layer)):         next_layer_der_sum = 0          for j in range(len(next_layer_der)):             next_layer_der_sum += weights_matrix[j][i] * next_layer_der[j]          current_layer_der[i] = sigmoid_der(current_layer[i]) * next_layer_der_sum      return current_layer_der<\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u0438\u043b\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f. \u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u0435\u0441 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u0443\u043c\u043d\u043e\u0436\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u0440\u044f\u043c\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438, \u0438 \u0442\u0430\u043a\u0436\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">def update_weights_matrix(input_vector, weights_matrix, out_der, lr, bias=True):     for j in range(len(out_der)):  # number of output neuron         for i in range(len(input_vector)):  # number of input neuron             weights_matrix[j][i] -= lr * input_vector[i] * out_der[j]                  if bias: weights_matrix[j][-1] -= lr * out_der[j]<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043a\u043e\u0434\u043e\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<h2>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438. \u0412 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432\u0435\u0441\u043e\u0432, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043b\u043e\u0435 \u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u0441\u043b\u043e\u0435\u0432 \u043f\u0440\u0438 \u043f\u0440\u044f\u043c\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0435\u0432.<\/p>\n<pre><code class=\"python\">class Network:     def __init__(self, nn_structure):  # [inp_size, hid1_size, hid2_size, ... , out_size]         self.weights = []          for layer_n in range(len(nn_structure) - 1):             w = init_weights_matrix(                 inp_size=nn_structure[layer_n],                 out_size=nn_structure[layer_n + 1]             )             self.weights.append(w)          self.layers_z = [[] for _ in range(len(self.weights))]         self.layers = [[] for _ in range(len(self.weights))]<\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 forward \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-444170","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444170","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=444170"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444170\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}