{"id":393976,"date":"2024-06-29T11:20:07","date_gmt":"2024-06-29T11:20:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=393976"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=393976","title":{"rendered":"<span>\u0411\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0430\u044f \u0421\u0435\u0442\u044c \u0414\u043e\u0432\u0435\u0440\u0438\u044f: \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b98\/2c1\/d4e\/b982c1d4eab1ab3bae1cfd274e65578a.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b98\/2c1\/d4e\/b982c1d4eab1ab3bae1cfd274e65578a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u0411\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u0435 \u0421\u0435\u0442\u0438 \u0414\u043e\u0432\u0435\u0440\u0438\u044f (\u0411\u0421\u0414). \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u0441\u043d\u043e\u0432\u0443 \u0411\u0421\u0414 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u044d\u0442\u043e\u0439<a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/567574\/\"> <u>\u0441\u0442\u0430\u0442\u044c\u0435<\/u><\/a>.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0442\u0435\u043e\u0440\u0438\u044e. \u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0445\u0430\u0440\u0434\u043a\u043e\u0440: \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u201c\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430\u201d \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0411\u0421\u0414.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/007\/0b7\/b84\/0070b7b84d3b9b0fbf6e91a4117b4012.jpg\" width=\"950\" height=\"360\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/007\/0b7\/b84\/0070b7b84d3b9b0fbf6e91a4117b4012.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0422\u0435\u043e\u0440\u0438\u044f<\/h2>\n<h3>\u041c\u0435\u0442\u043e\u0434\u044b \u043f\u043e \u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0411\u0430\u0439\u0435\u0441\u0430<\/h3>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0411\u0430\u0439\u0435\u0441\u0430, \u043d\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 (\u0440\u0438\u0441.1)<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ddb\/20c\/04c\/ddb20c04cd1791601b3312600b4ff513.png\" alt=\"\u0420\u0438\u0441. 1. \u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u0411\u0430\u0439\u0435\u0441\u0430\" title=\"\u0420\u0438\u0441. 1. \u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u0411\u0430\u0439\u0435\u0441\u0430\" width=\"699\" height=\"295\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ddb\/20c\/04c\/ddb20c04cd1791601b3312600b4ff513.png\"\/><figcaption>\u0420\u0438\u0441. 1. \u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u0411\u0430\u0439\u0435\u0441\u0430<\/figcaption><\/figure>\n<p>[\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f A, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 B] \u0440\u0430\u0432\u043d\u0430 [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f A] \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f B \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f A], \u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u0430 [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f B]<\/p>\n<p>\u0418\u043d\u0430\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430 (\u0410), \u043d\u043e \u0432 \u043d\u0435\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u043e\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 (\u0412). \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0410 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0412 (P (B | \u0410) \/ \u0420 (\u0412)). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 (\u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0410 \u0438 \u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0412) \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443\u043b\u0443.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430: \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043e\u0433\u043e\u0434\u043e\u0439<\/h3>\n<p>\u042d\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/627\/980\/3e5\/6279803e57a3fc42381f1ff49a65c618.jpg\" width=\"994\" height=\"500\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/627\/980\/3e5\/6279803e57a3fc42381f1ff49a65c618.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<ul>\n<li>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u043e\u043b\u043d\u0446\u0430, \u0434\u043e\u0436\u0434\u044f \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0439\/\u043d\u0438\u0437\u043a\u043e\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b, \u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0431\u0443\u0434\u0435\u0442 \u0432\u043b\u0430\u0436\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0442, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u0438\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u043e\u043b\u044f\u0445 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u00ab\u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u00bb \u043a\u0430\u043a \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u00ab\u0434\u043e\u0436\u0434\u044c\u00bb \u0438 \u00ab\u0432\u044b\u0441\u043e\u043a\u0430\u044f\/\u043d\u0438\u0437\u043a\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430\u00bb \u043a\u0430\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0435 \u043e\u0442 \u00ab\u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u00bb, \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u00ab\u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c\u00bb, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0430\u044f \u043e\u0442 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0442\u0435\u043a\u0441\u0442\u0435, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0432 \u043f\u0440\u0430\u0432\u043e\u043c \u043d\u0438\u0436\u043d\u0435\u043c \u0443\u0433\u043b\u0443 \u0441\u0445\u0435\u043c\u044b, \u0437\u0430\u0434\u0430\u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 100%, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u0430 \u201c\u0432\u043b\u0430\u0436\u043d\u043e=\u0434\u0430\u201d = 46%, \u0430 \u0438\u0441\u0445\u043e\u0434\u0430 \u201c\u0432\u043b\u0430\u0436\u043d\u043e=\u043d\u0435\u0442\u201d = 54%.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0438\u043d\u043e\u043f\u0442\u0438\u043a\u0438 \u043e\u0446\u0435\u043d\u0438\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f \u043d\u0430 \u0437\u0430\u0432\u0442\u0440\u0430 \u0432 30%.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c \u043e\u043d\u0438 \u043e\u0446\u0435\u043d\u0438\u043b\u0438 \u0432 50%.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0436\u0434\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 100% (\u043e\u0431\u043b\u0430\u043a\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0436\u0434\u044f).<\/p>\n<\/li>\n<\/ol>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>P (A) = \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f = 30%<\/p>\n<\/li>\n<li>\n<p>P (B) = \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u043a\u043e\u0432 = 50%<\/p>\n<\/li>\n<li>\n<p>P (B | A) = \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u0434\u043e\u0436\u0434\u044c = 100%<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b \u043f\u0440\u043e\u0441\u044b\u043f\u0430\u0435\u0442\u0435\u0441\u044c \u0443\u0442\u0440\u043e\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u2014 \u043d\u0430 \u043d\u0435\u0431\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0431\u043b\u0430\u043a\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0411\u0430\u0439\u0435\u0441\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u043d\u044c.<\/p>\n<p>\u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435: P (A | B) = P (A) * P (B | A) \/ P (B) = [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f] * [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0436\u0434\u044f] \/ [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0432 \u0446\u0435\u043b\u043e\u043c] = 30% * 100% \/ 50% = 60%.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u043d\u043e\u0437 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0436\u0434\u044f \u2013 \u043e\u043d \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0441\u044f \u0441 30% \u0434\u043e 60%.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0411\u0421\u0414.<\/p>\n<p>\u0411\u0421\u0414 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0443 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u0411\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0411\u0421\u0414 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0444 (\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c) \u0438 \u043d\u0430\u0431\u043e\u0440 \u0442\u0430\u0431\u043b\u0438\u0446 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438. <\/p>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f, \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0411\u0421\u0414 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u201c\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430\u201d.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<pre><code class=\"python\">import warnings import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats.stats import pearsonr from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, recall_score, precision_score  %matplotlib inline # \u0421\u043a\u0440\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f warnings.filterwarnings(\"ignore\")<\/code><\/pre>\n<h4>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u043e\u0431\u043e\u0431\u0449\u0430\u044e\u0449\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432.<\/h4>\n<pre><code class=\"python\">def cross_validate(estimator, train, validation):     X_train = train[0]     Y_train = train[1]     X_val = validation[0]     Y_val = validation[1]     train_predictions = classifier.predict(X_train)     train_accuracy = accuracy_score(train_predictions, Y_train)     train_recall = recall_score(train_predictions, Y_train)     train_precision = precision_score(train_predictions, Y_train)      val_predictions = classifier.predict(X_val)     val_accuracy = accuracy_score(val_predictions, Y_val)     val_recall = recall_score(val_predictions, Y_val)     val_precision = precision_score(val_predictions, Y_val)      print('Model metrics')     print('Accuracy  Train: %.2f, Validation: %.2f' % (train_accuracy, val_accuracy))     print('Recall    Train: %.2f, Validation: %.2f' % (train_recall, val_recall))     print('Precision Train: %.2f, Validation: %.2f' % (train_precision, val_precision))<\/code><\/pre>\n<h4>\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0443\u0436\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0438 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0432 \u043a\u043e\u0434\u0435.<\/h4>\n<pre><code class=\"python\">train_raw = pd.read_csv('..\/input\/train.csv') test_raw = pd.read_csv('..\/input\/test.csv') test_ids = test_raw['PassengerId'].values  #  \u0421\u043e\u0435\u0434\u0438\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435. train_raw['train'] = 1 test_raw['train'] = 0 data = train_raw.append(test_raw, sort=False)<\/code><\/pre>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0411\u0421\u0414 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0430\u0441\u0442 \u0432\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u041d\u043e \u0411\u0421\u0414 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (<em>\u0430\u043d\u0433\u043b. deep learning<\/em>).<\/p>\n<h4>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0438\u0436\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0447\u0438\u0441\u0442\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c\u0438 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0444\u0430\u0439\u043b\u0430\u0445. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043e\u0447\u0438\u0441\u0442\u043a\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0431\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a \u043e\u0442\u0431\u043e\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043e\u0442\u0431\u043e\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u043b\u0438 \u043e\u0442\u0431\u043e\u0440 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u043e\u0432. \u0412 \u0440\u0435\u0434\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0442\u0431\u043e\u0440\u0430 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (\u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445, \u0442\u0430\u043a \u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445) \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>Feature engineering. \u041f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u043f\u0443\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u2013\u00a0 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0447\u0438\u0441\u0442\u043a\u0438. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">features = ['Age', 'Embarked', 'Fare', 'Parch', 'Pclass', 'Sex', 'SibSp'] target = 'Survived'  data = data[features + [target] + ['train']] # \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435. data['Sex'] = data['Sex'].replace([\"female\", \"male\"], [0, 1]) data['Embarked'] = data['Embarked'].replace(['S', 'C', 'Q'], [1, 2, 3]) data['Age'] = pd.qcut(data['Age'], 10, labels=False)<\/code><\/pre>\n<pre><code class=\"python\"># \u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438. train = data.query('train == 1') test = data.query('train == 0')  # \u0423\u0434\u0430\u043b\u0438\u043c null \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0440\u0435\u043d\u0435\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. train.dropna(axis=0, inplace=True) labels = train[target].values<\/code><\/pre>\n<p>\u041d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\">train.head()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8a0\/7bd\/771\/8a07bd77122acda2bd27a82f4a6eaa61.png\" width=\"1005\" height=\"162\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a0\/7bd\/771\/8a07bd77122acda2bd27a82f4a6eaa61.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>\u0411\u0421\u0414 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442, \u0447\u0442\u043e features (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445) \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u043d\u0438\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u041f\u0438\u0440\u0441\u043e\u043d\u0430. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043e \u0442\u043e\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430.<\/p>\n<pre><code class=\"python\">columns = train[features + [target]].columns.tolist() nColumns = len(columns) result = pd.DataFrame(np.zeros((nColumns, nColumns)), columns=columns)  # \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e \u041f\u0438\u0440\u0441\u043e\u043d\u0430 \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. for col_a in range(nColumns):     for col_b in range(nColumns):         result.iloc[[col_a], [col_b]] = pearsonr(train.loc[:, columns[col_a]], train.loc[:,  columns[col_b]])[0]          fig, ax = plt.subplots(figsize=(10,10)) ax = sns.heatmap(result, yticklabels=columns, vmin=-1, vmax=1, annot=True, fmt='.2f', linewidths=.2) ax.set_title('PCC - Pearson correlation coefficient') plt.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39f\/2c9\/6f7\/39f2c96f7074cc904dc133112f5fc278.png\" width=\"570\" height=\"598\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/39f\/2c9\/6f7\/39f2c96f7074cc904dc133112f5fc278.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u00abFare\u00bb \u0438 \u00abPclass\u00bb \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0431\u0435\u0440\u0435\u043c \u00abPclass\u00bb. \u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u0438\u043c\u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u00abSex\u00bb, \u00abPclass\u00bb \u0438 \u00abFare\u00bb.<\/p>\n<h4>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0436\u0438\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0435\u043e\u0440\u0435\u043c\u043e\u0439 \u0413\u0430\u0443\u0441\u0441\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">continuous_numeric_features = ['Age', 'Fare', 'Parch', 'SibSp'] for feature in continuous_numeric_features:     sns.distplot(train[feature])     plt.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f77\/022\/80a\/f7702280ababefc26244c653ca04e3ab.png\" width=\"1179\" height=\"820\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f77\/022\/80a\/f7702280ababefc26244c653ca04e3ab.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 &#171;Fare&#187;, &#171;Parch&#187; \u0438 &#171;SibSp&#187; \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443, \u043d\u043e \u0441 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0435\u0439 \u0432\u043b\u0435\u0432\u043e; \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 &#171;Age&#187; \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u043d\u043e \u044d\u0442\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"python\">train.drop(['train', target, 'Pclass'], axis=1, inplace=True) test.drop(['train', target, 'Pclass'], axis=1, inplace=True)<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 (80%) \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 (20%)<\/p>\n<pre><code class=\"python\">X_train, X_val, Y_train, Y_val = train_test_split(train, labels, test_size=0.2, random_state=1)  X_train.head()<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u0449\u0451 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 (\u0432 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 70% \u043d\u0430 30%)<\/p>\n<pre><code class=\"python\">X_train1, X_train2, Y_train1, Y_train2 = train_test_split(X_train, Y_train, test_size=0.3, random_state=12)<\/code><\/pre>\n<h4>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0411\u0421\u0414:<\/h4>\n<ul>\n<li>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439, \u0441 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0411\u0430\u0439\u0435\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0433\u0434\u0435 \u043a\u043b\u0430\u0441\u0441 \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<pre><code class=\"python\">classifier = GaussianNB()<\/code><\/pre>\n<p>\u041e\u0431\u0443\u0447\u0438\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<pre><code class=\"python\">classifier.fit(X_train2, Y_train2) print('Metrics with only 30% of train data') cross_validate(classifier, (X_train, Y_train), (X_val, Y_val))<\/code><\/pre>\n<pre><code>Metrics with only 30% of train data Model metrics Accuracy  Train: 0.79, Validation: 0.76 Recall    Train: 0.75, Validation: 0.71 Precision Train: 0.71, Validation: 0.71<\/code><\/pre>\n<h3>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0411\u0421\u0414 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u0440\u0438\u0447\u0451\u043c \u0434\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/h3>\n<pre><code class=\"python\">classifier.partial_fit(X_train1, Y_train1)  print('Metrics with the remaining 70% of train data') cross_validate(classifier, (X_train, Y_train), (X_val, Y_val))<\/code><\/pre>\n<pre><code>Metrics with the remaining 70% of train data Model metrics Accuracy  Train: 0.80, Validation: 0.76 Recall    Train: 0.78, Validation: 0.70 Precision Train: 0.69, Validation: 0.69<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043c\u0435\u0440\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<pre><code class=\"python\">print('Probability of each class') print('Survive = 0: %.2f' % classifier.class_prior_[0]) print('Survive = 1: %.2f' % classifier.class_prior_[1])<\/code><\/pre>\n<pre><code>Probability of each class Survive = 0: 0.60 Survive = 1: 0.40<\/code><\/pre>\n<pre><code class=\"python\">print('Mean of each feature per class') print('               Age         Embarked   Fare         Parch       Sex         SibSp') print('Survive = 0: %s' % classifier.theta_[0]) print('Survive = 1: %s' % classifier.theta_[1])<\/code><\/pre>\n<pre><code>Mean of each feature per class                Age         Embarked   Fare         Parch       Sex         SibSp Survive = 0: [ 4.5339233   1.23893805 22.97357316  0.37463127  0.86135693  0.5280236 ] Survive = 1: [ 4.27391304  1.33478261 53.52155957  0.52608696  0.33043478  0.49130435] <\/code><\/pre>\n<pre><code class=\"python\">print('Variance of each feature per class') print('Survive = 0: %s' % classifier.sigma_[0]) print('Survive = 1: %s' % classifier.sigma_[1])<\/code><\/pre>\n<pre><code>Variance of each feature per class Survive = 0: [8.32554825e+00 2.88044224e-01 8.60096730e+02 8.36055467e-01  1.19424042e-01 1.11647419e+00] Survive = 1: [8.45106148e+00 2.74880003e-01 5.28959488e+03 6.75409304e-01  2.21250514e-01 4.41231610e-01]<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<pre><code class=\"python\"># \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0430\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0411\u0430\u0439\u0435\u0441\u0430 sklearn \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u043e\u0432, \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043f\u0443\u0449\u0435\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438.. test.fillna(test.mean(), inplace=True) test_predictions = classifier.predict(test) submission = pd.DataFrame({'PassengerId': test_ids}) submission['Survived'] = test_predictions.astype('int') submission.to_csv('submission.csv', index=False) submission.head(10)<\/code><\/pre>\n<figure class=\"float\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/210\/e39\/01d\/210e3901d3d0fbe480d450ef9de66372.png\" width=\"186\" height=\"294\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/210\/e39\/01d\/210e3901d3d0fbe480d450ef9de66372.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u0411\u0421\u0414<\/h3>\n<h4>\u041f\u043b\u044e\u0441\u044b:<\/h4>\n<ul>\n<li>\n<p>\u041e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. \u041b\u044e\u0434\u044f\u043c \u043d\u0435\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043e \u043d\u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041b\u0435\u0433\u043a\u043e\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0411\u0421\u0414 \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0411\u0421\u0414 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0435\u0439), \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0421\u0414 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u043c\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u043d\u0438\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 (\u043a\u043e\u043b\u043e\u043a\u043e\u043b\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c).<\/p>\n<\/li>\n<\/ul>\n<h4>\u041c\u0438\u043d\u0443\u0441\u044b:<\/h4>\n<ul>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0411\u0421\u0414.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e (\u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u043b\u0430\u0441\u044c \u0432 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442 \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438 \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437. \u042d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u00ab\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439\u00bb. \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f. \u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0446\u0435\u043d\u043a\u043e\u0439 \u041b\u0430\u043f\u043b\u0430\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0421\u0414 \u0434\u0430\u0451\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0430 \u043d\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043a \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e predict_proba, \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u043e\u0432. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0411\u0421\u0414 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u0432 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u0438 \u043e\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043e \u043d\u0430 \u0437\u043d\u0430\u043d\u0438\u044f\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0438\u0445 \u0435\u0433\u043e. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044d\u0442\u0430 \u0447\u0435\u0440\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0411\u0421\u0414 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u0438 \u0438\u043c\u0435\u044e\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0430\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/p>\n<h3>\u0421\u043e\u0432\u0435\u0442\u044b \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438:<\/h3>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u0438\u043b\u0438 \u00ab\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u041b\u0430\u043f\u043b\u0430\u0441\u0430\u00bb, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u0435 \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0438\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0432\u0430\u0436\u0434\u044b, \u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0437\u0430\u0432\u044b\u0448\u0435\u043d\u0438\u044e \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0438\u043c\u0435\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a alpha=1 \u0434\u043b\u044f \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, fit_prior=[True|False] \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u044b\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u0415\u0441\u0442\u044c \u043e\u0431\u0449\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u044d\u0442\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432: \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u044c, \u0431\u044d\u0433\u0433\u0438\u043d\u0433 \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0445 \u0446\u0435\u043b\u044c \u2014 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e. \u0423 \u0411\u0421\u0414 \u043d\u0435\u0442 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/machinelearningmastery.com\/introduction-to-bayesian-networks-with-jhonatan-de-souza-oliveira\/\">Introduction to Bayesian Networks with Jhonatan de Souza Oliveira<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2017\/09\/naive-bayes-explained\/\">6 Easy Steps to Learn Naive Bayes Algorithm with codes in Python and R<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/machinelearningmastery.com\/better-naive-bayes\/\">Better Naive Bayes: 12 Tips To Get The Most From The Naive Bayes Algorithm<\/a><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<p>\u0412\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0414\u0435\u0439\u043a\u0441\u0442\u0440\u044b \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u0440\u0430\u0442\u0447\u0430\u0439\u0448\u0435\u0433\u043e \u043f\u0443\u0442\u0438 \u0432\u043e \u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u043e\u043c \u0433\u0440\u0430\u0444\u0435\u00bb. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430<a href=\"https:\/\/otus.pw\/Nsu3\/\"> \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/658311\/\"> https:\/\/habr.com\/ru\/articles\/658311\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u0411\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u0435 \u0421\u0435\u0442\u0438 \u0414\u043e\u0432\u0435\u0440\u0438\u044f (\u0411\u0421\u0414). \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u0441\u043d\u043e\u0432\u0443 \u0411\u0421\u0414 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u044d\u0442\u043e\u0439<a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/567574\/\"> <u>\u0441\u0442\u0430\u0442\u044c\u0435<\/u><\/a>.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0442\u0435\u043e\u0440\u0438\u044e. \u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0445\u0430\u0440\u0434\u043a\u043e\u0440: \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u201c\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430\u201d \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0411\u0421\u0414.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0422\u0435\u043e\u0440\u0438\u044f<\/h2>\n<h3>\u041c\u0435\u0442\u043e\u0434\u044b \u043f\u043e \u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0411\u0430\u0439\u0435\u0441\u0430<\/h3>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0411\u0430\u0439\u0435\u0441\u0430, \u043d\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 (\u0440\u0438\u0441.1)<\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0438\u0441. 1. \u0422\u0435\u043e\u0440\u0435\u043c\u0430 \u0411\u0430\u0439\u0435\u0441\u0430<\/figcaption><\/figure>\n<p>[\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f A, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 B] \u0440\u0430\u0432\u043d\u0430 [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f A] \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f B \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f A], \u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u0430 [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f B]<\/p>\n<p>\u0418\u043d\u0430\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430 (\u0410), \u043d\u043e \u0432 \u043d\u0435\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u043e\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 (\u0412). \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0410 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0412 (P (B | \u0410) \/ \u0420 (\u0412)). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 (\u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0410 \u0438 \u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0412) \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443\u043b\u0443.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430: \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043e\u0433\u043e\u0434\u043e\u0439<\/h3>\n<p>\u042d\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<ul>\n<li>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u043e\u043b\u043d\u0446\u0430, \u0434\u043e\u0436\u0434\u044f \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0439\/\u043d\u0438\u0437\u043a\u043e\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b, \u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0431\u0443\u0434\u0435\u0442 \u0432\u043b\u0430\u0436\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0442, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u0438\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u043e\u043b\u044f\u0445 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u00ab\u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u00bb \u043a\u0430\u043a \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u00ab\u0434\u043e\u0436\u0434\u044c\u00bb \u0438 \u00ab\u0432\u044b\u0441\u043e\u043a\u0430\u044f\/\u043d\u0438\u0437\u043a\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430\u00bb \u043a\u0430\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0435 \u043e\u0442 \u00ab\u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u00bb, \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u00ab\u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c\u00bb, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0430\u044f \u043e\u0442 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0442\u0435\u043a\u0441\u0442\u0435, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0432 \u043f\u0440\u0430\u0432\u043e\u043c \u043d\u0438\u0436\u043d\u0435\u043c \u0443\u0433\u043b\u0443 \u0441\u0445\u0435\u043c\u044b, \u0437\u0430\u0434\u0430\u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 100%, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u0430 \u201c\u0432\u043b\u0430\u0436\u043d\u043e=\u0434\u0430\u201d = 46%, \u0430 \u0438\u0441\u0445\u043e\u0434\u0430 \u201c\u0432\u043b\u0430\u0436\u043d\u043e=\u043d\u0435\u0442\u201d = 54%.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0438\u043d\u043e\u043f\u0442\u0438\u043a\u0438 \u043e\u0446\u0435\u043d\u0438\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f \u043d\u0430 \u0437\u0430\u0432\u0442\u0440\u0430 \u0432 30%.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c \u043e\u043d\u0438 \u043e\u0446\u0435\u043d\u0438\u043b\u0438 \u0432 50%.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0436\u0434\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 100% (\u043e\u0431\u043b\u0430\u043a\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0436\u0434\u044f).<\/p>\n<\/li>\n<\/ol>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>P (A) = \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f = 30%<\/p>\n<\/li>\n<li>\n<p>P (B) = \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u043a\u043e\u0432 = 50%<\/p>\n<\/li>\n<li>\n<p>P (B | A) = \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u0434\u043e\u0436\u0434\u044c = 100%<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b \u043f\u0440\u043e\u0441\u044b\u043f\u0430\u0435\u0442\u0435\u0441\u044c \u0443\u0442\u0440\u043e\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u2014 \u043d\u0430 \u043d\u0435\u0431\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0431\u043b\u0430\u043a\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0411\u0430\u0439\u0435\u0441\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u043d\u044c.<\/p>\n<p>\u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435: P (A | B) = P (A) * P (B | A) \/ P (B) = [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0436\u0434\u044f] * [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0436\u0434\u044f] \/ [\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0432 \u0446\u0435\u043b\u043e\u043c] = 30% * 100% \/ 50% = 60%.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u043d\u043e\u0437 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0436\u0434\u044f \u2013 \u043e\u043d \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0441\u044f \u0441 30% \u0434\u043e 60%.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0411\u0421\u0414.<\/p>\n<p>\u0411\u0421\u0414 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0443 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u0411\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0411\u0421\u0414 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0444 (\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c) \u0438 \u043d\u0430\u0431\u043e\u0440 \u0442\u0430\u0431\u043b\u0438\u0446 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438. <\/p>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f, \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0411\u0421\u0414 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u201c\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430\u201d.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<pre><code class=\"python\">import warnings import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats.stats import pearsonr from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, recall_score, precision_score  %matplotlib inline # \u0421\u043a\u0440\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f warnings.filterwarnings(\"ignore\")<\/code><\/pre>\n<h4>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u043e\u0431\u043e\u0431\u0449\u0430\u044e\u0449\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432.<\/h4>\n<pre><code class=\"python\">def cross_validate(estimator, train, validation):     X_train = train[0]     Y_train = train[1]     X_val = validation[0]     Y_val = validation[1]     train_predictions = classifier.predict(X_train)     train_accuracy = accuracy_score(train_predictions, Y_train)     train_recall = recall_score(train_predictions, Y_train)     train_precision = precision_score(train_predictions, Y_train)      val_predictions = classifier.predict(X_val)     val_accuracy = accuracy_score(val_predictions, Y_val)     val_recall = recall_score(val_predictions, Y_val)     val_precision = precision_score(val_predictions, Y_val)      print('Model metrics')     print('Accuracy  Train: %.2f, Validation: %.2f' % (train_accuracy, val_accuracy))     print('Recall    Train: %.2f, Validation: %.2f' % (train_recall, val_recall))     print('Precision Train: %.2f, Validation: %.2f' % (train_precision, val_precision))<\/code><\/pre>\n<h4>\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0443\u0436\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0438 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0432 \u043a\u043e\u0434\u0435.<\/h4>\n<pre><code class=\"python\">train_raw = pd.read_csv('..\/input\/train.csv') test_raw = pd.read_csv('..\/input\/test.csv') test_ids = test_raw['PassengerId'].values  #  \u0421\u043e\u0435\u0434\u0438\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435. train_raw['train'] = 1 test_raw['train'] = 0 data = train_raw.append(test_raw, sort=False)<\/code><\/pre>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0411\u0421\u0414 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0430\u0441\u0442 \u0432\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u041d\u043e \u0411\u0421\u0414 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (<em>\u0430\u043d\u0433\u043b. deep learning<\/em>).<\/p>\n<h4>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0438\u0436\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0447\u0438\u0441\u0442\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c\u0438 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0444\u0430\u0439\u043b\u0430\u0445. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043e\u0447\u0438\u0441\u0442\u043a\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0431\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a \u043e\u0442\u0431\u043e\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043e\u0442\u0431\u043e\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u043b\u0438 \u043e\u0442\u0431\u043e\u0440 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u043e\u0432. \u0412 \u0440\u0435\u0434\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0442\u0431\u043e\u0440\u0430 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (\u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445, \u0442\u0430\u043a \u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445) \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>Feature engineering. \u041f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u043f\u0443\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u2013\u00a0 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0447\u0438\u0441\u0442\u043a\u0438. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">features = ['Age', 'Embarked', 'Fare', 'Parch', 'Pclass', 'Sex', 'SibSp'] target = 'Survived'  data = data[features + [target] + ['train']] # \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435. data['Sex'] = data['Sex'].replace([\"female\", \"male\"], [0, 1]) data['Embarked'] = data['Embarked'].replace(['S', 'C', 'Q'], [1, 2, 3]) data['Age'] = pd.qcut(data['Age'], 10, labels=False)<\/code><\/pre>\n<pre><code class=\"python\"># \u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438. train = data.query('train == 1') test = data.query('train == 0')  # \u0423\u0434\u0430\u043b\u0438\u043c null \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0440\u0435\u043d\u0435\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. train.dropna(axis=0, inplace=True) labels = train[target].values<\/code><\/pre>\n<p>\u041d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\">train.head()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>\u0411\u0421\u0414 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442, \u0447\u0442\u043e features (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445) \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u043d\u0438\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u041f\u0438\u0440\u0441\u043e\u043d\u0430. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043e \u0442\u043e\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430.<\/p>\n<pre><code class=\"python\">columns = train[features + [target]].columns.tolist() nColumns = len(columns) result = pd.DataFrame(np.zeros((nColumns, nColumns)), columns=columns)  # \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e \u041f\u0438\u0440\u0441\u043e\u043d\u0430 \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. for col_a in range(nColumns):     for col_b in range(nColumns):         result.iloc[[col_a], [col_b]] = pearsonr(train.loc[:, columns[col_a]], train.loc[:,  columns[col_b]])[0]          fig, ax = plt.subplots(figsize=(10,10)) ax = sns.heatmap(result, yticklabels=columns, vmin=-1, vmax=1, annot=True, fmt='.2f', linewidths=.2) ax.set_title('PCC - Pearson correlation coefficient') plt.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u00abFare\u00bb \u0438 \u00abPclass\u00bb \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0431\u0435\u0440\u0435\u043c \u00abPclass\u00bb. \u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u0438\u043c\u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u00abSex\u00bb, \u00abPclass\u00bb \u0438 \u00abFare\u00bb.<\/p>\n<h4>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0436\u0438\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0435\u043e\u0440\u0435\u043c\u043e\u0439 \u0413\u0430\u0443\u0441\u0441\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">continuous_numeric_features = ['Age', 'Fare', 'Parch', 'SibSp'] for feature in continuous_numeric_features:     sns.distplot(train[feature])     plt.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 &#171;Fare&#187;, &#171;Parch&#187; \u0438 &#171;SibSp&#187; \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443, \u043d\u043e \u0441 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0435\u0439 \u0432\u043b\u0435\u0432\u043e; \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 &#171;Age&#187; \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u043d\u043e \u044d\u0442\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"python\">train.drop(['train', target, 'Pclass'], axis=1, inplace=True) test.drop(['train', target, 'Pclass'], axis=1, inplace=True)<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 (80%) \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 (20%)<\/p>\n<pre><code class=\"python\">X_train, X_val, Y_train, Y_val = train_test_split(train, labels, test_size=0.2, random_state=1)  X_train.head()<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u0449\u0451 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 (\u0432 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 70% \u043d\u0430 30%)<\/p>\n<pre><code class=\"python\">X_train1, X_train2, Y_train1, Y_train2 = train_test_split(X_train, Y_train, test_size=0.3, random_state=12)<\/code><\/pre>\n<h4>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0411\u0421\u0414:<\/h4>\n<ul>\n<li>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439, \u0441 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0411\u0430\u0439\u0435\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0433\u0434\u0435 \u043a\u043b\u0430\u0441\u0441 \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<pre><code class=\"python\">classifier = GaussianNB()<\/code><\/pre>\n<p>\u041e\u0431\u0443\u0447\u0438\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<pre><code class=\"python\">classifier.fit(X_train2, Y_train2) print('Metrics with only 30% of train data') cross_validate(classifier, (X_train, Y_train), (X_val, Y_val))<\/code><\/pre>\n<pre><code>Metrics with only 30% of train data Model metrics Accuracy  Train: 0.79, Validation: 0.76 Recall    Train: 0.75, Validation: 0.71 Precision Train: 0.71, Validation: 0.71<\/code><\/pre>\n<h3>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0411\u0421\u0414 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u0440\u0438\u0447\u0451\u043c \u0434\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/h3>\n<pre><code class=\"python\">classifier.partial_fit(X_train1<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-393976","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/393976","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=393976"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/393976\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=393976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=393976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=393976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}