{"id":303553,"date":"2020-05-14T09:00:14","date_gmt":"2020-05-14T09:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303553"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303553","title":{"rendered":"\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c EM-algorithm \u043d\u0430 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u043a\u0438\u0440\u043f\u0438\u0447\u0438\u043a\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/501850\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hp\/mv\/ng\/hpmvngrdxhgiu_a7b9vjyx4shsm.jpeg\"><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043a\u0430\u043a \u0412\u044b \u0443\u0436\u0435, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u0442\u0438\u0445\u043e\u043d\u0435\u0447\u043a\u0443 \u0443\u0436\u0435 \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u0442\u0430\u0441\u0430\u0439\u043d\u0442\u0438\u0441\u0442\u043e\u0432. \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0442\u0435\u043c, \u043a\u0442\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u0440\u0435\u0442\u0438\u0439 \u043a\u0443\u0440\u0441 \u00ab\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u00ab\u041c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb \u043e\u0442 \u041c\u0424\u0422\u0418 \u0438 \u042f\u043d\u0434\u0435\u043a\u0441. <\/p>\n<p>  \u0418\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u043c\u044b\u0441\u043b\u0435, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u044b\u0448\u0435\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u043a\u0443\u0440\u0441\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043d\u0430\u0448\u0435\u043c\u0443 \u043c\u043d\u043e\u0433\u043e\u0443\u0432\u0430\u0436\u0430\u0435\u043c\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 (\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b), \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0445 \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0430\u0442\u0441\u0442\u0430\u0442\u0430, \u043d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0438\u043c\u0435\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u0425\u043e\u0442\u044f, \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0438 \u0431\u0435\u0437 \u044d\u0442\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u0447\u0442\u043e-\u0442\u043e \u0434\u0430 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \ud83d\ude42<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043f\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438, \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u0439, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043d\u0430\u0441 \u043f\u0440\u044f\u043c\u0451\u0445\u043e\u043d\u044c\u043a\u043e \u043a \u0440\u0430\u0437\u0431\u043e\u0440\u0443 \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u043e\u0434. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 python 2.7, \u0438 \u0437\u0430 \u044d\u0442\u043e \u044f \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0438\u043d\u043e\u0448\u0443 \u0438\u0437\u0432\u0438\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u0432\u044b\u0448\u043b\u043e, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044e, \u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 python 3, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. <a name=\"habracut\"><\/a><\/p>\n<p>  <b>\u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043f\u043b\u0430\u043d\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438:<\/b><\/p>\n<p>  1) \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445 \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<\/p>\n<p>  2) \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0442\u0435\u043e\u0440\u0435\u043c\u044b (\u0444\u043e\u0440\u043c\u0443\u043b\u044b) \u0411\u0430\u0439\u0435\u0441\u0430: <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6ed\/9a8\/77f\/6ed9a877f0dad55fba6f708e16950abd.svg\" alt=\"$P_{x_i}(B_j) = \\frac{P(B_j) \\centerdot P_{B_j}(x_i)}{P(x_i)} $\" data-tex=\"display\"><\/math><\/p>\n<p>  3) \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0411\u0430\u0439\u0435\u0441\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0444\u043e\u0440\u043c\u0443\u043b\u044b (\u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4e0\/f18\/335\/4e0f18335820a31610266cb8b156086a.svg\" alt=\"$P(B_j), P_{B_j}(x_i)$\" data-tex=\"inline\"><\/math>) \u0437\u0430 \u0437\u043d\u0430\u043a\u043e\u043c \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u0441\u043f\u0440\u0430\u0432\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0446\u0438\u0444\u0440\u044b \u043a\u0443\u0434\u0430 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  4) \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0411\u0430\u0439\u0435\u0441\u0430. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0436\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f (<math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math>) \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (<math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/110\/1f7\/f1d\/1101f7f1d1aec650590429c7c6d5e00a.svg\" alt=\"$B_j$\" data-tex=\"inline\"><\/math>) \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e07\/47d\/5c4\/e0747d5c4d2c99b6e22cdaa77e588e10.svg\" alt=\"$\\rho_{B_j}(x_i)$\" data-tex=\"inline\"><\/math>. \u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u0434\u0430\u043d\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e, \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math>. \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/905\/165\/8f8\/9051658f8729851bc3e10f00f6d1e456.svg\" alt=\"$\\rho_{B_j}(x_i) = \\frac{1}{\\sigma_j \\centerdot \\sqrt{2 \\pi}} \\centerdot \\exp(- \\frac{(x_i-\\mu_j)^2}{2 \\sigma_j^2}) $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0448\u0435\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e (\u0438\u043d\u0430\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u2014 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0413\u0430\u0443\u0441\u0441\u0430 \u0438\u043b\u0438 \u0413\u0430\u0443\u0441\u0441\u0430-\u041b\u0430\u043f\u043b\u0430\u0441\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439).<\/p>\n<p>  5) \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u0432 \u043d\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e (\u0432 \u043d\u0430\u0448\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e) \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e94\/ab1\/e89\/e94ab1e897aac6c79ef9e3afdd4c5c2f.svg\" alt=\"$\\rho_{B_j}(x_i) = \\frac{1}{(2\\pi)^{k\/2} \\centerdot \\mid \\Sigma_j\\mid ^{1\/2}} \\centerdot \\exp(- \\frac{1}{2} \\centerdot (x_i-\\mu_j)^T \\Sigma_j^{-1} (x_i-\\mu_j))$\" data-tex=\"display\"><\/math><\/p>\n<p>  6) \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p>  7) \u0412 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438, \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 sklearn (class sklearn.mixture.GaussianMixture)<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0412\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0444\u043e\u0440\u043c\u0443\u043b, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u043b\u0430\u043d\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u044f\u043f\u043e\u043d\u0441\u043a\u0438\u0435 \u0438\u0435\u0440\u043e\u0433\u043b\u0438\u0444\u044b, \u0442\u043e \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043d\u0435 \u043f\u0443\u0433\u0430\u0439\u0442\u0435\u0441\u044c \u2014 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u043e\u0440\u0435\u043c\u044b \u0411\u0430\u0439\u0435\u0441\u0430 (\u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u043f\u043b\u0430\u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u0438), \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0412\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043d\u0430 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u041d\u0443 \u0447\u0442\u043e \u0436\u0435, \u043f\u043e\u0433\u043d\u0430\u043b\u0438!<\/p>\n<h3>EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445<\/h3>\n<p>  \u041d\u0430 \u043a\u0443\u0440\u0441\u0435, \u043f\u043e \u043c\u043e\u0442\u0438\u0432\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0443\u0447\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u0438\u043c\u0435\u044e\u0449\u0435\u0439 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435. EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (\u0430\u043d\u0433\u043b. expectation-maximization) \u2014 \u044d\u0442\u043e \u043e\u0431\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0446\u0435\u043d\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u0438\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0441\u043e \u0441\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437 \u0441\u043c\u0435\u0441\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c (\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u0442\u044c) \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u0434\u0432\u0430 \u0448\u0430\u0433\u0430:<\/p>\n<p>  <b>E-\u0448\u0430\u0433<\/b>. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c E-\u0448\u0430\u0433\u0435 \u043c\u044b \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443. \u041f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 E-\u0448\u0430\u0433\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 M-\u0448\u0430\u0433\u0430\u0445.<\/p>\n<p>  <b>M-\u0448\u0430\u0433<\/b>. \u041d\u0430 M-\u0448\u0430\u0433\u0435 \u043c\u044b, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 E-\u0448\u0430\u0433\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443, \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0418\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0442 \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0430 \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u041f\u043e\u0441\u0442\u0443\u043f\u0438\u043c \u043f\u0440\u043e\u0449\u0435 \u2014 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0448\u0430\u0433\u043e\u0432.<\/p>\n<p>  M-\u0448\u0430\u0433 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0432 \u044d\u0442\u043e\u043c \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0443\u0434\u0435\u043b\u0438\u043c E-\u0448\u0430\u0433\u0443. <\/p>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 E-\u0448\u0430\u0433\u0430 \u043b\u0435\u0436\u0438\u0442 \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0411\u0430\u0439\u0435\u0441\u0430, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0430 \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u043e \u0447\u0435\u043c \u044d\u0442\u0430 \u0442\u0435\u043e\u0440\u0435\u043c\u0430.<\/p>\n<h3>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0411\u0430\u0439\u0435\u0441\u0430<\/h3>\n<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6ed\/9a8\/77f\/6ed9a877f0dad55fba6f708e16950abd.svg\" alt=\"$P_{x_i}(B_j) = \\frac{P(B_j) \\centerdot P_{B_j}(x_i)}{P(x_i)} $\" data-tex=\"display\"><\/math><\/p>\n<p>  , \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/855\/a3d\/bbe\/855a3dbbe569c9bf7365cea464b06eb6.svg\" alt=\"$P_{x_i}(B_j)$\" data-tex=\"inline\"><\/math> \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u043b\u0430 \u043c\u0435\u0441\u0442\u043e \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/110\/1f7\/f1d\/1101f7f1d1aec650590429c7c6d5e00a.svg\" alt=\"$B_j$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c09\/593\/cc7\/c09593cc76a93b077923909bb42d9f9d.svg\" alt=\"$P(B_j)$\" data-tex=\"inline\"><\/math> \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/110\/1f7\/f1d\/1101f7f1d1aec650590429c7c6d5e00a.svg\" alt=\"$B_j$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d8b\/fdd\/c35\/d8bfddc35669f6d63f1a214886faf224.svg\" alt=\"$P_{B_j}(x_i)$\" data-tex=\"inline\"><\/math> \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/110\/1f7\/f1d\/1101f7f1d1aec650590429c7c6d5e00a.svg\" alt=\"$B_j$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4ae\/c29\/664\/4aec296643f1c3c00eaf3825228c1f10.svg\" alt=\"$P(x_i)$\" data-tex=\"inline\"><\/math> \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (\u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u043f\u043e\u043b\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f)<\/p>\n<p>  \u041f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u0443\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/110\/1f7\/f1d\/1101f7f1d1aec650590429c7c6d5e00a.svg\" alt=\"$B_j$\" data-tex=\"inline\"><\/math> \u043f\u0435\u0440\u0435\u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c09\/593\/cc7\/c09593cc76a93b077923909bb42d9f9d.svg\" alt=\"$P(B_j)$\" data-tex=\"inline\"><\/math> \u044d\u0442\u043e \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (\u0434\u043e \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f), \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/855\/a3d\/bbe\/855a3dbbe569c9bf7365cea464b06eb6.svg\" alt=\"$P_{x_i}(B_j)$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0439 \u0436\u0435 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b, \u043e\u0446\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u0435\u0441\u0442\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430 \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0411\u0430\u0439\u0435\u0441\u0430<\/h3>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430 \u0441\u043a\u043b\u0430\u0434 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0434\u0435\u0442\u0430\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u043a\u0430\u0445. \u0418\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0445 \u043d\u0430 \u0441\u043a\u043b\u0430\u0434 \u0438\u0437\u0434\u0435\u043b\u0438\u0439:<\/p>\n<p>  \u0412\u0441\u0435\u0433\u043e \u043d\u0430 \u0441\u043a\u043b\u0430\u0434 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u2014 10000 \u0448\u0442 (<math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/939\/acc\/7b0\/939acc7b0eca8746c5fdecfdb3c5e0d0.svg\" alt=\"$N = 10000$\" data-tex=\"inline\"><\/math>), \u0438\u0437 \u043d\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435 \u2014 6000 \u0448\u0442. (<math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/081\/fe5\/dc7\/081fe5dc72ecb82a865f03df6cbbc03a.svg\" alt=\"$N1 = 6000$\" data-tex=\"inline\"><\/math>), \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u2014 4000 \u0448\u0442. (<math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/51b\/59d\/5a9\/51b59d5a964a2177010300707ce21c16.svg\" alt=\"$N2 = 4000$\" data-tex=\"inline\"><\/math>).<\/p>\n<p>  \u0414\u043e\u043b\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 (\u0442.\u0435. \u043d\u0435 \u0431\u0440\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0445) \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 0.9, \u0434\u043e\u043b\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 0.8.<\/p>\n<p>  \u041c\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u043b\u0438 \u0438\u0437 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u043e\u0434\u043d\u0443 \u0434\u0435\u0442\u0430\u043b\u044c, \u0438 \u043e\u043d\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439. <\/p>\n<p>  \u041d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e:<\/p>\n<p>  1) \u0434\u0435\u0442\u0430\u043b\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 1-\u043c \u0441\u0442\u0430\u043d\u043a\u0435;<\/p>\n<p>  2) \u0434\u0435\u0442\u0430\u043b\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 2-\u043c \u0441\u0442\u0430\u043d\u043a\u0435.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b><\/p>\n<p>  <b>1)<\/b> \u0421\u043e\u0431\u044b\u0442\u0438\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/817\/b92\/407\/817b92407f764f57af9226e50cc788fd.svg\" alt=\"$x$\" data-tex=\"inline\"><\/math> \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u044f.<\/p>\n<p>  <b>2)<\/b> \u0422\u0435\u043f\u0435\u0440\u044c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430\u043c\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/110\/1f7\/f1d\/1101f7f1d1aec650590429c7c6d5e00a.svg\" alt=\"$B_j$\" data-tex=\"inline\"><\/math>. \u0423 \u043d\u0430\u0441 \u0434\u0432\u0435 \u043f\u0430\u0440\u0442\u0438\u0438 \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u0432\u0435 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b:<\/p>\n<p>  \u0413\u0438\u043f\u043e\u0442\u0435\u0437\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c74\/4af\/9a3\/c744af9a3fd994e29adef0807ad1d10b.svg\" alt=\"$B_1$\" data-tex=\"inline\"><\/math>: \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161.<\/p>\n<p>  \u0413\u0438\u043f\u043e\u0442\u0435\u0437\u0430 $B_2$: \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162.<\/p>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a1f\/5b4\/54a\/a1f5b454af180b5ffb2a35ebf2df6230.svg\" alt=\"$P(B_1)$\" data-tex=\"inline\"><\/math> \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/21a\/dfb\/c50\/21adfbc506d6887e3003133536ab8be7.svg\" alt=\"$N1\/N = 6000\/10000 = 0.6$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2e9\/b1d\/64b\/2e9b1d64bd553969900a397ad7fc7c6b.svg\" alt=\"$P(B_2)$\" data-tex=\"inline\"><\/math> \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/eb4\/e48\/83e\/eb4e4883ee4516500adc51410a5fe980.svg\" alt=\"$N2\/N = 0.4$\" data-tex=\"inline\"><\/math>. \u041f\u0440\u0438\u0447\u0435\u043c \u043d\u0430\u043c \u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u0438\u043b\u0438 \u0431\u0440\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435, \u0432\u0430\u0436\u043d\u043e \u0438\u0437 \u043a\u0430\u043a\u043e\u0439 \u043e\u043d\u043e \u043f\u0430\u0440\u0442\u0438\u0438.<\/p>\n<p>  <b>3)<\/b> \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u0438\u0437 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 (\u0442\u043e \u0435\u0441\u0442\u044c, \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 0.9, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/664\/1ae\/5a8\/6641ae5a858ec08e78b7abf7d791e889.svg\" alt=\"$P_{B_1}(x_i) = 0.9$\" data-tex=\"inline\"><\/math>. <\/p>\n<p>  \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u21162 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b51\/795\/aa5\/b51795aa5df7b1958b66a4eef64282e6.svg\" alt=\"$P_{B_2}(x_i) = 0.8$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <b>4)<\/b> \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u0438\u0437 \u0432\u0441\u0435\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4ae\/c29\/664\/4aec296643f1c3c00eaf3825228c1f10.svg\" alt=\"$P(x_i)$\" data-tex=\"inline\"><\/math>. \u0412 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0444\u043e\u0440\u043c\u0443\u043b\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/083\/6da\/dee\/0836dadee06ff110cc080cd7f0edad8b.svg\" alt=\"$P(x_i) = P(B_1) \\centerdot P_{B_1}(x_i) + P(B_2) \\centerdot P_{B_2}(x_i) = 0.6 \\centerdot 0.9 + 0.4 \\centerdot 0.8 = 0.54 + 0.32 = 0.86$\" data-tex=\"inline\"><\/math>. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u0442\u043e\u0433\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/57e\/f23\/f55\/57ef23f5533afd5aa5f392201dd77e7e.svg\" alt=\"$0.14$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0431\u0440\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0434\u0435\u0442\u0430\u043b\u044c \u0438\u0437 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0445 \u043d\u0430 \u0441\u043a\u043b\u0430\u0434 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0438 \u0432 \u0441\u0443\u043c\u043c\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 1 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/975\/af4\/b11\/975af4b1169911df1fc0cb494942bb59.svg\" alt=\"$(0.86 + 0.14 = 1)$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  <b>5)<\/b> \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443. <\/p>\n<p>  <b>5.1)<\/b> \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3e4\/c77\/a6e\/3e4c77a6e7c579a778fa84a18b6f4be0.svg\" alt=\"$\u21161$\" data-tex=\"inline\"><\/math>:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/208\/be2\/c65\/208be2c657897cfa1aca4d468cb260e6.svg\" alt=\"$P_{x_i}(B_1) = \\frac{P(B_1) \\centerdot P_{B_1}(x_i)}{P(x_i)} = \\frac{0.6 \\centerdot 0.9}{0.86} \\approx 0.63$\" data-tex=\"display\"><\/math><\/p>\n<p>  <b>5.2)<\/b> \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/dfd\/8a0\/d2f\/dfd8a0d2fe6ea30b4cde7f570eca349b.svg\" alt=\"$\u21162$\" data-tex=\"inline\"><\/math>:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/276\/c0b\/9d9\/276c0b9d9d370e7912b716ba88e69ae7.svg\" alt=\"$P_{x_i}(B_2) = \\frac{P(B_2) \\centerdot P_{B_2}(x_i)}{P(x_i)} = \\frac{0.4 \\centerdot 0.8}{0.86} \\approx 0.37$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u043f\u0435\u0440\u0435\u043e\u0446\u0435\u043d\u043a\u0443 \u0433\u0438\u043f\u043e\u0442\u0435\u0437 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c74\/4af\/9a3\/c744af9a3fd994e29adef0807ad1d10b.svg\" alt=\"$B_1$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e95\/038\/124\/e95038124bfa33957f7fd5fec6929b8b.svg\" alt=\"$B_2$\" data-tex=\"inline\"><\/math>. \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043e\u0446\u0435\u043d\u043a\u0438, \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u043f\u043e\u043b\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7e0\/efe\/0a3\/7e0efe0a3ef30658b6451492c451993c.svg\" alt=\"$0.63 + 0.37 = 1$\" data-tex=\"inline\"><\/math>. <\/p>\n<p>  \u041d\u0443 \u0447\u0442\u043e \u0436\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443.<\/p>\n<h3>\u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0411\u0430\u0439\u0435\u0441\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b: \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math><\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043b\u0435\u0433\u043a\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0434\u043e\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0430\u0445 \u21161 \u0438 \u21162, \u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435.<\/p>\n<p>  \u0421\u0442\u0430\u043d\u043e\u043a \u21161 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 64 \u043c\u043c \u0432 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0435 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c 4 \u043c\u043c.<\/p>\n<p>  \u0421\u0442\u0430\u043d\u043e\u043a \u21162 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 52 \u043c\u043c \u0432 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0435 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c \u0432 2 \u043c\u043c.<\/p>\n<p>  <i>\u041d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u2014 \u0432\u0441\u044f \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0413\u0430\u0443\u0441\u0441\u0430.<\/i><\/p>\n<p>  \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0442\u0435 \u0436\u0435, \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0438\u0445:<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/849\/571\/51e\/84957151ea7b1371d15152f3499c3d75.svg\" alt=\"$N1 = 6000, \\mu_1 = 64, \\sigma_1 = 4$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/697\/288\/23e\/69728823ec0fa8186476262247a12d2a.svg\" alt=\"$N2 = 4000, \\mu_2 = 52, \\sigma_2 = 2$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u0438\u0435\u043c\u043a\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0441\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043b\u0438\u0441\u044c. <\/p>\n<p>  \u041d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u0438\u043b\u0438 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0442\u0430\u043b\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0442\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0448\u0435.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b><\/p>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041c\u044b \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b, \u0432\u043f\u0440\u043e\u0447\u0435\u043c \u043c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/207\/8f0\/c9e\/2078f0c9e6ef2f296fe16c23249805b0.svg\" alt=\"$P(B_1)=0.6$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5bb\/322\/f16\/5bb322f16ec8c745cfa796d417c32171.svg\" alt=\"$P(B_2)=0.4$\" data-tex=\"inline\"><\/math>. \u041d\u043e \u043a\u0430\u043a \u043d\u0430\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u044a\u044f\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437? \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e! \u041c\u044b \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c <i>\u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u044a\u044f\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u044c \u0441 \u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/i><\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0431\u0449\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u043e\u0439:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/905\/165\/8f8\/9051658f8729851bc3e10f00f6d1e456.svg\" alt=\"$\\rho_{B_j}(x_i) = \\frac{1}{\\sigma_j \\centerdot \\sqrt{2 \\pi}} \\centerdot \\exp(- \\frac{(x_i-\\mu_j)^2}{2 \\sigma_j^2}) $\" data-tex=\"display\"><\/math><\/p>\n<p>  , \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u2014 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u044f),<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/344\/3b0\/206\/3443b020672c0b17ed847c5fac5d5803.svg\" alt=\"$\\mu_j$\" data-tex=\"inline\"><\/math> \u2014 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u044f, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u043c \u0441\u0442\u0430\u043d\u043a\u0435),<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4c8\/e75\/164\/4c8e7516495c95836de558987c2bff41.svg\" alt=\"$\\sigma_j $\" data-tex=\"inline\"><\/math> \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u044f, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u043c \u0441\u0442\u0430\u043d\u043a\u0435).<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043b\u043e\u0432\u043a\u0443\u044e \u0437\u0430\u043c\u0435\u043d\u0443 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0411\u0430\u0439\u0435\u0441\u0430, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435.<\/p>\n<p>  \u0410\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f.<\/p>\n<p>  \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u0442\u0430\u043b\u044c \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a68\/1d9\/917\/a681d99177220b81b7e7d4b1dee9fb02.svg\" alt=\"$P_{x_i}(B_1) = \\frac{w_1 \\centerdot \\rho_{B_1}(x_i)}{w_1 \\centerdot \\rho_{B_1}(x_i) + w_2 \\centerdot \\rho_{B_1}(x_i)}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u0442\u0430\u043b\u044c \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1b2\/b0e\/12e\/1b2b0e12e54098b758a584c9a8d1a07e.svg\" alt=\"$P_{x_i}(B_2) = \\frac{w_2 \\centerdot \\rho_{B_2}(x_i)}{w_1 \\centerdot \\rho_{B_1}(x_i) + w_2 \\centerdot \\rho_{B_1}(x_i)}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u0441 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c09\/593\/cc7\/c09593cc76a93b077923909bb42d9f9d.svg\" alt=\"$P(B_j)$\" data-tex=\"inline\"><\/math> \u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b5a\/8c6\/907\/b5a8c6907aba07885ac8df03f76b6392.svg\" alt=\"$w_j$\" data-tex=\"inline\"><\/math>. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0440\u0430\u043d\u0435\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u043a\u0443\u0440\u0441\u0435. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0443\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0432\u0441\u0435 100% \u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0418\u043c\u043f\u043e\u0440\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043c\u043e\u0434\u0443\u043b\u0438 import numpy as np import random import math import matplotlib.pyplot as plt %matplotlib inline from sklearn.metrics import accuracy_score<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0434\u0435\u0442\u0430\u043b\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 # \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0442\u0430\u043d\u043a\u0430: \u043c\u0430\u0442.\u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435, \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043a\u0432. \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 def gaus_func_01(mu,sigma,x):     return math.e**(-(x-mu)**2\/(2*sigma**2)) \/ (sigma*(2*math.pi)**0.5)  # \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u043a \u0441\u0442\u0430\u043d\u043a\u0443 def proba_x(X, w1, w2, mu_1, mu_2, sigma_1, sigma_2):     for i in X:         P1_x = gaus_func_01(mu_1,sigma_1,i)         P2_x = gaus_func_01(mu_2,sigma_2,i)         P_x = w1*P1_x + w2*P2_x         P_x_1 = (w1*P1_x)\/P_x         P_x_2 = (w2*P2_x)\/P_x         proba_temp = []         proba_temp.append(P_x_1)         proba_temp.append(P_x_2)         proba_X.append(proba_temp)     return proba_X  # \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0441\u0442\u0430\u043d\u043a\u0443 def pred_x(proba_X, limit_proba):     pred_X = []     for x in proba_X:         if x[0] &gt;= limit_proba:             pred_X.append(1)         else:             pred_X.append(2)     return np.array(pred_X)  # \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 def graph_01(X, pred_X, mu_1, sigma_1, mu_2, sigma_2):     true_pred = []     false_pred_1 = []     false_pred_2 = []     for i in range(X.shape[0]):         if pred_X[i] == y[i]:             true_pred.append([X[i], -0.025])         else:             if y[i] == 1:                 false_pred_1.append([X[i], -0.0075])             else:                 false_pred_2.append([X[i], -0.015])      false_pred_1 = np.array(false_pred_1)                 false_pred_2 = np.array(false_pred_2)     true_pred = np.array(true_pred)      x_theory = np.linspace(42, 85, 20000)     y_theory_1 = []     for x in x_theory:         y_theory_1.append(gaus_func_01(mu_1,sigma_1,x))     y_theory_2 = []     for x in x_theory:         y_theory_2.append(gaus_func_01(mu_2,sigma_2,x))      plt.figure(figsize=(18, 8))         plt.plot(         x_theory, y_theory_1, color = 'green', lw = 2, label = 'Theoretical probability density for machine 1')     plt.plot(         x_theory, y_theory_2, color = 'firebrick', lw = 2, label = 'Theoretical probability density for machine 2')     plt.hist(         X[:N1], bins = 'auto', color='#539caf', normed = True, alpha = 0.35, label = 'machine tool products 1')     plt.hist(         X[N1:N], bins = 'auto', color='sandybrown', normed = True, alpha = 0.75, label = 'machine tool products 2')     plt.plot(mu_1, 0, 'o', markersize = 11, color = 'blue', label = 'Mu 1')     plt.plot(mu_2, 0, 'o', markersize = 11, color = 'red', label = 'Mu 2')      plt.plot([mu_1 - sigma_1, mu_1 - sigma_1], [0,0.85*np.max(y_theory_1)],              ':', lw = 3, color = 'blue', alpha = 0.55, label = 'Mu1 - sigma1')     plt.plot([mu_1 + sigma_1, mu_1 + sigma_1], [0,0.85*np.max(y_theory_1)],              ':', lw = 3, color = 'blue', alpha = 0.55, label = 'Mu1 + sigma1')     plt.plot([mu_2 - sigma_2, mu_2 - sigma_2], [0,0.85*np.max(y_theory_2)],              ':', lw = 3, color = 'red', alpha = 0.55, label = 'Mu2 - sigma2')     plt.plot([mu_2 + sigma_2, mu_2 + sigma_2], [0,0.85*np.max(y_theory_2)],              ':', lw = 3, color = 'red', alpha = 0.55, label = 'Mu2 + sigma2')      plt.plot([mu_1 - 2 * sigma_1, mu_1 - 2 * sigma_1], [0, 0.9*0.5 * np.max(y_theory_1)],              ':', lw = 2.5, color = 'blue', alpha = 0.35, label = 'Mu1 - 2*sigma1')     plt.plot([mu_1 + 2 * sigma_1, mu_1 + 2 * sigma_1], [0, 0.9*0.5 * np.max(y_theory_1)],              ':', lw = 2.5, color = 'blue', alpha = 0.35, label = 'Mu1 + 2*sigma1')     plt.plot([mu_2 - 2 * sigma_2, mu_2 - 2 * sigma_2], [0, 0.9*0.5 * np.max(y_theory_2)],              ':', lw = 2.5, color = 'red', alpha = 0.35, label = 'Mu2 - 2*sigma2')     plt.plot([mu_2 + 2 * sigma_2, mu_2 + 2 * sigma_2], [0, 0.9*0.5 * np.max(y_theory_2)],              ':', lw = 2.5, color = 'red', alpha = 0.35, label = 'Mu2 + 2*sigma2')      plt.plot(false_pred_1[:,0], false_pred_1[:,1], 'o', markersize = 2.5, color = 'blue', alpha = 0.2, label = 'errors1')     plt.plot(false_pred_2[:,0], false_pred_2[:,1], 'o', markersize = 2.5, color = 'red', alpha = 0.3, label = 'errors2')     plt.plot(true_pred[:,0], true_pred[:,1], 'o', markersize = 3, color = 'green', alpha = 0.2, label = 'right answers')      plt.xlabel('Caliber')     plt.ylabel('Probability density')     plt.legend()     plt.show()<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0423\u043a\u0430\u0436\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 N1 = 6000 # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 N2 = 4000 # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0442\u0430\u043d\u043a\u0430\u0445 N = N1+N2  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 mu_1 = 64. # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 sigma_1 = 3.5  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 mu_2 = 52 # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 sigma_2 = 2.<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0440\u0430\u0441\u0447\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">X = np.zeros((N)) np.random.seed(seed=42) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0435\u0442\u0430\u043b\u044f\u043c, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 X[:N1] = np.random.normal(loc=mu_1, scale=sigma_1, size=N1) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0435\u0442\u0430\u043b\u0438, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 X[N1:N] = np.random.normal(loc=mu_2, scale=sigma_2, size=N2)  # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 y = np.zeros((N)) y[:N1] = np.array((1)) y[N1:N] = np.array((2))  # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 w1 = float(N1)\/N # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 w2 = float(N2)\/N  # \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u0441\u0442\u0430\u043d\u043a\u0443 proba_X = [] proba_X = proba_x(X, w1, w2, mu_1, mu_2, sigma_1, sigma_2)  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u043e\u0440\u043e\u0433 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u0441\u0442\u0430\u043d\u043a\u0443 limit_proba = 0.5  # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u043a \u0441\u0442\u0430\u043d\u043a\u0443 pred_X = [] pred_X = pred_x(proba_X, limit_proba)  # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 print '\u0414\u043e\u043b\u044f \u0432\u0435\u0440\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439:', round(accuracy_score(y, pred_X),3) print  print '\u0413\u0440\u0430\u0444\u0438\u043a \u21161' graph_01(X, pred_X, mu_1, sigma_1, mu_2, sigma_2)<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <b>\u0413\u0440\u0430\u0444\u0438\u043a \u21161<\/b><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i_\/ib\/rl\/i_ibrlvpaxrtmpgyozwzosdmadi.png\"><\/p>\n<p>  \u0427\u0442\u043e \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438? \u041c\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c 10000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c, \u0438\u0437 \u043d\u0438\u0445 6000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0432 64 \u043c\u043c \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c 4 \u043c\u043c, 4000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0432\u043d\u044b\u043c 52 \u043c\u043c \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c \u0432 2 \u043c\u043c. \u0414\u0430\u043b\u0435\u0435, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u0438\u043b\u0438 \u21162. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0443 \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u043d\u0430 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430 \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c. \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0441\u0440\u0430\u0432\u043d\u0438\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u043c\u0438 \u043e\u0442\u0432\u0435\u0442\u0430\u043c\u0438.<\/p>\n<p>  \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043e\u043b\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u2014 0.986. \u0412 \u0446\u0435\u043b\u043e\u043c \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a. \u041d\u0430 \u0447\u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u0433\u0434\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0435 \u0432\u0435\u0440\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0438\u0437\u0434\u0435\u043b\u0438\u044f. <\/p>\n<p>  \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0433\u0434\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u044f, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u043a\u0430\u0445, \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440. \u042d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c.<\/p>\n<p>  \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0448\u0438\u0431\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u043e\u0442 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u043b\u043e\u0436\u043d\u043e\u043c\u0443 \u0446\u0435\u043d\u0442\u0440\u0443.<\/p>\n<p>  \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0432\u043d\u044b\u0445 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b2\/82b\/5a8\/9b282b5a892a8b10ae422679282ff306.svg\" alt=\"$\\mu +- 2\\sigma$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7a6\/d4a\/442\/7a6d4a442f5c90d6616f0278e012ae7b.svg\" alt=\"$\\mu_1 - 2\\sigma_1$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/787\/044\/91d\/78704491d5fc506203f8c5bfd8215b88.svg\" alt=\"$\\mu_2 + 2\\sigma_2$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0416\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u00ab\u043f\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c\u00bb \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0443\u0441\u0432\u043e\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430.<\/p>\n<p>  \u041d\u0443 \u0430 \u043c\u044b \u0434\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443<\/p>\n<h3>\u0422\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439.<\/h3>\n<p>  \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043d\u043e \u0438 \u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0435\u0441\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u044f. \u041f\u0443\u0441\u043a\u0430\u0439 \u0441\u0442\u0430\u043d\u043e\u043a \u21161 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u0432\u0435\u0441\u043e\u043c \u0432 12 \u0433. \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c \u0432 1 \u0433., \u0441\u0442\u0430\u043d\u043e\u043a \u21162 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0432\u0435\u0441\u043e\u043c \u0432 10 \u0433. \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c 0.8 \u043c\u043c<\/p>\n<p>  \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0438\u0445.<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9e7\/f1c\/a39\/9e7f1ca39ee33c8ec30d313ca1c0f910.svg\" alt=\"$N1 = 6000, \\mu_{1 1} = 64, \\sigma_{1 1} = 4, \\mu_{1 2} = 14, \\sigma_{1 2} = 1$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/71b\/74e\/d0b\/71b74ed0b197e0d872a1374c6c3c97c4.svg\" alt=\"$N2 = 4000, \\mu_{2 1} = 52, \\sigma_{2 1} = 2, \\mu_{2 2} = 10, \\sigma_{2 2} = 0.9$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0421\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0442\u0430 \u0436\u0435 \u2014 \u0432\u0441\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043b\u0438\u0441\u044c \u0432 \u043e\u0434\u043d\u0443 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043a\u0443\u0447\u0443 \u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u0438 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b><\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u0414\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8d4\/4d0\/8f1\/8d44d08f1ee4e8325803222ed1674ef7.svg\" alt=\"$p_{B_j}(x_i) = \\frac{1}{(2\\pi)^{k\/2} \\centerdot \\mid \\Sigma_j\\mid ^{1\/2}} \\centerdot \\exp(- \\frac{1}{2} \\centerdot (x_i-\\mu_j)^T \\Sigma_j^{-1} (x_i-\\mu_j))$\" data-tex=\"display\"><\/math><\/p>\n<p>  , \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b58\/325\/83a\/b5832583a3653ce6ec2cc00a9240205e.svg\" alt=\"$\\Sigma_j$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 c\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u043c \u0441\u0442\u0430\u043d\u043a\u0435)<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/025\/7b6\/c9e\/0257b6c9e985d9a09fbb88ed4447f374.svg\" alt=\"$\\mid \\Sigma_j\\mid$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/344\/3b0\/206\/3443b020672c0b17ed847c5fac5d5803.svg\" alt=\"$\\mu_j$\" data-tex=\"inline\"><\/math> \u2014 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d $j$-\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b82\/8e2\/475\/b828e2475a3a56280b895f35eb250ea2.svg\" alt=\"$j$\" data-tex=\"inline\"><\/math>-\u043c \u0441\u0442\u0430\u043d\u043a\u0435)<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u2014 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bf8\/3b5\/32c\/bf83b532cd867d34004f8eded8c5c79a.svg\" alt=\"$i$\" data-tex=\"inline\"><\/math>-\u0433\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u044f)<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0437\u043d\u0430\u043d\u0438\u044f \u043e\u0431 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0434\u0435\u0442\u0430\u043b\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 # \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0442\u0430\u043d\u043a\u0430: \u043c\u0430\u0442.\u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435, \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043a\u0432. \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 def gaus_func_02(k, m, x, mu, sigma):     pj_xi = []     for j in range(k):         det_sigma_j = np.linalg.det(sigma[j])         factor_1 = 1 \/ (((2 * math.pi)**(k\/2)) * ((det_sigma_j)**0.5))         factor_2 = []         for i in x: # \u043e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043a\u043e\u0434\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u043e\u0431\u0448\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 # \u0432 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u0435\u0440\u0432\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0442\u0435\u043b\u0435\u043c \u0438\u0434\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 # \u0443 \u043d\u0430\u0441 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0438\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 # \u0441\u043f\u0438\u0448\u0435\u043c \u044d\u0442\u043e \u043d\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430             factor_2.append(math.e**float(             -0.5 * np.matrix(i - mu[j]) * np.matrix(np.linalg.inv(sigma[j])) * np.matrix(i - mu[j]).T))         pj_xi.append(factor_1 * np.array(factor_2))     return np.array(pj_xi)  # \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443 \u21161 \u0438 \u21162 def proba_func_02(pjxi, w, k):     # \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u0432\u0441\u0435\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445     P_X = []     for j in range(k):         P_X.append(w[j] * pjxi[j])     P_X = np.sum(np.array(P_X), axis = 0)     # \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443 \u21161 \u0438 \u21162     P_J_X = []     for j in range(k):         P_J_X.append(w[j] * pjxi[j] \/ P_X)     return np.array(P_J_X)  # \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0441\u0442\u0430\u043d\u043a\u0443 def pred_x_02(proba_X, limit_proba):     pred_X = []     for x in proba_X[0]:         if x &gt;= limit_proba:             pred_X.append(1)         else:             pred_X.append(2)     return np.array(pred_X)  # \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u043e \u0441\u0442\u0430\u043d\u043a\u0430\u043c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c def graph_02_algorithm(pred_X, mu):     # \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445     pred_X = np.array(pred_X)      # \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u043d\u043a\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c     answers_1 = []     answers_2 = []      for i in range(pred_X.shape[0]):         if pred_X[i] == 1:             answers_1.append(X[i])         else:             answers_2.append(X[i])          print '\u0413\u0440\u0430\u0444\u0438\u043a &quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c&quot;'     plt.figure(figsize=(16, 6))       plt.plot(         np.array(answers_1)[:,0], np.array(answers_1)[:,1], 'o', alpha = 0.7, color='sandybrown', label = 'Produced on machine #1')     plt.plot(         np.array(answers_2)[:,0], np.array(answers_2)[:,1], 'o', alpha = 0.45, color = 'darkblue', label = 'Produced on machine #2')     plt.plot(mu[0][0], mu[0][1], 'o', markersize = 16, color = 'red', label = 'Mu 1')     plt.plot(mu[1][0], mu[1][1], 'o',  markersize = 16, color = 'slateblue', label = 'Mu 2')     plt.xlabel('Diameter')     plt.ylabel('Weight')     plt.legend()     plt.show()      # \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u043e \u0441\u0442\u0430\u043d\u043a\u0430\u043c def graph_02_true(X, mu):     print '\u0413\u0440\u0430\u0444\u0438\u043a &quot;\u0418\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0439&quot;'     plt.figure(figsize=(16, 6))       plt.plot(         X[0:N1,0], X[0:N1,1], 'o', alpha = 0.7, color='sandybrown', label = 'Produced on machine #1')     plt.plot(         X[N1:N,0], X[N1:N,1], 'o', alpha = 0.45, color = 'darkblue', label = 'Produced on machine #2')     plt.plot(mu[0][0], mu[0][1], 'o', markersize = 16, color = 'red', label = 'Mu 1')     plt.plot(mu[1][0], mu[1][1], 'o',  markersize = 16, color = 'slateblue', label = 'Mu 2')     plt.xlabel('Diameter')     plt.ylabel('Weight')     plt.legend()     plt.show()<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0423\u043a\u0430\u0436\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u043d\u043a\u043e\u0432 k = 2  # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 N1 = 6000 # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 N2 = 4000 N = N1+N2  # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (\u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438 \u0432\u0435\u0441) m = 2  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 mu_1_1 = 64. # \u0432\u0435\u0441 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 mu_1_2 = 14. # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f sigma_1_1 = 3.5 sigma_1_2 = 1.  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 mu_2_1 = 52. # \u0432\u0435\u0441 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 mu_2_2 = 9.5 # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f sigma_2_1 = 2. sigma_2_2 = 0.7<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0440\u0430\u0441\u0447\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">X = np.zeros((N, m)) np.random.seed(seed=42) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0435\u0442\u0430\u043b\u044f\u043c, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 X[:N1, 0] = np.random.normal(loc=mu_1_1, scale=sigma_1_1, size=N1) X[:N1, 1] = np.random.normal(loc=mu_1_2, scale=sigma_1_2, size=N1) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0435\u0442\u0430\u043b\u0438, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 X[N1:N, 0] = np.random.normal(loc=mu_2_1, scale=sigma_2_1, size=N2) X[N1:N, 1] = np.random.normal(loc=mu_2_2, scale=sigma_2_2, size=N2)  # \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b (\u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f) y = np.zeros((N)) y[:N1] = np.array((1)) y[N1:N] = np.array((2))  # \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438 \u0432\u0435\u0441\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0432 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 (\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432) mu  = np.array(([mu_1_1, mu_1_2], [mu_2_1, mu_2_2]))  # \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 (\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432) sigma = np.array(([sigma_1_1, 0.],[0., sigma_1_2], [sigma_2_1, 0.],[0., sigma_2_2])) sigma = sigma.reshape(k, m, m)  # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u0438 \u21162 w = np.array([float(1.\/k), float(1.\/k)])  # \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 pj_xi = gaus_func_02(k, m, X, mu, sigma) proba_X = proba_func_02(pj_xi, w, m)  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u043e\u0440\u043e\u0433 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u0441\u0442\u0430\u043d\u043a\u0443 limit_proba = 0.5  pred_X = pred_x_02(proba_X, limit_proba)          # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 print '\u0414\u043e\u043b\u044f \u0432\u0435\u0440\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439:', round(accuracy_score(y, pred_X),3) print  graph_02_algorithm(pred_X, mu)  graph_02_true(X, mu)<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <b>\u0413\u0440\u0430\u0444\u0438\u043a \u21162.1 \u00ab\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c\u00bb<\/b><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qt\/w_\/tw\/qtw_twczfz95bc_vbno56cmiyvs.png\"><\/p>\n<p>  <b>\u0413\u0440\u0430\u0444\u0438\u043a \u21162.2 \u00ab\u0418\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0439\u00bb<\/b><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ot\/kd\/h2\/otkdh2bikyfzqkvvzhb_-6vdfpe.png\"><\/p>\n<p>  \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043c\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 10000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0448\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math>, \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0435\u0433\u043e. \u041f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0442 \u043a\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043b\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0440\u0430\u0432\u043d\u0443\u044e 0.998, \u0447\u0442\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0432\u0441\u0435 \u0442\u0430\u043c \u0436\u0435 \u2014 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u043a\u0430\u0445 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u043c\u0435\u044e\u0442 \u0441\u0445\u043e\u0436\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0438 \u0432\u0435\u0441.<\/p>\n<p>  \u041a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0441\u043c\u043e\u0433 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math> \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c: \u0432 \u043a\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0445\u0443\u0434\u0448\u0430\u0442\u044c\u0441\u044f, \u0432 \u043a\u0430\u043a\u0438\u0445 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c\u0441\u044f. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a. \u041d\u0443 \u0430 \u043c\u044b \u0434\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c\u0443 \u043f\u0443\u043d\u043a\u0442\u0443 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u043e\u043c\u0443 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443.<\/p>\n<h3>\u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h3>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u043c\u0438 \u043d\u0430 \u0441\u043a\u043b\u0430\u0434 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438. \u041d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u043d\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u043a\u0430\u0445, \u0438\u0445 10000, \u043a\u0430\u0436\u0434\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0430\u043c \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e. \u041d\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u2014 \u043d\u0430\u043c \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u0438\u0437 \u0432\u0441\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0443\u0447\u0438, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u0441\u0442\u0430\u043d\u043a\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0442\u0430 \u0438\u043b\u0438 \u0438\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c. <\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0437\u0432\u0443\u0447\u0438\u0442 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0443 \u043d\u0430\u0441 \u0432 \u0440\u0443\u043a\u0430\u0445 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0411\u0430\u0439\u0435\u0441\u0430 \u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0434\u043e\u0431\u0440\u043e\u043c \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b><\/p>\n<p>  \u041a\u0430\u043a \u043c\u044b \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043c? \u041a\u0430\u043a \u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u0432 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043c\u044b \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0434\u0435\u0442\u0430\u043b\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d49\/1e2\/cc5\/d491e2cc5b2c24ff243cbcdeb640dcc5.svg\" alt=\"$w_1$\" data-tex=\"inline\"><\/math> \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0440\u0430\u0432\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0434\u0435\u0442\u0430\u043b\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/69c\/2ed\/74f\/69c2ed74f5d10be38c540bbc2b643fc4.svg\" alt=\"$w_2$\" data-tex=\"inline\"><\/math>. \u0413\u0438\u043f\u043e\u0442\u0435\u0437 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0448\u0430\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 0.5.<\/p>\n<p>  \u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 random, \u043f\u043e\u0434\u0435\u043b\u0438\u043c \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0440\u043e\u0432\u043d\u0443 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 (\u0434\u0438\u0430\u043c\u0435\u0442\u0440, \u0432\u0435\u0441) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. <\/p>\n<p>  \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math> \u0432\u043e\u0437\u044c\u043c\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u0442\u043e\u043b\u043a\u0430 \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0433\u043e \u0440\u0430\u0432\u043d\u044b\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u0435 \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c. \u0417\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 E-\u0448\u0430\u0433 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u0431\u044b\u0442\u044c \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u043d\u043e\u0439 \u043a \u0441\u0442\u0430\u043d\u043a\u0443 \u21161 \u0438\u043b\u0438 \u0441\u0442\u0430\u043d\u043a\u0443 \u21162. <\/p>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 E-\u0448\u0430\u0433.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u043e \u0437\u0430 M-\u0448\u0430\u0433\u043e\u043c. \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d49\/1e2\/cc5\/d491e2cc5b2c24ff243cbcdeb640dcc5.svg\" alt=\"$w_1$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/69c\/2ed\/74f\/69c2ed74f5d10be38c540bbc2b643fc4.svg\" alt=\"$w_2$\" data-tex=\"inline\"><\/math>, \u0430 \u0442\u0430\u043a\u0436\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u043f\u043e \u0434\u0432\u0430 \u0448\u0430\u0433\u0430 \u043a\u0430\u0436\u0434\u0430\u044f, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c 15.<\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434.  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e E-\u0448\u0430\u0433\u0430 def e_step(x, k, m, n, w, mu, sigma):     # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f i-\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u0438\u0437 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 j-\u043c \u0441\u0442\u0430\u043d\u043a\u0435      pj_xi = []     for j in range(k):         det_sigma_j = np.linalg.det(sigma[j])         factor_1 = 1 \/ (((2 * math.pi)**(k\/2)) * ((det_sigma_j)**0.5))         factor_2 = []         for i in x:             factor_2.append(math.e**float(                 -0.5 * np.matrix(i - mu[j]) * np.matrix(np.linalg.inv(sigma[j])) * np.matrix(i - mu[j]).T))         pj_xi.append(factor_1 * np.array(factor_2))     pj_xi = np.array(pj_xi)          # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e i-\u044f \u0434\u0435\u0442\u0430\u043b\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 j-\u043c \u0441\u0442\u0430\u043d\u043a\u0435     pj_xi_w = []     for j in range(k):         pj_xi_w.append(pj_xi[j] * w[j])     pj_xi_w = np.array(pj_xi_w)          # \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f i-\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439       sum_pj_xi_w = np.sum(pj_xi_w, axis = 0)          # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u0442\u0430\u043d\u043a\u0443     proba_xi = []     for j in range(k):         proba_xi.append(pj_xi_w[j] \/ sum_pj_xi_w)          return np.array(proba_xi)  # \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u0441\u0442\u0430\u043d\u043a\u0443, # \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u0441\u0442\u0430\u043d\u043a\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c def x_new(proba_xi):     X1_new_ind = []     X2_new_ind = []     X_answers = []      count = 0     for x in proba_xi[0]:         if x &gt;= 0.5:             X1_new_ind.append(count)             X_answers.append(1)         else:             X2_new_ind.append(count)             X_answers.append(2)         count += 1     # \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161, \u21162 \u0438 \u0432\u0435\u043a\u0442\u043e\u0440 \u043e\u0442\u0432\u0435\u0442\u043e\u0432     return X1_new_ind, X2_new_ind, X_answers   # \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e M-\u0448\u0430\u0433\u0430 def m_step(x, proba_xi,N):     w_new = np.sum(proba_xi, axis = 1) \/ N          # \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435     mu_new = (np.array((np.matrix(proba_xi) * np.matrix(X))).T \/ np.sum(proba_xi, axis = 1)).T          # \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438     cov_new = []     for mu in range(mu_new.shape[0]):         X_cd = []         X_cd_proba = []         count = 0         for x_i in x:             cd = np.array(x_i - mu_new[mu])             X_cd.append(cd)             X_cd_proba.append(cd * proba_xi[mu][count])             count += 1         X_cd = np.array(X_cd)         X_cd = X_cd.reshape(N, m)         X_cd_proba = np.array(X_cd_proba)         X_cd_proba = X_cd_proba.reshape(N, m)          cov_new.append(np.matrix(X_cd.T) * np.matrix(X_cd_proba))     cov_new = np.array((np.array(cov_new) \/ (np.sum(proba_xi, axis = 1)-1)))     # \u043f\u0440\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0438\u0445 \u0432 \u043d\u0443\u043b\u0438     # \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0441\u0441\u0447\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0435 \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442, \u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043d\u044f \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438     if cov_new[0][0][1] &lt; 0:         cov_new[0][0][1] = 0     if cov_new[0][1][0] &lt; 0:         cov_new[0][1][0] = 0          if cov_new[1][0][1] &lt; 0:         cov_new[1][0][1] = 0     if cov_new[1][1][0] &lt; 0:         cov_new[1][1][0] = 0          # \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435     sigma_new = cov_new**0.5     return w_new, mu_new, sigma_new<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0423\u043a\u0430\u0436\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 (\u043a\u043b\u0430\u0441\u0442\u0435\u0440 1) N1 = 6000 # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 (\u043a\u043b\u0430\u0441\u0442\u0435\u0440 2) N2 = 4000 # \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0442\u0430\u043d\u043a\u0430\u0445 N = N1 + N2  # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u043d\u043a\u043e\u0432 k = 2  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 mu_samples_1_1 = 64. # \u0432\u0435\u0441 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 mu_samples_1_2 = 14.  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 mu_samples_2_1 = 52. # \u0432\u0435\u0441 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 mu_samples_2_2 = 9.5  # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 sigma_samples_1_1 = 3.5 # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 sigma_samples_1_2 = 1.  # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 sigma_samples_2_1 = 2. # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 sigma_samples_2_2 = 0.7<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0440\u0430\u0441\u0447\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">X = np.zeros((N, 2))  np.random.seed(seed=42) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0435\u0442\u0430\u043b\u044f\u043c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 X[:N1, 0] = np.random.normal(loc=mu_samples_1_1, scale=sigma_samples_1_1, size=N1) X[:N1, 1] = np.random.normal(loc=mu_samples_1_2, scale=sigma_samples_1_2, size=N1) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0435\u0442\u0430\u043b\u044f\u043c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 X[N1:N, 0] = np.random.normal(loc=mu_samples_2_1, scale=sigma_samples_2_1, size=N2) X[N1:N, 1] = np.random.normal(loc=mu_samples_2_2, scale=sigma_samples_2_2, size=N2)  # \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 m = X.shape[1]  # \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 n = X.shape[0]  # \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f) y = np.zeros((N)) y[:N1] = np.array((1)) y[N1:N] = np.array((2))  # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437\u0434\u0435\u043b\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u0438 \u21162 w = np.array([float(1.\/k), float(1.\/k)])  np.random.seed(seed = None) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0430 \u0438 \u0432\u0435\u0441\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 (\u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b) mu  = np.array(     (np.mean(X[np.random.choice(n, n\/k)], axis = 0), np.mean(X[np.random.choice(n, n\/k)], axis = 0))) # mu = np.array(([mu_samples_1_1, mu_samples_1_2],[mu_samples_2_1, mu_samples_2_2]))  # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u0435 \u0438 \u0432\u0435\u0441\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 (\u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438) sigma = np.array(([1., 0.],[0., 1.], [1., 0.],[0., 1.])) # sigma = np.array(([sigma_samples_1_1, 0.],[0., sigma_samples_1_2], [sigma_samples_2_1, 0.],[0., sigma_samples_2_2])) sigma = sigma.reshape(k, m, m)  # \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 steps = 15 # \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0446\u0438\u043a\u043b EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 for i in range(steps):     proba_xi = e_step(X, k, m, n, w, mu, sigma)     w, mu, sigma = m_step(X, proba_xi,N)     X1_new_ind, X2_new_ind, X_answers = x_new(proba_xi)     print '\u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u2116', i+1     print     print '\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0439'     print mu     print     print '\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439'     print sigma     print     print '\u0414\u043e\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439'     print round(accuracy_score(y, X_answers),3)          plt.figure(figsize=(16, 6))       plt.plot(         X[X1_new_ind,0], X[X1_new_ind,1], 'o', alpha = 0.7, color='sandybrown', label = 'Produced on machine #1')     plt.plot(         X[X2_new_ind,0], X[X2_new_ind,1], 'o', alpha = 0.45, color = 'darkblue', label = 'Produced on machine #2')     plt.plot(mu[0][0], mu[0][1], 'o', markersize = 16, color = 'red', label = 'Mu 1')     plt.plot(mu[1][0], mu[1][1], 'o',  markersize = 16, color = 'purple', label = 'Mu 2')     plt.xlabel('Diameter')     plt.ylabel('Weight')     plt.legend()     plt.show()<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0413\u0440\u0430\u0444\u0438\u043a 3.1 \u00ab\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u00bb  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u0441\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vc\/pu\/8l\/vcpu8lsdiu7azjg7kj1vqnwufbc.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cz\/le\/od\/czleodw-gfg0cpl7uhwcjgohozi.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/us\/ne\/qg\/usneqg_s775ojzqgi_iamydynsk.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v2\/sq\/vw\/v2sqvw5yz8h6yj0tpd3jqr2lgps.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/t1\/zc\/ba\/t1zcbacowckutxhe5-bnxvl0_g0.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bh\/o0\/1z\/bho01zw0rh4glkqzaoceg0thufw.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/53\/bq\/va\/53bqvajktt-nersuu5oryoxk4b4.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/to\/5d\/r_\/to5dr_vx6zehqfqrxysu2o0hazk.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qq\/mu\/jw\/qqmujwhmo99o14iiybdyom0a7fe.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1m\/-x\/j3\/1m-xj3dajz0vjybtphm-yuryeko.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/be\/t8\/de\/bet8dekwdp0gmpkzfqxljx1pryk.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7j\/rs\/-m\/7jrs-mmym9xrt8sluw8he6t9szq.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l3\/bc\/7d\/l3bc7d9d81jrkhvlka0kyriqjli.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_c\/_g\/n7\/_c_gn7xzppdpmhtd20e-di8q9_u.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b_\/sh\/cr\/b_shcri1an7knfvhpih4zpdms6e.png\">  <\/div>\n<\/p><\/div>\n<p>  \u0427\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c? \u0410 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435, \u043d\u0435 \u0438\u043c\u0435\u044f \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0433\u0438\u043f\u043e\u0442\u0435\u0437 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d49\/1e2\/cc5\/d491e2cc5b2c24ff243cbcdeb640dcc5.svg\" alt=\"$w_1$\" data-tex=\"inline\"><\/math> \u0438\u043b\u0438 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/69c\/2ed\/74f\/69c2ed74f5d10be38c540bbc2b643fc4.svg\" alt=\"$w_2$\" data-tex=\"inline\"><\/math>, \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ec\/36e\/4ef\/1ec36e4efef9e67482ea2b86700b82f2.svg\" alt=\"$\\mu$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bd2\/53a\/dd0\/bd253add01b6a626f79861899c5e7d73.svg\" alt=\"$\\sigma$\" data-tex=\"inline\"><\/math>, \u043c\u044b \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e\u0435 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0431\u044b\u043b\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b.<\/p>\n<p>  \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u0434\u0435\u043b\u0438\u0439, \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<p>  <b>\u0418\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/b><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fd7\/480\/7e1\/fd74807e1e316915bc66acceeca14b5d.svg\" alt=\"$\\mu_{11} = 64, \\mu_{12} = 14, \\sigma_{11} = 3.5, \\sigma_{12} = 1.$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7a4\/6ea\/0e7\/7a46ea0e7b877490eb263924e7a95896.svg\" alt=\"$\\mu_{21} = 52, \\mu_{12} = 9.5, \\sigma_{21} = 2.0, \\sigma_{22} = 0.7$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <b>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/b><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a4a\/570\/af0\/a4a570af05874c6e9a778d2ea39909f0.svg\" alt=\"$\\mu_{11} \\approx 64.03, \\mu_{12} \\approx 13.99, \\sigma_{11} \\approx 3.44, \\sigma_{12} \\approx 1.23$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6ae\/ee0\/5da\/6aeee05da822e0825b0ac7a1da2e9dfb.svg\" alt=\"$\\mu_{21} \\approx 52.06, \\mu_{12} \\approx 9.54, \\sigma_{21} \\approx 1.65, \\sigma_{22} \\approx 0.77$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u043a\u043e\u043d\u0446\u0443. \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044e, \u0447\u0442\u043e \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 sklearn.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 GaussianMixture \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 sklearn \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0418\u043c\u043f\u043e\u0440\u0442 \u043c\u043e\u0434\u0443\u043b\u044f<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from sklearn.mixture import GaussianMixture as GMM<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0423\u043a\u0430\u0436\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 (\u043a\u043b\u0430\u0441\u0442\u0435\u0440 1) N1 = 6000 # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 (\u043a\u043b\u0430\u0441\u0442\u0435\u0440 2) N2 = 4000 # \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0442\u0430\u043d\u043a\u0430\u0445 N = N1 + N2  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 mu_samples_1_1 = 64. # \u0432\u0435\u0441 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 mu_samples_1_2 = 14.  # \u0434\u0438\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 mu_samples_2_1 = 52. # \u0432\u0435\u0441 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 mu_samples_2_2 = 9.5  # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 sigma_samples_1_1 = 3.5 # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21161 sigma_samples_1_2 = 1.  # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 sigma_samples_2_1 = 2. # \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u0439 \u0441\u0442\u0430\u043d\u043a\u0430 \u21162 sigma_samples_2_2 = 0.7   # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u043d\u043a\u043e\u0432 k = 2  X = np.zeros((N, 2))  np.random.seed(seed=42) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0435\u0442\u0430\u043b\u044f\u043c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21161 X[:N1, 0] = np.random.normal(loc=mu_samples_1_1, scale=sigma_samples_1_1, size=N1) X[:N1, 1] = np.random.normal(loc=mu_samples_1_2, scale=sigma_samples_1_2, size=N1) # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0435\u0442\u0430\u043b\u044f\u043c, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u043a\u0435 \u21162 X[N1:N, 0] = np.random.normal(loc=mu_samples_2_1, scale=sigma_samples_2_1, size=N2) X[N1:N, 1] = np.random.normal(loc=mu_samples_2_2, scale=sigma_samples_2_2, size=N2)  # \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f) y = np.zeros((N)) y[:N1] = np.array((1)) y[N1:N] = np.array((2))<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">np.random.seed(1) model = GMM(n_components=k, covariance_type='full') model.fit(X)   temp_predict_X = model.predict(X) X_answers = [] for i in range(X.shape[0]):     if temp_predict_X[i] == 0:         X_answers.append(1)     else:         X_answers.append(2)           print '\u0414\u043e\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u0434\u0435\u043b\u0438\u0439' print round(accuracy_score(y, X_answers),3)<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 \u0443\u0440\u0430! \u0411\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a! \u0427\u0442\u043e \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c, GaussianMixture \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 sklearn \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0435\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0446\u0435\u043b\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0446\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u0430 \ud83d\ude42<\/p>\n<h3>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/h3>\n<p>  <b>\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430<\/b><\/p>\n<p>  1) \u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430: \u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438, \u0421.\u0410. \u0410\u0439\u0432\u0430\u0437\u044f\u043d, \u0412.\u041c. \u0411\u0443\u0445\u0448\u0442\u0430\u0431\u0435\u0440, \u0418.\u0421. \u0415\u043d\u044e\u043a\u043e\u0432, \u041b.\u0414. \u041c\u0435\u0448\u0430\u043b\u043a\u0438\u043d, \u041c\u043e\u0441\u043a\u0432\u0430, \u0424\u0438\u043d\u0430\u043d\u0441\u044b \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430, 1989<\/p>\n<p>  <b>\u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/b><\/p>\n<p>  <a href=\"http:\/\/www-prima.imag.fr\/Prima\/jlc\/Courses\/2006\/ENSI2.SIRR\/EM-tutorial.pdf\" rel=\"nofollow\">1) \u0421\u0442\u0430\u0442\u044c\u044f &#8216;A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models&#8217;, International Computer Science Institute, Jeff A. Bilmes, 1998<\/a><\/p>\n<p>  <a href=\"http:\/\/people.csail.mit.edu\/dsontag\/courses\/ml12\/slides\/lecture21.pdf\" rel=\"nofollow\">2) \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044f &#8216;Mixture Models &amp; EM-algorithm&#8217;, NY University, David Sontag<\/a><\/p>\n<p>  <a href=\"https:\/\/www.coursera.org\/learn\/unsupervised-learning\/lecture\/2jhbI\/expectation-maximization-em-alghoritm\" rel=\"nofollow\">3) \u041a\u0443\u0440\u0441 &#8216;\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445&#8217;<\/a><\/p>\n<p>  <a href=\"http:\/\/mathprofi.ru\/formula_polnoj_verojatnosti_formuly_bajesa.html\" rel=\"nofollow\">4) \u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u043f\u043e\u043b\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0411\u0430\u0439\u0435\u0441\u0430<\/a><\/p>\n<p>  <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.mixture.GaussianMixture.html\" rel=\"nofollow\">5) \u0424\u0443\u043d\u043a\u0446\u0438\u044f &#8216;sklearn.mixture.GaussianMixture&#8217;<\/a><\/p>\n<p>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9D%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE%D0%B5_%D1%80%D0%B0%D1%81%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5\" rel=\"nofollow\">6) \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044f<\/a><\/p>\n<p>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9C%D0%BD%D0%BE%D0%B3%D0%BE%D0%BC%D0%B5%D1%80%D0%BD%D0%BE%D0%B5_%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE%D0%B5_%D1%80%D0%B0%D1%81%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5\" rel=\"nofollow\">7) \u041c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044f<\/a><\/p>\n<p>  8) <a href=\"https:\/\/github.com\/diefimov\/MTH594_MachineLearning\/blob\/master\/ipython\/Lecture10.ipynb\" rel=\"nofollow\">github.com\/diefimov\/MTH594_MachineLearning\/blob\/master\/ipython\/Lecture10.ipynb<\/a><\/p>\n<p>  <a href=\"https:\/\/neerc.ifmo.ru\/wiki\/index.php?title=EM-%D0%B0%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC\" rel=\"nofollow\">9) \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/a><\/p>\n<p>  <a href=\"http:\/\/www.machinelearning.ru\/wiki\/index.php?title=EM_%D0%B0%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%28%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80%29\" rel=\"nofollow\">10) \u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/a><\/p>\n<p>  11) Github <a href=\"https:\/\/github.com\/AlexanderPetrenko83\/Articles\" rel=\"nofollow\">github.com\/AlexanderPetrenko83\/Articles<\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/501850\/\"> https:\/\/habr.com\/ru\/post\/501850\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/501850\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hp\/mv\/ng\/hpmvngrdxhgiu_a7b9vjyx4shsm.jpeg\"><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043a\u0430\u043a \u0412\u044b \u0443\u0436\u0435, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u0442\u0438\u0445\u043e\u043d\u0435\u0447\u043a\u0443 \u0443\u0436\u0435 \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u0442\u0430\u0441\u0430\u0439\u043d\u0442\u0438\u0441\u0442\u043e\u0432. \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0442\u0435\u043c, \u043a\u0442\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u0440\u0435\u0442\u0438\u0439 \u043a\u0443\u0440\u0441 \u00ab\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u00ab\u041c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb \u043e\u0442 \u041c\u0424\u0422\u0418 \u0438 \u042f\u043d\u0434\u0435\u043a\u0441. <\/p>\n<p>  \u0418\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u043c\u044b\u0441\u043b\u0435, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u044b\u0448\u0435\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u043a\u0443\u0440\u0441\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043d\u0430\u0448\u0435\u043c\u0443 \u043c\u043d\u043e\u0433\u043e\u0443\u0432\u0430\u0436\u0430\u0435\u043c\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 (\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b), \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0445 \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0430\u0442\u0441\u0442\u0430\u0442\u0430, \u043d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0438\u043c\u0435\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u0425\u043e\u0442\u044f, \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0438 \u0431\u0435\u0437 \u044d\u0442\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u0447\u0442\u043e-\u0442\u043e \u0434\u0430 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \ud83d\ude42<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043f\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438, \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u0439, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 EM-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043d\u0430\u0441 \u043f\u0440\u044f\u043c\u0451\u0445\u043e\u043d\u044c\u043a\u043e \u043a \u0440\u0430\u0437\u0431\u043e\u0440\u0443 \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u043e\u0434. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 python 2.7, \u0438 \u0437\u0430 \u044d\u0442\u043e \u044f \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0438\u043d\u043e\u0448\u0443 \u0438\u0437\u0432\u0438\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u0432\u044b\u0448\u043b\u043e, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044e, \u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 python 3, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-303553","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303553","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=303553"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303553\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}