{"id":283965,"date":"2017-03-27T15:30:02","date_gmt":"2017-03-27T11:30:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283965"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283965","title":{"rendered":"\u041e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u0443\u0440\u0441 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0422\u0435\u043c\u0430 5. \u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438: \u0431\u044d\u0433\u0433\u0438\u043d\u0433, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441"},"content":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0434\u043e\u0436\u0438\u043b \u0434\u043e \u043f\u044f\u0442\u043e\u0439 \u0442\u0435\u043c\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0443\u0440\u0441\u0430! <\/p>\n<p>  <\/p>\n<p>\u041a\u0443\u0440\u0441 \u0441\u043e\u0431\u0440\u0430\u043b \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 1000 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u0438\u0437 \u043d\u0438\u0445 \u043f\u0435\u0440\u0432\u044b\u0435 3 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u043b\u0438 520, 450 \u0438 360 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1f8\/981\/50a\/1f898150a862463bae79b42e3da32beb.jpg\" align=\"right\" width=\"400\"\/> \u041e\u043a\u043e\u043b\u043e 200 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043f\u043e\u043a\u0430 \u0438\u0434\u0443\u0442 \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0431\u0430\u043b\u043b\u043e\u043c. \u041e\u0442\u0442\u043e\u043a \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435, \u0447\u0435\u043c \u0432 MOOC-\u0430\u0445, \u0434\u0430\u0436\u0435 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u043d\u0430\u0448\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439. <\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u043c\u044b \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438: \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0443 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c\u0443 \u043b\u0435\u0441\u0443. \u0412\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0435\u0435 \u0447\u0430\u0441\u0442\u0438; \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e, \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438; \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441, \u043a\u0430\u043a\u0438\u0435 \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0443\u0436\u043d\u043e \u00ab\u043f\u043e\u0434\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c\u00bb \u0438 \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a. \u0421\u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u00ab\u0449\u0435\u043f\u043e\u0442\u043a\u0443\u00bb \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0430\u0442\u0435\u0439 \u0441\u0435\u0440\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<ol>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/322626\/\">\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Pandas<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/323210\/\">\u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 c Python<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/322534\/\">\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/323890\/\">\u041b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/324402\/\">\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438: \u0431\u044d\u0433\u0433\u0438\u043d\u0433, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441<\/a><\/li>\n<li>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0443\u0447\u0438\u0442\u0435\u043b\u044f: PCA, \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u043f\u043e\u0438\u0441\u043a \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439<\/li>\n<li>\u0418\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u0431\u043e\u0440\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0433\u0435\u043e-\u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h4 id=\"plan-etoy-stati\">\u041f\u043b\u0430\u043d \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/h4>\n<p>  <\/p>\n<ol>\n<li>\u0411\u044d\u0433\u0433\u0438\u043d\u0433<br \/> \n<ul>\n<li>\u0410\u043d\u0441\u0430\u043c\u0431\u043b\u0438<\/li>\n<li>\u0411\u0443\u0442\u0441\u0442\u0440\u044d\u043f<\/li>\n<li>\u0411\u044d\u0433\u0433\u0438\u043d\u0433<\/li>\n<li>Out-of-bag \u043e\u0448\u0438\u0431\u043a\u0430<\/li>\n<\/ul>\n<\/li>\n<li>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441<br \/> \n<ul>\n<li>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/li>\n<li>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u043e\u043c<\/li>\n<li>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438<\/li>\n<li>\u0412\u0430\u0440\u0438\u0430\u0446\u0438\u044f \u0438 \u0434\u0435\u043a\u043a\u043e\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442<\/li>\n<li>\u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/li>\n<li>\u0421\u0432\u0435\u0440\u0445\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f<\/li>\n<li>\u0421\u0445\u043e\u0436\u0435\u0441\u0442\u044c \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c k-\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/li>\n<li>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0432 \u0432\u044b\u0441\u043e\u043a\u043e\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e<\/li>\n<\/ul>\n<\/li>\n<li>\u041e\u0446\u0435\u043d\u043a\u0430 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/li>\n<li>\u041f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430<\/li>\n<li>\u0414\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u21165<\/li>\n<li>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"1-begging\">1. \u0411\u044d\u0433\u0433\u0438\u043d\u0433<\/h2>\n<p>  <\/p>\n<p>\u0418\u0437 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u043b\u0435\u043a\u0446\u0438\u0439 \u0432\u044b \u0443\u0436\u0435 \u0443\u0437\u043d\u0430\u043b\u0438 \u043f\u0440\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u043d\u0430\u0448\u043b\u0438 \u043b\u0443\u0447\u0448\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435? \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u043e\u043c \u00ab\u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0438\u00bb. \u0410\u043d\u0441\u0430\u043c\u0431\u043b\u044c \u2014 \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c, \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0435\u0434\u0438\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435. \u0418\u0437 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0438, \u0433\u0434\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0438 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0437\u0434\u0430\u043d\u0438\u044f\u043c\u0438 \u0438 \u0442.\u0434. <\/p>\n<p>  <\/p>\n<h3 id=\"ansambli\">\u0410\u043d\u0441\u0430\u043c\u0431\u043b\u0438<\/h3>\n<p>  <\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0435\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u041a\u043e\u043d\u0434\u043e\u0440\u0441\u0435 \u00ab\u043e \u0436\u044e\u0440\u0438 \u043f\u0440\u0438\u0441\u044f\u0436\u043d\u044b\u0445\u00bb (1784). \u0415\u0441\u043b\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u043b\u0435\u043d \u0436\u044e\u0440\u0438 \u043f\u0440\u0438\u0441\u044f\u0436\u043d\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u0438 \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0447\u043b\u0435\u043d\u0430 \u0436\u044e\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 0.5, \u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0441\u044f\u0436\u043d\u044b\u0445 \u0432 \u0446\u0435\u043b\u043e\u043c \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0447\u043b\u0435\u043d\u043e\u0432 \u0436\u044e\u0440\u0438 \u0438 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u0435\u0434\u0438\u043d\u0438\u0446\u0435. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0431\u044b\u0442\u044c \u043f\u0440\u0430\u0432\u044b\u043c \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0447\u043b\u0435\u043d\u043e\u0432 \u0436\u044e\u0440\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 0.5, \u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0441\u044f\u0436\u043d\u044b\u043c\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u0438 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u044e \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u0438\u0441\u044f\u0436\u043d\u044b\u0445. <\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0f\/798\/ca2\/b0f798ca2d95e85bd11d5fe8007101e2.svg\" alt=\"$\\large N $\" data-tex=\"inline\"\/><\/math> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0441\u044f\u0436\u043d\u044b\u0445<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/147\/2cf\/b61\/1472cfb6148381eade7be0dd164154b7.svg\" alt=\"$\\large p $\" data-tex=\"inline\"\/><\/math> \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0441\u044f\u0436\u043d\u043e\u0433\u043e<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e99\/535\/5ef\/e995355ef3fbedd7a65ab7d156d94e86.svg\" alt=\"$\\large \\mu $\" data-tex=\"inline\"\/><\/math> \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0436\u044e\u0440\u0438  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/91d\/c99\/9bd\/91dc999bd4f3d0a17e7509f915668c3d.svg\" alt=\"$ \\large \\mu = \\sum_{i=m}^{N}C_N^ip^i(1-p)^{N-i} $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  \u0415\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3df\/efe\/d20\/3dfefed2044d004c87157a6a4d621b1a.svg\" alt=\"$\\large p &gt; 0 $\" data-tex=\"inline\"\/><\/math>, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ed7\/58a\/6ca\/ed758a6ca31be4f179f861bc2f3fc587.svg\" alt=\"$\\large \\mu &gt; p $\" data-tex=\"inline\"\/><\/math>  <\/p>\n<p>\u0415\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/331\/529\/445\/3315294452bb6792d0d4a04c48e1c3a7.svg\" alt=\"$\\large N \\rightarrow \\infty $\" data-tex=\"inline\"\/><\/math>, \u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bbd\/ee6\/cd4\/bbdee6cd4604dfa08f5607e564aa2289.svg\" alt=\"$\\large \\mu \\rightarrow 1 $\" data-tex=\"inline\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0435\u0439 \u2014 &quot;\u041c\u0443\u0434\u0440\u043e\u0441\u0442\u044c \u0442\u043e\u043b\u043f\u044b&quot;. \u0424\u0440\u044d\u043d\u0441\u0438\u0441 \u0413\u0430\u043b\u044c\u0442\u043e\u043d \u0432 1906 \u0433\u043e\u0434\u0443 \u043f\u043e\u0441\u0435\u0442\u0438\u043b \u0440\u044b\u043d\u043e\u043a, \u0433\u0434\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043d\u0435\u043a\u0430\u044f \u043b\u043e\u0442\u0435\u0440\u0435\u044f \u0434\u043b\u044f \u043a\u0440\u0435\u0441\u0442\u044c\u044f\u043d. <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d58\/66e\/f0b\/d5866ef0bfe6416952f8ebc14f07ed2b.png\" align=\"right\" width=\"15%\" height=\"15%\"\/><br \/>  \u0418\u0445 \u0441\u043e\u0431\u0440\u0430\u043b\u043e\u0441\u044c \u043e\u043a\u043e\u043b\u043e 800 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0438 \u043e\u043d\u0438 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0432\u0435\u0441 \u0431\u044b\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u043e\u044f\u043b \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438. \u0415\u0433\u043e \u0432\u0435\u0441 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b 1198 \u0444\u0443\u043d\u0442\u043e\u0432. \u041d\u0438 \u043e\u0434\u0438\u043d \u043a\u0440\u0435\u0441\u0442\u044c\u044f\u043d\u0438\u043d \u043d\u0435 \u0443\u0433\u0430\u0434\u0430\u043b \u0442\u043e\u0447\u043d\u044b\u0439 \u0432\u0435\u0441 \u0431\u044b\u043a\u0430, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043e\u0442 \u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c 1197 \u0444\u0443\u043d\u0442\u043e\u0432.<br \/>  \u042d\u0442\u0443 \u0438\u0434\u0435\u044e \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u0438 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"butstrep\">\u0411\u0443\u0442\u0441\u0442\u0440\u044d\u043f<\/h3>\n<p>  <\/p>\n<p>Bagging (\u043e\u0442 Bootstrap aggregation) \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0438 \u0441\u0430\u043c\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u0438\u0434\u043e\u0432 \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0435\u0439. \u041e\u043d \u0431\u044b\u043b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0411\u0440\u0435\u0439\u043c\u0430\u043d,_\u041b\u0435\u043e\">\u041b\u0435\u0301\u043e \u0411\u0440\u0435\u0301\u0439\u043c\u0430\u043d\u043e\u043c<\/a> \u0432 1994 \u0433\u043e\u0434\u0443. \u0411\u044d\u0433\u0433\u0438\u043d\u0433 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u043f\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u041f\u0443\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/08b\/e08\/649\/08be08649014ecc6c8476b656e41b8b8.svg\" alt=\"$\\large X$\" data-tex=\"inline\"\/><\/math> \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0f\/798\/ca2\/b0f798ca2d95e85bd11d5fe8007101e2.svg\" alt=\"$\\large N$\" data-tex=\"inline\"\/><\/math>. \u0420\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0438\u0437 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0f\/798\/ca2\/b0f798ca2d95e85bd11d5fe8007101e2.svg\" alt=\"$\\large N$\" data-tex=\"inline\"\/><\/math> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0f\/798\/ca2\/b0f798ca2d95e85bd11d5fe8007101e2.svg\" alt=\"$\\large N$\" data-tex=\"inline\"\/><\/math> \u0440\u0430\u0437 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 (\u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u00ab\u0434\u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f\u00bb \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/63f\/076\/970\/63f07697063712d829d0edd4b1fcce3a.svg\" alt=\"$\\large \\frac{1}{N}$\" data-tex=\"inline\"\/><\/math>), \u043f\u0440\u0438\u0447\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0432\u0441\u0435\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0f\/798\/ca2\/b0f798ca2d95e85bd11d5fe8007101e2.svg\" alt=\"$\\large N$\" data-tex=\"inline\"\/><\/math> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u043c\u0435\u0448\u043e\u043a, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u044e\u0442 \u0448\u0430\u0440\u0438\u043a\u0438: \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0448\u0430\u0433\u0435 \u0448\u0430\u0440\u0438\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043c\u0435\u0448\u043e\u043a, \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u043e\u043f\u044f\u0442\u044c \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0438\u0437 \u0442\u043e\u0433\u043e \u0436\u0435 \u0447\u0438\u0441\u043b\u0430 \u0448\u0430\u0440\u0438\u043a\u043e\u0432. \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0438\u0437-\u0437\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044b. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/46a\/45c\/eef\/46a45ceef3574d54b3200819066a65ad.svg\" alt=\"$\\large X_1$\" data-tex=\"inline\"\/><\/math>. \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/254\/79f\/698\/25479f6983f7a19e57e1bfc9906e4dd6.svg\" alt=\"$\\large M$\" data-tex=\"inline\"\/><\/math> \u0440\u0430\u0437, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/254\/79f\/698\/25479f6983f7a19e57e1bfc9906e4dd6.svg\" alt=\"$\\large M$\" data-tex=\"inline\"\/><\/math> \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043e\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7a3\/f89\/1bf\/7a3f891bfb650055d6c650486808510f.svg\" alt=\"$\\large X_1, \\dots, X_M$\" data-tex=\"inline\"\/><\/math>. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0438 \u043c\u043e\u0436\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/bootstrap.jpg?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0432\u0430\u043c \u0443\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 <code>telecom_churn<\/code> \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0443\u0440\u0441\u0430. \u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0442\u0442\u043e\u043a\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u0446\u0435\u043d\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0438\u0437\u0443\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import pandas as pd from matplotlib import pyplot as plt plt.style.use('ggplot') plt.rcParams['figure.figsize'] = 10, 6 import seaborn as sns %matplotlib inline  telecom_data = pd.read_csv('data\/telecom_churn.csv')  fig = sns.kdeplot(telecom_data[telecom_data['Churn'] == False]['Customer service calls'], label = 'Loyal') fig = sns.kdeplot(telecom_data[telecom_data['Churn'] == True]['Customer service calls'], label = 'Churn')         fig.set(xlabel='\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0432\u043e\u043d\u043a\u043e\u0432', ylabel='\u041f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c')     plt.show()<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/bootstrap_new.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u0446\u0435\u043d\u0442\u0440 \u0443 \u043b\u043e\u044f\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0443 \u043d\u0430\u0448\u0438\u0445 \u0431\u044b\u0432\u0448\u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u044b\u043b\u043e \u0431\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u0433\u0440\u0443\u043f\u043f. \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0448\u0435\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u043c\u0430\u043b\u043e, \u0442\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c 1000 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e. <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import numpy as np def get_bootstrap_samples(data, n_samples):     # \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u0430     indices = np.random.randint(0, len(data), (n_samples, len(data)))     samples = data[indices]     return samples def stat_intervals(stat, alpha):     # \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438     boundaries = np.percentile(stat, [100 * alpha \/ 2., 100 * (1 - alpha \/ 2.)])     return boundaries  # \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 numpy \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043b\u043e\u044f\u043b\u044c\u043d\u044b\u043c \u0438 \u0443\u0436\u0435 \u0431\u044b\u0432\u0448\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c loyal_calls = telecom_data[telecom_data['Churn'] == False]['Customer service calls'].values churn_calls= telecom_data[telecom_data['Churn'] == True]['Customer service calls'].values  # \u0441\u0442\u0430\u0432\u0438\u043c seed \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 np.random.seed(0)  # \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u0440\u0430 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 loyal_mean_scores = [np.mean(sample)                         for sample in get_bootstrap_samples(loyal_calls, 1000)] churn_mean_scores = [np.mean(sample)                         for sample in get_bootstrap_samples(churn_calls, 1000)]  #  \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e print(&quot;Service calls from loyal:  mean interval&quot;,  stat_intervals(loyal_mean_scores, 0.05)) print(&quot;Service calls from churn:  mean interval&quot;,  stat_intervals(churn_mean_scores, 0.05))<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u0447\u0442\u043e \u0441 95% \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u043e\u0442 \u043b\u043e\u044f\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0435 \u043c\u0435\u0436\u0434\u0443 1.40 \u0438 1.50, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043d\u0430\u0448\u0438 \u0431\u044b\u0432\u0448\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0437\u0432\u043e\u043d\u0438\u043b\u0438 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043e\u0442 2.06 \u0434\u043e 2.40 \u0440\u0430\u0437. \u0422\u0430\u043a\u0436\u0435 \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0434\u043b\u044f \u043b\u043e\u044f\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0443\u0436\u0435, \u0447\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u0437\u0432\u043e\u043d\u044f\u0442 \u0440\u0435\u0434\u043a\u043e (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c 0, 1 \u0438\u043b\u0438 2 \u0440\u0430\u0437\u0430), \u0430 \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0437\u0432\u043e\u043d\u0438\u0442\u044c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0447\u0430\u0449\u0435, \u043d\u043e \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0438\u0445 \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f, \u0438 \u043e\u043d\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u044e\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>  <\/p>\n<h3 id=\"begging\">\u0411\u044d\u0433\u0433\u0438\u043d\u0433<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0438\u043c\u0435\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0431\u0443\u0441\u0442\u0440\u044d\u043f\u0435, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0443. \u041f\u0443\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/08b\/e08\/649\/08be08649014ecc6c8476b656e41b8b8.svg\" alt=\"$\\large X$\" data-tex=\"inline\"\/><\/math>. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0438\u0437 \u043d\u0435\u0451 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7a3\/f89\/1bf\/7a3f891bfb650055d6c650486808510f.svg\" alt=\"$\\large X_1, \\dots, X_M$\" data-tex=\"inline\"\/><\/math>. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043e\u0431\u0443\u0447\u0438\u043c \u0441\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5fa\/5ca\/11c\/5fa5ca11c8f72baa592b5c91ef78ef55.svg\" alt=\"$\\large a_i(x)$\" data-tex=\"inline\"\/><\/math>. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0440\u0435\u0434\u043d\u044f\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u044e): <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/60a\/8d8\/5f5\/60a8d85f56dedfeba4dac1c18ba189c2.svg\" alt=\"$\\large a(x) = \\frac{1}{M}\\sum_{i = 1}^M a_i(x)$\" data-tex=\"inline\"\/><\/math>. \u042d\u0442\u0443 \u0441\u0445\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u043e\u0439 \u043d\u0438\u0436\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/bagging.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/44e\/f04\/ab2\/44ef04ab202a8d66ee9d8d177e62d407.svg\" alt=\"$\\large b_1(x), \\dots , b_n(x)$\" data-tex=\"inline\"\/><\/math>. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u0441\u0442\u0438\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5b6\/1a2\/e0c\/5b61a2e0cc931e699438e860e6bd2a2d.svg\" alt=\"$\\large y(x)$\" data-tex=\"inline\"\/><\/math>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0434\u0430\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3ad\/f97\/809\/3adf978098ab66daab5b47d2400c6718.svg\" alt=\"$\\large p(x)$\" data-tex=\"inline\"\/><\/math>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b41\/57d\/94f\/b4157d94fd161fb31367651e0031d44e.svg\" alt=\"$ \\large \\varepsilon_i(x) = b_i(x) \u2212 y(x), i = 1, \\dots, n$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0430\u0442\u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/59d\/fa9\/da0\/59dfa9da0a7c840183df436bae964ab4.svg\" alt=\"$ \\large E_x(b_i(x) \u2212 y(x))^{2} = E_x \\varepsilon (x). $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a0e\/cbf\/c80\/a0ecbfc8004044579e30512a999e69bb.svg\" alt=\"$ \\large E_1 = \\frac{1}{n}E_x\\varepsilon_i^{2}(x) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0441\u043c\u0435\u0449\u0435\u043d\u044b \u0438 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b: <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/710\/cd8\/3c9\/710cd83c9dd9b371740368e61cf4ef4f.svg\" alt=\"$ \\large \\begin{array}{rcl} E_x\\varepsilon_i(x) &amp;=&amp; 0, \\\\ E_x\\varepsilon_i(x)\\varepsilon_j(x) &amp;=&amp; 0, i \\neq j. \\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0440\u0435\u0434\u043d\u044f\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/dd1\/418\/199\/dd1418199f9802993b6494155181cdd0.svg\" alt=\"$ \\large a(x) = \\frac{1}{n}\\sum_{i=1}^{n}b_i(x) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0439\u0434\u0435\u043c \u0435\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/46d\/3a2\/8b0\/46d3a28b06f7842e8e1771f4c307ab3d.svg\" alt=\"$ \\large \\begin{array}{rcl}E_n &amp;=&amp; E_x\\Big(\\frac{1}{n}\\sum_{i=1}^{n}b_i(x)-y(x)\\Big)^2 \\\\ &amp;=&amp; E_x\\Big(\\frac{1}{n}\\sum_{i=1}^{n}\\varepsilon_i\\Big)^2 \\\\ &amp;=&amp; \\frac{1}{n^2}E_x\\Big(\\sum_{i=1}^{n}\\varepsilon_i^2(x) + \\sum_{i \\neq j}\\varepsilon_i(x)\\varepsilon_j(x)\\Big) \\\\ &amp;=&amp; \\frac{1}{n}E_1\\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 n \u0440\u0430\u0437!<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u0432\u0430\u043c \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e <a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/323890\/#razlozhenie-oshibki-na-smeschenie-i-razbros-bias-variance-decomposition\">\u0443\u0440\u043e\u043a\u0430<\/a>, \u043a\u0430\u043a \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2aa\/20b\/48b\/2aa20b48b248752cce2e3cfb046d9679.svg\" alt=\"$\\large \\begin{array}{rcl} \\text{Err}\\left(\\vec{x}\\right) &amp;=&amp; \\mathbb{E}\\left[\\left(y - \\hat{f}\\left(\\vec{x}\\right)\\right)^2\\right] \\\\ &amp;=&amp; \\sigma^2 + f^2 + \\text{Var}\\left(\\hat{f}\\right) + \\mathbb{E}\\left[\\hat{f}\\right]^2 - 2f\\mathbb{E}\\left[\\hat{f}\\right] \\\\ &amp;=&amp; \\left(f - \\mathbb{E}\\left[\\hat{f}\\right]\\right)^2 + \\text{Var}\\left(\\hat{f}\\right) + \\sigma^2 \\\\ &amp;=&amp; \\text{Bias}\\left(\\hat{f}\\right)^2 + \\text{Var}\\left(\\hat{f}\\right) + \\sigma^2 \\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0411\u044d\u0433\u0433\u0438\u043d\u0433 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e (variance) \u043e\u0431\u0443\u0447\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430, \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435. \u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438, \u0438 \u0438\u0445 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b-\u0432\u044b\u0431\u0440\u043e\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <code>scikit-learn<\/code> \u0435\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>BaggingRegressor<\/code> \u0438 <code>BaggingClassifier<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 &quot;\u0432\u043d\u0443\u0442\u0440\u0438&quot;. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044d\u0433\u0433\u0438\u043d\u0433 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0435\u0433\u043e \u0441 \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0437 <a href=\"http:\/\/scikit-learn.org\/stable\/auto_examples\/ensemble\/plot_bias_variance.html#sphx-glr-auto-examples-ensemble-plot-bias-variance-py\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/tree_vs_bagging.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/81f\/d1c\/0d5\/81fd1c0d5118d0610889fdd68ed7272a.svg\" alt=\"$ \\large 0.0255 (Err) = 0.0003 (Bias^2) + 0.0152 (Var) + 0.0098 (\\sigma^2) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/614\/5d0\/b4d\/6145d0b4d003c99578a34685aab5cb0b.svg\" alt=\"$ \\large 0.0196 (Err) = 0.0004 (Bias^2) + 0.0092 (Var) + 0.0098 (\\sigma^2) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432\u044b\u0448\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u0440\u0438 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0435, \u043a\u0430\u043a \u043c\u044b \u0438 \u0434\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0448\u0435. <\/p>\n<p>  <\/p>\n<p>\u0411\u044d\u0433\u0433\u0438\u043d\u0433 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u0435\u043d \u043d\u0430 \u043c\u0430\u043b\u044b\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u0436\u0435 \u043c\u0430\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0434\u043b\u0438\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0447\u0442\u043e \u0440\u0435\u0434\u043a\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u043e, \u0442\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a\u0438\u043c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043b\u0435\u043a\u0446\u0438\u044f\u0445 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0432 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445.<\/p>\n<p>  <\/p>\n<h3 id=\"out-of-bag-error\">Out-of-bag error<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434, \u043e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043b\u0435\u0441\u043e\u0432 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0441\u043c\u0435\u0449\u0435\u043d\u043d\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u0441\u0442\u043e\u0432. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u0446\u043e\u0432 \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u0430 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 37% \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432\u043d\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u0430 \u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 k-\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c: \u043f\u0443\u0441\u0442\u044c \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ada\/7d4\/a42\/ada7d4a42aa8193395c74377a2a63d27.svg\" alt=\"$\\large \\ell$\" data-tex=\"inline\"\/><\/math> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0432\u043d\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0442.\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u2014 \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9d3\/87c\/d4a\/9d387cd4a7b39a5e8d3ab3fa9b80a0d1.svg\" alt=\"$\\large\\frac{1}{\\ell}.$\" data-tex=\"inline\"\/><\/math> \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u041d\u0415 \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u0432 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0443 (\u0442.\u0435. \u0435\u0433\u043e \u043d\u0435 \u0432\u0437\u044f\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ada\/7d4\/a42\/ada7d4a42aa8193395c74377a2a63d27.svg\" alt=\"$\\large \\ell$\" data-tex=\"inline\"\/><\/math> \u0440\u0430\u0437): <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/dac\/886\/372\/dac88637290e2f2ab78f6e080eff4c85.svg\" alt=\"$\\large (1 - \\frac{1}{\\ell})^\\ell$\" data-tex=\"inline\"\/><\/math>. \u041f\u0440\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/664\/3fb\/e2a\/6643fbe2ae1f09bff9cec12121d0819e.svg\" alt=\"$\\large \\ell \\rightarrow +\\infty$\" data-tex=\"inline\"\/><\/math> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0434\u0438\u043d \u0438\u0437 &quot;\u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445&quot; \u043f\u0440\u0435\u0434\u0435\u043b\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f05\/9c2\/4a5\/f059c24a56d0da769daca586e4d6c3aa.svg\" alt=\"$\\large \\frac{1}{e}$\" data-tex=\"inline\"\/><\/math>. \u0422\u043e\u0433\u0434\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/350\/24b\/73f\/35024b73f8e6a3abdbacfa619010d41e.svg\" alt=\"$\\large \\approx 1 - \\frac{1}{e} \\approx 63\\%$\" data-tex=\"inline\"\/><\/math>.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/oob.png?raw=true\" alt=\"image\"\/><br \/>  \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0448\u0438\u0431\u0441\u044f \u0432 4 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u0417\u043d\u0430\u0447\u0438\u0442 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/310\/4e8\/a4e\/3104e8a4e6f7cd3b1e790d01b689e6b4.svg\" alt=\"$\\large \\frac{11}{15}*100\\% = 73.33\\%$\" data-tex=\"inline\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 ~63% \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0417\u043d\u0430\u0447\u0438\u0442, \u043d\u0430 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f ~37% \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c. Out-of-Bag \u043e\u0446\u0435\u043d\u043a\u0430 \u2014 \u044d\u0442\u043e \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043d\u0430 \u0442\u0435\u0445 ~37% \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0438 \u043d\u0435 \u043e\u0431\u0443\u0447\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"2-sluchaynyy-les\">2. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441<\/h2>\n<p>  <\/p>\n<p>\u041b\u0435\u043e \u0411\u0440\u0435\u0439\u043c\u0430\u043d \u043d\u0430\u0448\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f\u0443 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435, \u043d\u043e \u0438 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u041e\u043d \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0410\u0434\u0435\u043b\u044c \u041a\u0430\u0442\u043b\u0435\u0440 \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u043e\u0432\u0430\u043b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <a href=\"http:\/\/ect.bell-labs.com\/who\/tkh\/publications\/papers\/odt.pdf\">\u0425\u043e<\/a>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043a \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 CART, \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e\u0434\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430. <\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0430\u044e\u0449\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b \u0438 \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435. \u041c\u0435\u0442\u043e\u0434 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e\u0434\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c\u0438 \u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u0431\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<br \/>  \u0410\u043d\u0441\u0430\u043c\u0431\u043b\u044c \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0443\u0441\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0440\u0430\u0432\u043d\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0f\/798\/ca2\/b0f798ca2d95e85bd11d5fe8007101e2.svg\" alt=\"$\\large N$\" data-tex=\"inline\"\/><\/math>, \u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ef0\/2c5\/f41\/ef02c5f414bfb6416190c95262533010.svg\" alt=\"$\\large D$\" data-tex=\"inline\"\/><\/math>.<\/li>\n<li>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/36b\/771\/c44\/36b771c44785c6ea12155a149ad6064b.svg\" alt=\"$\\large L$\" data-tex=\"inline\"\/><\/math> \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e \u043e\u0442\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0435.<\/li>\n<li>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/431\/900\/7d4\/4319007d4413493760a2b71a6bca5c67.svg\" alt=\"$\\large l$\" data-tex=\"inline\"\/><\/math> \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9cc\/e4a\/c20\/9cce4ac208b6cc80280a892c35b505de.svg\" alt=\"$\\large dl (dl &lt; D) $\" data-tex=\"inline\"\/><\/math> \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0434\u043b\u044f l. \u041e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0b6\/72b\/1e4\/0b672b1e494d0b4d7a02881bf2e295aa.svg\" alt=\"$\\large dl$\" data-tex=\"inline\"\/><\/math>.<\/li>\n<li>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/431\/900\/7d4\/4319007d4413493760a2b71a6bca5c67.svg\" alt=\"$\\large l$\" data-tex=\"inline\"\/><\/math> \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443, \u0432\u044b\u0431\u0440\u0430\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0b6\/72b\/1e4\/0b672b1e494d0b4d7a02881bf2e295aa.svg\" alt=\"$\\large dl$\" data-tex=\"inline\"\/><\/math>-\u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438\u0437 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ef0\/2c5\/f41\/ef02c5f414bfb6416190c95262533010.svg\" alt=\"$\\large D$\" data-tex=\"inline\"\/><\/math> \u0441 \u0437\u0430\u043c\u0435\u043d\u043e\u0439 \u0438 \u043e\u0431\u0443\u0447\u0438\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u044c.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u044f \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/36b\/771\/c44\/36b771c44785c6ea12155a149ad6064b.svg\" alt=\"$\\large L$\" data-tex=\"inline\"\/><\/math> \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u0430\u0436\u043e\u0440\u0438\u0442\u0430\u0440\u043d\u044b\u043c \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043b\u0438 \u043f\u0443\u0442\u0435\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u044b\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>  <\/p>\n<h3 id=\"algoritm\">\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h3>\n<p>  <\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0438\u0437 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0f\/798\/ca2\/b0f798ca2d95e85bd11d5fe8007101e2.svg\" alt=\"$\\large N$\" data-tex=\"inline\"\/><\/math> \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e0d\/69e\/6e7\/e0d69e6e723ff75ac479c064b85217ad.svg\" alt=\"$\\large n = 1, \\dots, N$\" data-tex=\"inline\"\/><\/math>:<br \/> \n<ul>\n<li>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5d4\/b53\/fe9\/5d4b53fe92f18bf728fc02c9cbd6d841.svg\" alt=\"$\\large X_n$\" data-tex=\"inline\"\/><\/math> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e bootstrap.<\/li>\n<li>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0435 \u0434\u0435\u0440\u0435\u0432\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7d8\/055\/9e1\/7d80559e136e50cb951485142ea7a672.svg\" alt=\"$\\large b_n$\" data-tex=\"inline\"\/><\/math> \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5d4\/b53\/fe9\/5d4b53fe92f18bf728fc02c9cbd6d841.svg\" alt=\"$\\large X_n$\" data-tex=\"inline\"\/><\/math>:<br \/>  \u2014 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a, \u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u043f\u043e \u043d\u0435\u043c\u0443 \u0438 \u0442\u0430\u043a \u0434\u043e \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438<br \/>  \u2014 \u0434\u0435\u0440\u0435\u0432\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043b\u0438\u0441\u0442\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/83f\/9da\/94b\/83f9da94bf9d4d75fd71030b26985315.svg\" alt=\"$\\large n_\\text{min}$\" data-tex=\"inline\"\/><\/math> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u043b\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0441\u043e\u0442\u044b \u0434\u0435\u0440\u0435\u0432\u0430<br \/>  \u2014 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5f2\/2f7\/ae5\/5f22f7ae57470b1f250429e8c2ace03b.svg\" alt=\"$\\large m$\" data-tex=\"inline\"\/><\/math> \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438\u0437 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e35\/ccf\/c38\/e35ccfc3895b4c0271918c2112e9cb5a.svg\" alt=\"$\\large n$\" data-tex=\"inline\"\/><\/math> \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445,<br \/>  \u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0449\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u0435\u0434\u0438 \u043d\u0438\u0445.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/60e\/4cf\/9c9\/60e4cf9c98f7726d9246ef8306a54e54.svg\" alt=\"$\\large a(x) = \\frac{1}{N}\\sum_{i = 1}^N b_i(x)$\" data-tex=\"inline\"\/><\/math>, \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u2014 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443, \u0430 \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u2014 \u0441\u0440\u0435\u0434\u043d\u0438\u043c.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0440\u0430\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b8b\/7e4\/6dd\/b8b7e46dd9ca07816e411dd172fc0574.svg\" alt=\"$\\large m = \\sqrt{n}$\" data-tex=\"inline\"\/><\/math>, \u0430 \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a32\/bbf\/7d2\/a32bbf7d2d2880e2aaf9b112d2de0ef8.svg\" alt=\"$\\large m = \\frac{n}{3}$\" data-tex=\"inline\"\/><\/math>, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e35\/ccf\/c38\/e35ccfc3895b4c0271918c2112e9cb5a.svg\" alt=\"$\\large n$\" data-tex=\"inline\"\/><\/math> \u2014 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043b\u0438\u0441\u0442\u0435 \u043d\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0430 \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u2014 \u043f\u043e\u043a\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043b\u0438\u0441\u0442\u0435 \u043d\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u044f\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441 \u2014 \u044d\u0442\u043e \u0431\u044d\u0433\u0433\u0438\u043d\u0433 \u043d\u0430\u0434 \u0440\u0435\u0448\u0430\u044e\u0449\u0438\u043c\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c\u0438, \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<h3 id=\"sravnenie-s-derevom-resheniy-i-beggingom\">\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u043e\u043c<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430, \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from __future__ import division, print_function # \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c \u0432\u0441\u044f\u043a\u0438\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f Anaconda import warnings warnings.filterwarnings('ignore') %pylab inline np.random.seed(42) figsize(8, 6) import seaborn as sns from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier, BaggingRegressor from sklearn.tree import DecisionTreeRegressor, DecisionTreeClassifier  n_train = 150         n_test = 1000        noise = 0.1  # Generate data def f(x):     x = x.ravel()     return np.exp(-x ** 2) + 1.5 * np.exp(-(x - 2) ** 2)  def generate(n_samples, noise):     X = np.random.rand(n_samples) * 10 - 5     X = np.sort(X).ravel()     y = np.exp(-X ** 2) + 1.5 * np.exp(-(X - 2) ** 2)\\         + np.random.normal(0.0, noise, n_samples)     X = X.reshape((n_samples, 1))      return X, y  X_train, y_train = generate(n_samples=n_train, noise=noise) X_test, y_test = generate(n_samples=n_test, noise=noise)  # One decision tree regressor dtree = DecisionTreeRegressor().fit(X_train, y_train) d_predict = dtree.predict(X_test)  plt.figure(figsize=(10, 6)) plt.plot(X_test, f(X_test), &quot;b&quot;) plt.scatter(X_train, y_train, c=&quot;b&quot;, s=20) plt.plot(X_test, d_predict, &quot;g&quot;, lw=2) plt.xlim([-5, 5]) plt.title(&quot;\u0420\u0435\u0448\u0430\u044e\u0449\u0435\u0435 \u0434\u0435\u0440\u0435\u0432\u043e, MSE = %.2f&quot;            % np.sum((y_test - d_predict) ** 2))  # Bagging decision tree regressor bdt = BaggingRegressor(DecisionTreeRegressor()).fit(X_train, y_train) bdt_predict = bdt.predict(X_test)  plt.figure(figsize=(10, 6)) plt.plot(X_test, f(X_test), &quot;b&quot;) plt.scatter(X_train, y_train, c=&quot;b&quot;, s=20) plt.plot(X_test, bdt_predict, &quot;y&quot;, lw=2) plt.xlim([-5, 5]) plt.title(&quot;\u0411\u044d\u0433\u0433\u0438\u043d\u0433 \u0440\u0435\u0448\u0430\u044e\u0449\u0438\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432, MSE = %.2f&quot; % np.sum((y_test - bdt_predict) ** 2));  # Random Forest rf = RandomForestRegressor(n_estimators=10).fit(X_train, y_train) rf_predict = rf.predict(X_test)  plt.figure(figsize=(10, 6)) plt.plot(X_test, f(X_test), &quot;b&quot;) plt.scatter(X_train, y_train, c=&quot;b&quot;, s=20) plt.plot(X_test, rf_predict, &quot;r&quot;, lw=2) plt.xlim([-5, 5]) plt.title(&quot;\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441, MSE = %.2f&quot; % np.sum((y_test - rf_predict) ** 2));<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/tree_mse.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/bagging_mse.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/rf_mse.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 MSE, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441 \u0438\u0437 10 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0434\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0447\u0435\u043c \u043e\u0434\u043d\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u0438\u043b\u0438 \u0431\u044d\u0433\u0433\u0438\u043d\u0433 \u0438\u0437 10 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0438 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430 \u043d\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043b\u0435\u0441\u0435 \u0438\u0437 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0438 \u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0437\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430, \u0433\u0434\u0435 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 \u0443\u0437\u043b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0438 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430 \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430, \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from sklearn.ensemble import RandomForestClassifier, BaggingClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.datasets import make_circles from sklearn.cross_validation import train_test_split import numpy as np from matplotlib import pyplot as plt plt.style.use('ggplot') plt.rcParams['figure.figsize'] = 10, 6 %matplotlib inline  np.random.seed(42) X, y = make_circles(n_samples=500, factor=0.1, noise=0.35, random_state=42) X_train_circles, X_test_circles, y_train_circles, y_test_circles = train_test_split(X, y, test_size=0.2)  dtree = DecisionTreeClassifier(random_state=42) dtree.fit(X_train_circles, y_train_circles)  x_range = np.linspace(X.min(), X.max(), 100) xx1, xx2 = np.meshgrid(x_range, x_range) y_hat = dtree.predict(np.c_[xx1.ravel(), xx2.ravel()]) y_hat = y_hat.reshape(xx1.shape) plt.contourf(xx1, xx2, y_hat, alpha=0.2) plt.scatter(X[:,0], X[:,1], c=y, cmap='autumn') plt.title(&quot;\u0414\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439&quot;) plt.show()  b_dtree = BaggingClassifier(DecisionTreeClassifier(),n_estimators=300, random_state=42) b_dtree.fit(X_train_circles, y_train_circles)  x_range = np.linspace(X.min(), X.max(), 100) xx1, xx2 = np.meshgrid(x_range, x_range) y_hat = b_dtree.predict(np.c_[xx1.ravel(), xx2.ravel()]) y_hat = y_hat.reshape(xx1.shape) plt.contourf(xx1, xx2, y_hat, alpha=0.2) plt.scatter(X[:,0], X[:,1], c=y, cmap='autumn') plt.title(&quot;\u0411\u044d\u0433\u0433\u0438\u043d\u0433(\u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439)&quot;) plt.show()  rf = RandomForestClassifier(n_estimators=300, random_state=42) rf.fit(X_train_circles, y_train_circles)  x_range = np.linspace(X.min(), X.max(), 100) xx1, xx2 = np.meshgrid(x_range, x_range) y_hat = rf.predict(np.c_[xx1.ravel(), xx2.ravel()]) y_hat = y_hat.reshape(xx1.shape) plt.contourf(xx1, xx2, y_hat, alpha=0.2) plt.scatter(X[:,0], X[:,1], c=y, cmap='autumn') plt.title(&quot;\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441&quot;) plt.show()<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/tree_class.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/bagg_class.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/rf_class.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0430\u0445 \u0432\u044b\u0448\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043e\u0447\u0435\u043d\u044c \u00ab\u0440\u0432\u0430\u043d\u0430\u044f\u00bb \u0438 \u043d\u0430 \u043d\u0435\u0439 \u043c\u043d\u043e\u0433\u043e \u043e\u0441\u0442\u0440\u044b\u0445 \u0443\u0433\u043b\u043e\u0432, \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0438 \u0441\u043b\u0430\u0431\u043e\u0439 \u043e\u0431\u043e\u0431\u0449\u0430\u044e\u0449\u0435\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0443 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u0430\u044f \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b c\u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0434\u043e\u043b\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h3 id=\"parametry\">\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/h3>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f <a href=\"http:\/\/scikit-learn.org\/stable\/\">scikit-learn<\/a> \u0434\u0432\u0443\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 RandomForestClassifier \u0438 RandomForestRegressor.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class sklearn.ensemble.RandomForestRegressor(     n_estimators \u2014 \u0447\u0438\u0441\u043b\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0432 &quot;\u043b\u0435\u0441\u0443&quot; (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u2013 10)     criterion \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0432\u0435\u0442\u043a\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u2014 &quot;mse&quot; , \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c &quot;mae&quot;)     max_features \u2014 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u0449\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043b\u0438\u0431\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439: &quot;auto&quot; (\u0432\u0441\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438), &quot;sqrt&quot;, &quot;log2&quot;. \u041f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0441\u0442\u043e\u0438\u0442 &quot;auto&quot;.     max_depth \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0434\u0435\u0440\u0435\u0432\u0430  (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0430)     min_samples_split \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0443\u0437\u043b\u0430. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u043c \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u2014 2)     min_samples_leaf \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043b\u0438\u0441\u0442\u0435. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u043c \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u2014 1)     min_weight_fraction_leaf \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u0430\u044f \u0434\u043e\u043b\u044f \u043e\u0442 \u043e\u0431\u0449\u0435\u0439 \u0441\u0443\u043c\u043c\u044b \u0432\u0435\u0441\u043e\u0432 (\u0432\u0441\u0435\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432) \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432 \u043b\u0438\u0441\u0442\u0435 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0432\u0435\u0441)     max_leaf_nodes \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u0438\u0441\u0442\u044c\u0435\u0432 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u043d\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f)     min_impurity_split \u2014 \u043f\u043e\u0440\u043e\u0433 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430\u0440\u0430\u0449\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 1\u0435-7)     bootstrap \u2014 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043b\u0438 \u0431\u0443\u0441\u0442\u0440\u044d\u043f \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 True)     oob_score \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438 out-of-bag \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 R^2 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 False)     n_jobs \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 1, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c -1, \u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u044f\u0434\u0440\u0430)     random_state \u2014 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0435\u0433\u043e \u043d\u0435\u0442, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0442\u0438\u043f\u0430 int     verbose \u2014 \u0432\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u043e\u0432 \u043f\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 0)     warm_start \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u0436\u0435 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0432 \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u044c (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 False) )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432\u0441\u0435 \u043f\u043e\u0447\u0442\u0438 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043c\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 RandomForestClassifier \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 RandomForestRegressor <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class sklearn.ensemble.RandomForestClassifier(     criterion \u2014 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043d\u0430\u0441 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u043e \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0432\u044b\u0431\u0440\u0430\u043d \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 &quot;gini&quot; (\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c &quot;entropy&quot;)     class_weight \u2014 \u0432\u0435\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0432\u0441\u0435 \u0432\u0435\u0441\u0430 \u0440\u0430\u0432\u043d\u044b 1, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0432\u0435\u0441\u0430\u043c\u0438, \u043b\u0438\u0431\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c &quot;balanced&quot;, \u0442\u043e\u0433\u0434\u0430 \u0432\u0435\u0441\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0432\u043d\u044b \u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0447\u0430\u0441\u0442\u044f\u043c \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438; \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c &quot;balanced_subsample&quot;, \u0442\u043e\u0433\u0434\u0430 \u0432\u0435\u0441\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0431\u0443\u0434\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0435. )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>n_estimators \u2014 \u0447\u0438\u0441\u043b\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0432 &quot;\u043b\u0435\u0441\u0443&quot;<\/li>\n<li>criterion \u2014 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 \u0432\u0435\u0440\u0448\u0438\u043d\u0435<\/li>\n<li>max_features \u2014 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u0449\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435<\/li>\n<li>min_samples_leaf \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043b\u0438\u0441\u0442\u0435<\/li>\n<li>max_depth \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0434\u0435\u0440\u0435\u0432\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 fraud detection. \u042d\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 accuracy \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u0431\u0435\u0439\u0441\u043b\u0430\u0439\u043d\u043e\u043c. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0431\u0435\u0439\u0441\u043b\u0430\u0439\u043d\u0430 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import pandas as pd from sklearn.model_selection import cross_val_score, StratifiedKFold, GridSearchCV from sklearn.metrics import accuracy_score  # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 df = pd.read_csv(&quot;..\/..\/data\/telecom_churn.csv&quot;)  # \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0441 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 cols = [] for i in df.columns:     if (df[i].dtype == &quot;float64&quot;) or (df[i].dtype == 'int64'):         cols.append(i)  # \u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b X, y = df[cols].copy(), np.asarray(df[&quot;Churn&quot;],dtype='int8')  # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0430\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)  # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 rfc = RandomForestClassifier(random_state=42, n_jobs=-1, oob_score=True)  # \u041e\u0431\u0443\u0447\u0430\u0435\u043c \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 results = cross_val_score(rfc, X, y, cv=skf)  # \u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 print(&quot;CV accuracy score: {:.2f}%&quot;.format(results.mean()*100))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c 91.21%, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043a\u0440\u0438\u0432\u044b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0434\u0431\u043e\u0440\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 train_acc = [] test_acc = [] temp_train_acc = [] temp_test_acc = [] trees_grid = [5, 10, 15, 20, 30, 50, 75, 100]  # \u041e\u0431\u0443\u0447\u0430\u0435\u043c \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 for ntrees in trees_grid:     rfc = RandomForestClassifier(n_estimators=ntrees, random_state=42, n_jobs=-1, oob_score=True)     temp_train_acc = []     temp_test_acc = []     for train_index, test_index in skf.split(X, y):         X_train, X_test = X.iloc[train_index], X.iloc[test_index]         y_train, y_test = y[train_index], y[test_index]         rfc.fit(X_train, y_train)         temp_train_acc.append(rfc.score(X_train, y_train))         temp_test_acc.append(rfc.score(X_test, y_test))     train_acc.append(temp_train_acc)     test_acc.append(temp_test_acc)  train_acc, test_acc = np.asarray(train_acc), np.asarray(test_acc) print(&quot;Best accuracy on CV is {:.2f}% with {} trees&quot;.format(max(test_acc.mean(axis=1))*100,                                                          trees_grid[np.argmax(test_acc.mean(axis=1))]))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import matplotlib.pyplot as plt plt.style.use('ggplot') %matplotlib inline  fig, ax = plt.subplots(figsize=(8, 4)) ax.plot(trees_grid, train_acc.mean(axis=1), alpha=0.5, color='blue', label='train') ax.plot(trees_grid, test_acc.mean(axis=1), alpha=0.5, color='red', label='cv') ax.fill_between(trees_grid, test_acc.mean(axis=1) - test_acc.std(axis=1), test_acc.mean(axis=1) + test_acc.std(axis=1), color='#888888', alpha=0.4) ax.fill_between(trees_grid, test_acc.mean(axis=1) - 2*test_acc.std(axis=1), test_acc.mean(axis=1) + 2*test_acc.std(axis=1), color='#888888', alpha=0.2) ax.legend(loc='best') ax.set_ylim([0.88,1.02]) ax.set_ylabel(&quot;Accuracy&quot;) ax.set_xlabel(&quot;N_estimators&quot;)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/rf_n_est.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432, \u043d\u0430\u0448\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0442\u0435\u0441\u0442\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0443, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0430\u043c\u0438 \u0440\u0435\u0448\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<br \/>  \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0434\u043e\u0441\u0442\u0438\u0447\u044c 100% \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u044d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u043e \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u2013 <code>max_depth<\/code>. (\u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043a-\u0432\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 100)<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0434\u0431\u043e\u0440\u0443 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u0434\u0435\u0440\u0435\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 train_acc = [] test_acc = [] temp_train_acc = [] temp_test_acc = [] max_depth_grid = [3, 5, 7, 9, 11, 13, 15, 17, 20, 22, 24]  # \u041e\u0431\u0443\u0447\u0430\u0435\u043c \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 for max_depth in max_depth_grid:     rfc = RandomForestClassifier(n_estimators=100, random_state=42, n_jobs=-1, oob_score=True, max_depth=max_depth)     temp_train_acc = []     temp_test_acc = []     for train_index, test_index in skf.split(X, y):         X_train, X_test = X.iloc[train_index], X.iloc[test_index]         y_train, y_test = y[train_index], y[test_index]         rfc.fit(X_train, y_train)         temp_train_acc.append(rfc.score(X_train, y_train))         temp_test_acc.append(rfc.score(X_test, y_test))     train_acc.append(temp_train_acc)     test_acc.append(temp_test_acc)  train_acc, test_acc = np.asarray(train_acc), np.asarray(test_acc) print(&quot;Best accuracy on CV is {:.2f}% with {} max_depth&quot;.format(max(test_acc.mean(axis=1))*100,                                                          max_depth_grid[np.argmax(test_acc.mean(axis=1))]))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">fig, ax = plt.subplots(figsize=(8, 4)) ax.plot(max_depth_grid, train_acc.mean(axis=1), alpha=0.5, color='blue', label='train') ax.plot(max_depth_grid, test_acc.mean(axis=1), alpha=0.5, color='red', label='cv') ax.fill_between(max_depth_grid, test_acc.mean(axis=1) - test_acc.std(axis=1), test_acc.mean(axis=1) + test_acc.std(axis=1), color='#888888', alpha=0.4) ax.fill_between(max_depth_grid, test_acc.mean(axis=1) - 2*test_acc.std(axis=1), test_acc.mean(axis=1) + 2*test_acc.std(axis=1), color='#888888', alpha=0.2) ax.legend(loc='best') ax.set_ylim([0.88,1.02]) ax.set_ylabel(&quot;Accuracy&quot;) ax.set_xlabel(&quot;Max_depth&quot;)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/rf_max_depth.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>max_depth<\/code> \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0438 \u043c\u044b \u0443\u0436\u0435 \u043d\u0435 \u0442\u0430\u043a \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0430\u0435\u043c\u0441\u044f. \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0435 \u0432\u0430\u0436\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>min_samples_leaf<\/code>, \u043e\u043d \u0442\u0430\u043a \u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0434\u0431\u043e\u0440\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043b\u0438\u0441\u0442\u0435 \u0434\u0435\u0440\u0435\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 train_acc = [] test_acc = [] temp_train_acc = [] temp_test_acc = [] min_samples_leaf_grid = [1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 22, 24]  # \u041e\u0431\u0443\u0447\u0430\u0435\u043c \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 for min_samples_leaf in min_samples_leaf_grid:     rfc = RandomForestClassifier(n_estimators=100, random_state=42, n_jobs=-1,                                   oob_score=True, min_samples_leaf=min_samples_leaf)     temp_train_acc = []     temp_test_acc = []     for train_index, test_index in skf.split(X, y):         X_train, X_test = X.iloc[train_index], X.iloc[test_index]         y_train, y_test = y[train_index], y[test_index]         rfc.fit(X_train, y_train)         temp_train_acc.append(rfc.score(X_train, y_train))         temp_test_acc.append(rfc.score(X_test, y_test))     train_acc.append(temp_train_acc)     test_acc.append(temp_test_acc)  train_acc, test_acc = np.asarray(train_acc), np.asarray(test_acc) print(&quot;Best accuracy on CV is {:.2f}% with {} min_samples_leaf&quot;.format(max(test_acc.mean(axis=1))*100,                                                          min_samples_leaf_grid[np.argmax(test_acc.mean(axis=1))]))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">fig, ax = plt.subplots(figsize=(8, 4)) ax.plot(min_samples_leaf_grid, train_acc.mean(axis=1), alpha=0.5, color='blue', label='train') ax.plot(min_samples_leaf_grid, test_acc.mean(axis=1), alpha=0.5, color='red', label='cv') ax.fill_between(min_samples_leaf_grid, test_acc.mean(axis=1) - test_acc.std(axis=1), test_acc.mean(axis=1) + test_acc.std(axis=1), color='#888888', alpha=0.4) ax.fill_between(min_samples_leaf_grid, test_acc.mean(axis=1) - 2*test_acc.std(axis=1), test_acc.mean(axis=1) + 2*test_acc.std(axis=1), color='#888888', alpha=0.2) ax.legend(loc='best') ax.set_ylim([0.88,1.02]) ax.set_ylabel(&quot;Accuracy&quot;) ax.set_xlabel(&quot;Min_samples_leaf&quot;)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/rf_leaf.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043d\u0435 \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u043d\u043e \u0437\u0430\u0442\u043e \u043c\u043e\u0436\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u043e 2% \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043e\u043a\u043e\u043b\u043e 92%.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u0430\u043a <code>max_features<\/code>. \u0414\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d91\/413\/40e\/d9141340eeca375b6df548723bee00ba.svg\" alt=\"$\\large \\sqrt{n}$\" data-tex=\"inline\"\/><\/math>, \u0433\u0434\u0435 n \u2014 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043b\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 4 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0434\u0431\u043e\u0440\u0443 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 train_acc = [] test_acc = [] temp_train_acc = [] temp_test_acc = [] max_features_grid = [2, 4, 6, 8, 10, 12, 14, 16]  # \u041e\u0431\u0443\u0447\u0430\u0435\u043c \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 for max_features in max_features_grid:     rfc = RandomForestClassifier(n_estimators=100, random_state=42, n_jobs=-1,                                   oob_score=True, max_features=max_features)     temp_train_acc = []     temp_test_acc = []     for train_index, test_index in skf.split(X, y):         X_train, X_test = X.iloc[train_index], X.iloc[test_index]         y_train, y_test = y[train_index], y[test_index]         rfc.fit(X_train, y_train)         temp_train_acc.append(rfc.score(X_train, y_train))         temp_test_acc.append(rfc.score(X_test, y_test))     train_acc.append(temp_train_acc)     test_acc.append(temp_test_acc)  train_acc, test_acc = np.asarray(train_acc), np.asarray(test_acc) print(&quot;Best accuracy on CV is {:.2f}% with {} max_features&quot;.format(max(test_acc.mean(axis=1))*100,                                                          max_features_grid[np.argmax(test_acc.mean(axis=1))]))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043a\u0440\u0438\u0432\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">fig, ax = plt.subplots(figsize=(8, 4)) ax.plot(max_features_grid, train_acc.mean(axis=1), alpha=0.5, color='blue', label='train') ax.plot(max_features_grid, test_acc.mean(axis=1), alpha=0.5, color='red', label='cv') ax.fill_between(max_features_grid, test_acc.mean(axis=1) - test_acc.std(axis=1), test_acc.mean(axis=1) + test_acc.std(axis=1), color='#888888', alpha=0.4) ax.fill_between(max_features_grid, test_acc.mean(axis=1) - 2*test_acc.std(axis=1), test_acc.mean(axis=1) + 2*test_acc.std(axis=1), color='#888888', alpha=0.2) ax.legend(loc='best') ax.set_ylim([0.88,1.02]) ax.set_ylabel(&quot;Accuracy&quot;) ax.set_xlabel(&quot;Max_features&quot;)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/rf_max_features.png?raw=true\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u2014 10, \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0442\u0430\u043a\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u043a\u0430\u043a \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043a\u0440\u0438\u0432\u044b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>GridSearch<\/code> \u043d\u0430\u0439\u0434\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 parameters = {'max_features': [4, 7, 10, 13], 'min_samples_leaf': [1, 3, 5, 7], 'max_depth': [5,10,15,20]} rfc = RandomForestClassifier(n_estimators=100, random_state=42,                               n_jobs=-1, oob_score=True) gcv = GridSearchCV(rfc, parameters, n_jobs=-1, cv=skf, verbose=1) gcv.fit(X, y)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041b\u0443\u0447\u0448\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u2014 92.83% \u043f\u0440\u0438 <code>'max_depth': 15, 'max_features': 7, 'min_samples_leaf': 3<\/code>. <\/p>\n<p>  <\/p>\n<h3 id=\"variaciya-i-dekorrelyacionnyy-effekt\">\u0412\u0430\u0440\u0438\u0430\u0446\u0438\u044f \u0438 \u0434\u0435\u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442<\/h3>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u043a\u0430\u043a <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/841\/cf1\/dfd\/841cf1dfd38fa910745d7c99315f40e1.svg\" alt=\"$ \\large Varf(x) = \\rho(x)\\sigma^2(x) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  \u0422\u0443\u0442 <\/p>\n<p>  <\/p>\n<ul>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/520\/9eb\/40f\/5209eb40fd82a3d8d6e66a67888c3fdf.svg\" alt=\"$ \\large \\rho(x)$\" data-tex=\"inline\"\/><\/math> \u2013 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u043b\u044e\u0431\u044b\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u0438 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0438 <br \/> \n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7c3\/d43\/853\/7c3d43853bc1a1d4fc5c5378533ab8ce.svg\" alt=\"$ \\large \\rho(x) = corr[T(x;\\Theta_1(Z)),T(x_2,\\Theta_2(Z))], $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cd2\/f85\/b83\/cd2f85b83af5a700f65604155b2b835b.svg\" alt=\"$ \\large \\Theta_1(Z) $\" data-tex=\"inline\"\/><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/24a\/735\/794\/24a7357946703e0659d40d7020c0bd75.svg\" alt=\"$ \\large \\Theta_2(Z) $\" data-tex=\"inline\"\/><\/math> \u2013 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u043f\u0430\u0440\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 Z  <\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/820\/414\/7f4\/8204147f48b73ec9b9032fa9255c8a10.svg\" alt=\"$ \\large \\sigma^2(x)$\" data-tex=\"inline\"\/><\/math> \u2014 \u044d\u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430:\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1a9\/5e4\/f45\/1a95e4f45dab789eccd38acb2b502cba.svg\" alt=\"$ \\large \\sigma^2(x) = VarT(x;\\Theta(X)$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041b\u0435\u0433\u043a\u043e \u0441\u043f\u0443\u0442\u0430\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/756\/09b\/628\/75609b628375c919c41845393e34e208.svg\" alt=\"$ \\large \\rho(X) $\" data-tex=\"inline\"\/><\/math> \u0441\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043b\u0435\u0441\u0435, \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u043a\u0430\u043a N-\u0432\u0435\u043a\u0442\u043e\u0440\u044b \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044f \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u043f\u0430\u0440\u043d\u0443\u044e \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u042d\u0442\u043e \u043d\u0435 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439. \u042d\u0442\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u044f, \u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/01c\/707\/3a3\/01c7073a3c9cec139d9e838f9f0046a0.svg\" alt=\"$ \\large x$\" data-tex=\"inline\"\/><\/math> \u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/520\/9eb\/40f\/5209eb40fd82a3d8d6e66a67888c3fdf.svg\" alt=\"$ \\large \\rho(x)$\" data-tex=\"inline\"\/><\/math> \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043d\u0430\u0441 \u043e\u0431 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0438. \u0421\u043a\u043e\u0440\u0435\u0435, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/520\/9eb\/40f\/5209eb40fd82a3d8d6e66a67888c3fdf.svg\" alt=\"$ \\large \\rho(x)$\" data-tex=\"inline\"\/><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432, \u043e\u0446\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/01c\/707\/3a3\/01c7073a3c9cec139d9e838f9f0046a0.svg\" alt=\"$ \\large x$\" data-tex=\"inline\"\/><\/math>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u043c \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c32\/d7d\/019\/c32d7d0192d77ea139603117560a3af4.svg\" alt=\"$ \\large Z $\" data-tex=\"inline\"\/><\/math>, \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0430\u0440\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432. \u041d\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0436\u0430\u0440\u0433\u043e\u043d\u0435 \u044d\u0442\u043e \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c32\/d7d\/019\/c32d7d0192d77ea139603117560a3af4.svg\" alt=\"$ \\large Z $\" data-tex=\"inline\"\/><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0da\/594\/7bb\/0da5947bb08b6ef76c05342a96580e34.svg\" alt=\"$ \\large \\Theta $\" data-tex=\"inline\"\/><\/math>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u0444\u0430\u043a\u0442\u0443, \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u044b \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0440\u0430\u0432\u043d\u0430 0, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u0443\u0441\u0442\u0440\u044d\u043f \u0438 \u043e\u0442\u0431\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u2014 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b \u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0434\u0435\u0440\u0435\u0432\u0443, \u0442\u043e \u043e\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f (<math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5f2\/2f7\/ae5\/5f22f7ae57470b1f250429e8c2ace03b.svg\" alt=\"$ \\large m $\" data-tex=\"inline\"\/><\/math>), \u0430 \u0432\u043e\u0442 \u0434\u043b\u044f \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u044f \u044d\u0442\u043e \u0438\u0433\u0440\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0440\u043e\u043b\u044c, \u0438 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f \u0434\u043b\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u0434\u043b\u044f \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u044f.<br \/>  \u0412 \u043a\u043d\u0438\u0433\u0435 <em>The Elements of Statistical Learning (Trevor Hastie, Robert Tibshirani \u0438 Jerome Friedman)<\/em> \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442.<br \/>  <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/vitaliyradchenko\/org_mlcourse_open\/master\/img\/variance_rf.png?token=ANA_zqgC4WIOmhSNY30h_K-9U1iGqngwks5Y2SxowA%3D%3D\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h3 id=\"smeschenie\">\u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0435, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043b\u0435\u0441\u0435 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435, \u043a\u0430\u043a \u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/570\/097\/780\/5700977803407bb59d324e2a99590488.svg\" alt=\"$ \\large T(x,\\Theta(Z))$\" data-tex=\"inline\"\/><\/math> <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/895\/d4c\/808\/895d4c808f6270b2d671c156ccf93caf.svg\" alt=\"$ \\large \\begin{array}{rcl} Bias &amp;=&amp; \\mu(x) - E_Zf_{rf}(x) \\\\ &amp;=&amp; \\mu(x) - E_ZE_{\\Theta | Z}T(x,\\Theta(Z))\\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 (\u0432 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430\u0445), \u0447\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u00ab\u043d\u0435\u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043e\u0433\u043e\u00bb (unprunned) \u0434\u0435\u0440\u0435\u0432\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u043d\u0434\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043d\u0430\u043b\u0430\u0433\u0430\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0430 \u0438\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043b\u0435\u0441\u043e\u0432, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"sverhsluchaynye-derevya\">\u0421\u0432\u0435\u0440\u0445\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0441\u0432\u0435\u0440\u0445\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445 (Extremely Randomized Trees) \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0438 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 \u0443\u0437\u043b\u0430\u0445. \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043b\u0435\u0441\u0430\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0440\u043e\u0433\u043e\u0432, \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430, \u0438 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u0440\u043e\u0433\u043e\u0432 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0437\u043b\u0430. \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 scikit-learn \u0435\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <a href=\"http:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.ensemble.ExtraTreesClassifier.html#sklearn.ensemble.ExtraTreesClassifier\">ExtraTreesClassifier<\/a> \u0438 <a href=\"http:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.ensemble.ExtraTreesRegressor.html#sklearn.ensemble.ExtraTreesRegressor\">ExtraTreesRegressor<\/a>. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0435\u0441\u044c \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043b\u0435\u0441\u0435 \u0438\u043b\u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u043c \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0435. <\/p>\n<p>  <\/p>\n<h3 id=\"shozhest-sluchaynogo-lesa-s-algoritmom-k-blizhayshih-sosedey\">\u0421\u0445\u043e\u0436\u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c k-\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439**<\/h3>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0441\u0445\u043e\u0436 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043b\u0435\u0441\u0430, \u043f\u043e \u0441\u0443\u0442\u0438, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u043a \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0421\u0445\u043e\u0436\u0435\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0435\u043c \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u0447\u0430\u0449\u0435 \u044d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043b\u0438\u0441\u0442\u0435 \u0434\u0435\u0440\u0435\u0432\u0430. \u041f\u043e\u043a\u0430\u0436\u0435\u043c \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043f\u043e\u0442\u0435\u0440\u044c. \u041f\u0443\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cf9\/05b\/160\/cf905b16068bd87d1f8ed08cc7091fa4.svg\" alt=\"$ \\large T_n(x) $\" data-tex=\"inline\"\/><\/math> \u2014 \u043d\u043e\u043c\u0435\u0440 \u043b\u0438\u0441\u0442\u0430 n-\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0438\u0437 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/01c\/707\/3a3\/01c7073a3c9cec139d9e838f9f0046a0.svg\" alt=\"$ \\large x $\" data-tex=\"inline\"\/><\/math>. \u041e\u0442\u0432\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/01c\/707\/3a3\/01c7073a3c9cec139d9e838f9f0046a0.svg\" alt=\"$ \\large x $\" data-tex=\"inline\"\/><\/math> \u0440\u0430\u0432\u0435\u043d \u0441\u0440\u0435\u0434\u043d\u0435\u043c\u0443 \u043e\u0442\u0432\u0435\u0442\u0443 \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u044d\u0442\u043e\u0442 \u043b\u0438\u0441\u0442 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cf9\/05b\/160\/cf905b16068bd87d1f8ed08cc7091fa4.svg\" alt=\"$ \\large T_n(x) $\" data-tex=\"inline\"\/><\/math>. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/02c\/708\/562\/02c708562ceee8c0139769a2b827e93d.svg\" alt=\"$ \\large b_n(x) = \\sum_{i=1}^{l}w_n(x,x_i)y_i,$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0433\u0434\u0435 <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0c7\/e47\/2fe\/0c7e472feece992dd3095c7fbbab08eb.svg\" alt=\"$ \\large w_n(x, x_i) = \\frac{[T_n(x) = T_n(x_i)]}{\\sum_{j=1}^{l}[T_n(x) = T_n(x_j)]}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u043e\u0442\u0432\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0430\u0432\u0435\u043d <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f08\/541\/8ce\/f085418cec44daa1d4831341cdaf26a0.svg\" alt=\"$ \\large \\begin{array}{rcl} a_n(x) &amp;=&amp; \\frac{1}{N}\\sum_{n=1}^{N}\\sum_{i=1}^{l}w_n(x,x_i)y_i \\\\ &amp;=&amp; \\sum_{i=1}^{l}\\Big(\\frac{1}{N}\\sum_{j=1}^{N}w_n(x,x_j)\\Big)y_i \\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  \u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0443\u043c\u043c\u0443 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u0435\u0441\u0430\u043c\u0438. \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043d\u043e\u043c\u0435\u0440 \u043b\u0438\u0441\u0442\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cf9\/05b\/160\/cf905b16068bd87d1f8ed08cc7091fa4.svg\" alt=\"$ \\large T_n(x)$\" data-tex=\"inline\"\/><\/math>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043f\u0430\u043b \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0438\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0438\u043b\u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u043a \u043d\u0435\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/644\/24d\/92a\/64424d92af7601b1934a39065304a1ee.svg\" alt=\"$ \\large T_1(x), \\dots, T_n(x) $\" data-tex=\"inline\"\/><\/math>. \u041d\u043e\u0432\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0441\u0443\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043a\u043d\u0438\u0433\u0435 <em>The Elements of Statistical Learning<\/em> \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0438 k-\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/vitaliyradchenko\/org_mlcourse_open\/master\/img\/knn_vs_rf.png?token=ANA_zupu5sc3y0dr-gl8FVnIJcm2BaK0ks5Y2S2iwA%3D%3D\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h3 id=\"preobrazovanie-priznakov-v-mnogomernoe-prostranstvo\">\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e<\/h3>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441 \u0443\u0447\u0438\u0442\u0435\u043b\u0435\u043c, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u0431\u0435\u0437 \u0443\u0447\u0438\u0442\u0435\u043b\u044f. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"http:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.ensemble.RandomTreesEmbedding.html#sklearn.ensemble.RandomTreesEmbedding\">RandomTreesEmbedding<\/a> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0435 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435. \u0415\u0433\u043e \u0441\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u043b\u0438\u0441\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435, \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0437\u0430 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a. \u0415\u0441\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u043b\u0438\u0441\u0442 \u043f\u043e\u043f\u0430\u043b \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e \u043c\u044b \u0441\u0442\u0430\u0432\u0438\u043c 1, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b, \u0442\u043e 0. \u0422\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0440\u0430\u0437\u0440\u044f\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f\/\u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u0438\u0445 \u0433\u043b\u0443\u0431\u0438\u043d\u044b. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043b\u0435\u0436\u0430\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043b\u0438\u0441\u0442\u0435 \u0434\u0435\u0440\u0435\u0432\u0430, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u0443\u044e, \u043d\u0435\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<h1 id=\"3-ocenka-vazhnosti-priznakov\">3. \u041e\u0446\u0435\u043d\u043a\u0430 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/h1>\n<p>  <\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u0430 \u043d\u0435 \u0438\u043d\u0430\u0447\u0435 \u0434\u0430\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442. \u0418\u043b\u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0442\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u043a\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0418\u0437 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<h3 id=\"sut-metoda\">\u0421\u0443\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430<\/h3>\n<p>  <\/p>\n<p>\u041f\u043e \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u00ab\u0412\u043e\u0437\u0440\u0430\u0441\u0442\u00bb \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0433\u043e \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430 \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u00ab\u0414\u043e\u0445\u043e\u0434\u00bb. \u0424\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/32d\/465\/71f\/32d46571feaa7835080ac980bcf685ae.gif\" \/><\/div>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441), \u0442\u043e \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0442\u0435\u043c \u043e\u043d \u0432\u0430\u0436\u043d\u0435\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\/\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438. \u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0414\u0436\u0438\u043d\u0438) \u2014 \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0438 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043d \u043f\u043e \u0432\u0441\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043b\u0435\u0441\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0433\u043b\u0443\u0431\u0438\u043c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438. \u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0444\u0430\u0437\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f out-of-bag \u043e\u0448\u0438\u0431\u043a\u0438. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0438\u0437-\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438) \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0442\u0435\u043c \u0432\u0430\u0436\u043d\u0435\u0435 \u044d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u0431\u043e\u0301\u043b\u044c\u0448\u0438\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430 \u0414\u0436\u0438\u043d\u0438 (\u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 mse \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0440\u043e\u0439 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u043e\u0441\u0442\u0438 \u0443\u0437\u043b\u043e\u0432 \u0438 \u043b\u0438\u0441\u0442\u044c\u0435\u0432 \u0432 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0443\u0437\u043b\u0430, \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0414\u0436\u0438\u043d\u0438 \u0434\u043b\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u0443\u0437\u043b\u043e\u0432 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0414\u0436\u0438\u043d\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0440\u043e\u0439 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 0 (\u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u043e\u0439) \u0434\u043e 1 (\u0433\u0435\u0442\u0435\u0440\u043e\u0433\u0435\u043d\u043d\u043e\u0439). \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0443\u0437\u043b\u0430\u043c \u0441 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0447\u0438\u0441\u0442\u043e\u0442\u043e\u0439, \u0438\u043c\u0435\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430 \u0414\u0436\u0438\u043d\u0438.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0444\u043e\u0440\u043c\u0443\u043b. <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/955\/337\/adc\/955337adc0565610c469e85f5a9143c4.svg\" alt=\"$ \\large VI^{T} = \\frac{\\sum_{i \\in \\mathfrak{B}^T}I \\Big(y_i=\\hat{y}_i^{T}\\Big)}{\\Big |\\mathfrak{B}^T\\Big |} - \\frac{\\sum_{i \\in \\mathfrak{B}^T}I \\Big(y_i=\\hat{y}_{i,\\pi_j}^{T}\\Big)}{\\Big |\\mathfrak{B}^T\\Big |} $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5b4\/c5d\/bd5\/5b4c5dbd5dc39f7a866b660b74310e6a.svg\" alt=\"$ \\large \\hat{y}_i^{(T)} = f^{T}(x_i) $\" data-tex=\"inline\"\/><\/math> \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/89d\/457\/d4b\/89d457d4b6c4776e9b71cd32102632ed.svg\" alt=\"$ \\large \\hat{y}_{i,\\pi_j}^{(T)} = f^{T}(x_{i,\\pi_j}) $\" data-tex=\"inline\"\/><\/math> \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f54\/764\/a24\/f54764a24940f0739fda43e01e650cee.svg\" alt=\"$ \\large x_{i,\\pi_j} = (x_{i,1}, \\dots , x_{i,j-1}, \\quad x_{\\pi_j(i),j}, \\quad x_{i,j+1}, \\dots , x_{i,p})$\" data-tex=\"inline\"\/><\/math>  <\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e34\/d98\/6be\/e34d986bea6c6c53fea28b0d36799cfd.svg\" alt=\"$ \\large VI^{(T)}(x_j) = 0 $\" data-tex=\"inline\"\/><\/math>, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/292\/28f\/2c1\/29228f2c198f39dcbb567396310caf2b.svg\" alt=\"$ \\large X_j $\" data-tex=\"inline\"\/><\/math> \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/682\/3fd\/794\/6823fd7941a841a3b368234bcf3bb0c4.svg\" alt=\"$ \\large T $\" data-tex=\"inline\"\/><\/math> <\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0447\u0435\u0442 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0432 \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0435:<br \/>  \u2014 \u043d\u0435\u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9ca\/b9b\/3bb\/9cab9b3bbc86bda379f49ea4b7164862.svg\" alt=\"$ \\large VI(x_j) = \\frac{\\sum_{T=1}^{N}VI^{T}(x_j)}{N} $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u2014 \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2ac\/920\/5c2\/2ac9205c204df1b4a9e562a08715c52a.svg\" alt=\"$ \\large z_j = \\frac{VI(x_j)}{\\frac{\\hat{\\sigma}}{\\sqrt{N}}} $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440.<\/strong><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0430\u043d\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u0445\u043e\u0441\u0442\u0435\u043b\u043e\u0432 \u0441 \u0441\u0430\u0439\u0442\u043e\u0432 Booking.com \u0438 TripAdvisor.com. \u041f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u2014 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0430\u043a\u0442\u043e\u0440\u0430\u043c (\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043d\u0438\u0436\u0435) \u2014 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043c\u043d\u0430\u0442 \u0438 \u0442.\u0434. \u0426\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u2014 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0445\u043e\u0441\u0442\u0435\u043b\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from __future__ import division, print_function # \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c \u0432\u0441\u044f\u043a\u0438\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f Anaconda import warnings warnings.filterwarnings('ignore') %pylab inline import seaborn as sns # russian headres from matplotlib import rc font = {'family': 'Verdana',         'weight': 'normal'} rc('font', **font) import pandas as pd import numpy as np from sklearn.ensemble.forest import RandomForestRegressor  hostel_data = pd.read_csv(&quot;..\/..\/data\/hostel_factors.csv&quot;) features = {&quot;f1&quot;:u&quot;\u041f\u0435\u0440\u0441\u043e\u043d\u0430\u043b&quot;, &quot;f2&quot;:u&quot;\u0411\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0445\u043e\u0441\u0442\u0435\u043b\u0430 &quot;, &quot;f3&quot;:u&quot;\u0417\u0430\u0435\u0437\u0434 \u0432 \u0445\u043e\u0441\u0442\u0435\u043b \u0438 \u0432\u044b\u0435\u0437\u0434 \u0438\u0437 \u0445\u043e\u0441\u0442\u0435\u043b\u0430&quot;, &quot;f4&quot;:u&quot;\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043c\u043d\u0430\u0442\u044b&quot;, &quot;f5&quot;:u&quot;\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0439 \u043a\u0443\u0445\u043d\u0438&quot;, &quot;f6&quot;:u&quot;\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430&quot;, &quot;f7&quot;:u&quot;\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u043b\u0443\u0433\u0438&quot;, &quot;f8&quot;:u&quot;\u041e\u0431\u0449\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430&quot;, &quot;f9&quot;:u&quot;\u0426\u0435\u043d\u0430\/\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e&quot;, &quot;f10&quot;:u&quot;\u0421\u0421\u0426&quot;}  forest = RandomForestRegressor(n_estimators=1000, max_features=10,                                 random_state=0)  forest.fit(hostel_data.drop(['hostel', 'rating'], axis=1),             hostel_data['rating']) importances = forest.feature_importances_  indices = np.argsort(importances)[::-1] # Plot the feature importancies of the forest num_to_plot = 10 feature_indices = [ind+1 for ind in indices[:num_to_plot]]  # Print the feature ranking print(&quot;Feature ranking:&quot;)  for f in range(num_to_plot):     print(&quot;%d. %s %f &quot; % (f + 1,              features[&quot;f&quot;+str(feature_indices[f])],              importances[indices[f]])) plt.figure(figsize=(15,5)) plt.title(u&quot;\u0412\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0432&quot;) bars = plt.bar(range(num_to_plot),                 importances[indices[:num_to_plot]],        color=([str(i\/float(num_to_plot+1))                 for i in range(num_to_plot)]),                align=&quot;center&quot;) ticks = plt.xticks(range(num_to_plot),                     feature_indices) plt.xlim([-1, num_to_plot]) plt.legend(bars, [u''.join(features[&quot;f&quot;+str(i)])                    for i in feature_indices]);<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/img\/rf_features_imp.png?raw=true\" alt=\"image\"\/><br \/>  \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0432\u044b\u0448\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043b\u044e\u0434\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b \u0438 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u0430\/\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f \u043e\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u043f\u0438\u0448\u0443\u0442 \u0441\u0432\u043e\u0438 \u043e\u0442\u0437\u044b\u0432\u044b. \u041d\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u0438 \u043c\u0435\u043d\u0435\u0435 \u0432\u043b\u0438\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f, \u0438 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u043e \u0434\u0430\u0436\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0430\u0442\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043e\u0442\u0435\u043b\u044f\u043c \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043b\u0443\u0447\u0448\u0435 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b \u0438\/\u0438\u043b\u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0446\u0435\u043d\u044b. <\/p>\n<p>  <\/p>\n<h1 id=\"4-plyusy-i-minusy-sluchaynogo-lesa\">4. \u041f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430:<\/h1>\n<p>  <\/p>\n<p><strong>\u041f\u043b\u044e\u0441\u044b<\/strong>:<br \/>  \u2014 \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f, \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0437\u0430\u0434\u0430\u0447 \u0431\u0443\u0434\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432; \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0441\u0440\u0430\u0432\u043d\u0438\u043c\u0430 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0430<br \/>  \u2014 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u043a \u0432\u044b\u0431\u0440\u043e\u0441\u0430\u043c \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437-\u0437\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0441\u044d\u043c\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<br \/>  \u2014 \u043d\u0435\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e (\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043a \u043b\u044e\u0431\u044b\u043c \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f\u043c) \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e\u0434\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432<br \/>  \u2014 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u00ab\u0442\u044e\u043d\u0438\u043d\u0433\u0430\u00bb \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u043e\u0442 0.5 \u0434\u043e 3% \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0434\u0430\u043d\u043d\u044b\u0445<br \/>  \u2014 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<br \/>  \u2014 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0435\u0442 \u043a\u0430\u043a \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435, \u0442\u0430\u043a \u0438 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438<br \/>  \u2014 \u0440\u0435\u0434\u043a\u043e \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u043d\u043e \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432, \u043a\u0440\u0438\u0432\u0430\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0443<br \/>  \u2014 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438<br \/>  \u2014 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u0430<br \/>  \u2014 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430 \u0432\u0441\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435, \u043b\u0438\u0431\u043e \u043d\u0430 \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430<br \/>  \u2014 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0431\u043b\u0438\u0437\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0440\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 \u0438\u043b\u0438 (\u043f\u0443\u0442\u0435\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f) \u0434\u0430\u044e\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<br \/>  \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u044b \u0434\u043e \u043d\u0435\u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0442\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0431\u0440\u043e\u0441\u044b<br \/>  \u2014 \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<p><strong>\u041c\u0438\u043d\u0443\u0441\u044b<\/strong>:<br \/>  \u2014 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<br \/>  \u2014 \u043d\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 (p-values), \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<br \/>  \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u0443\u0436\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (\u0442\u0435\u043a\u0441\u0442\u044b, Bag of words)<br \/>  \u2014 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441 \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u044d\u043a\u0441\u0442\u0440\u0430\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0442\u043e\u0439 \u0436\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 (\u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043f\u043b\u044e\u0441\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0441\u0442\u0440\u0435\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u0440\u043e\u0441\u0430)<br \/>  \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043a\u043b\u043e\u043d\u0435\u043d \u043a \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430 \u0437\u0430\u0448\u0443\u043c\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<br \/>  \u2014 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043b\u0435\u0441\u0430 \u043f\u0440\u0435\u0434\u0432\u0437\u044f\u0442\u044b \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u0439: \u043a\u043e\u0433\u0434\u0430 \u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u043c\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u0434\u0435\u0440\u0435\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434 \u044d\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<br \/>  \u2014 \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u0441\u0445\u043e\u0436\u0443\u044e \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u043a, \u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u043f\u0435\u0440\u0435\u0434 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438<br \/>  \u2014 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/755\/a96\/16f\/755a9616fb61a6997406ec924111a4fc.svg\" alt=\"$\\large O(NK) $\" data-tex=\"inline\"\/><\/math> \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b9c\/9b9\/547\/b9c9b954732a49687c0c27775b8babfb.svg\" alt=\"$\\large K $\" data-tex=\"inline\"\/><\/math> \u2014 \u0447\u0438\u0441\u043b\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<p>  <\/p>\n<h1 id=\"5-domashnee-zadanie\">5. \u0414\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c <a href=\"https:\/\/github.com\/Yorko\/mlcourse_open\/blob\/master\/jupyter_notebooks\/topic5_bagging_rf\/hw5_logit_rf_credit_scoring.ipynb\">\u0437\u0430\u0434\u0430\u043d\u0438\u0438<\/a> \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0433\u043e \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043a\u0430\u043a \u0438 \u0433\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0431\u0443\u0442\u0441\u0442\u0440\u044d\u043f, \u0432 \u0447\u0435\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043b\u0435\u0441\u043e\u043c. \u0422\u0430\u043a \u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u043a\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0431\u044d\u0433\u0433\u0438\u043d\u0433 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0435, \u0430 \u0432 \u043a\u0430\u043a\u0438\u0445 \u2013 \u0445\u0443\u0436\u0435. \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0438\u0442\u0430\u044f \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432 <a href=\"https:\/\/goo.gl\/forms\/wNLR2QJj0ZqQ7B9q1\">\u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u0435<\/a>. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0437\u0430 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u2013 12 \u0431\u0430\u043b\u043b\u043e\u0432. \u0414\u0435\u0434\u043b\u0430\u0439\u043d \u2013 3 \u0430\u043f\u0440\u0435\u043b\u044f 23:59 UTC+3.<\/p>\n<p>  <\/p>\n<h1 id=\"6-poleznye-istochniki\">6. \u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/h1>\n<p>  <\/p>\n<p>\u2013 15 \u0440\u0430\u0437\u0434\u0435\u043b \u043a\u043d\u0438\u0433\u0438 \u201c<a href=\"https:\/\/statweb.stanford.edu\/~tibs\/ElemStatLearn\/\">Elements of Statistical Learning<\/a>\u201d Jerome H. Friedman, Robert Tibshirani, and Trevor Hastie<br \/>  \u2013 <a href=\"https:\/\/alexanderdyakonov.wordpress.com\/2016\/11\/14\/\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439-\u043b\u0435\u0441-random-forest\/\">\u0411\u043b\u043e\u0433<\/a> \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440\u0430 \u0414\u044c\u044f\u043a\u043e\u043d\u043e\u0432\u0430<br \/>  \u2013 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"http:\/\/scikit-learn.org\/stable\/modules\/ensemble.html\">scikit-learn<\/a><br \/>  \u2013 <a href=\"https:\/\/github.com\/esokolov\/ml-course-hse\">\u041a\u0443\u0440\u0441<\/a> \u0415\u0432\u0433\u0435\u043d\u0438\u044f \u0421\u043e\u043a\u043e\u043b\u043e\u0432\u0430 \u043f\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e (\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043d\u0430 GitHub). \u0415\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p><em>\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0441\u043e\u0430\u0432\u0442\u043e\u0440\u0441\u0442\u0432\u0435 \u0441 <a href=\"https:\/\/habrahabr.ru\/users\/yorko\/\" class=\"user_link\">yorko<\/a> (\u042e\u0440\u0438\u0435\u043c \u041a\u0430\u0448\u043d\u0438\u0446\u043a\u0438\u043c). \u0410\u0432\u0442\u043e\u0440 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u2013 <a href=\"https:\/\/habrahabr.ru\/users\/vradchenko\/\" class=\"user_link\">vradchenko<\/a> (\u0412\u0438\u0442\u0430\u043b\u0438\u0439 \u0420\u0430\u0434\u0447\u0435\u043d\u043a\u043e). \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e <a href=\"https:\/\/habrahabr.ru\/users\/bauchgefuehl\/\" class=\"user_link\">bauchgefuehl<\/a> (\u0410\u043d\u0430\u0441\u0442\u0430\u0441\u0438\u044e \u041c\u0430\u043d\u043e\u0445\u0438\u043d\u0443) \u0437\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/em><\/p>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/324402\/\"> https:\/\/habrahabr.ru\/post\/324402\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0434\u043e\u0436\u0438\u043b \u0434\u043e \u043f\u044f\u0442\u043e\u0439 \u0442\u0435\u043c\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0443\u0440\u0441\u0430! <\/p>\n<p>  <\/p>\n<p>\u041a\u0443\u0440\u0441 \u0441\u043e\u0431\u0440\u0430\u043b \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 1000 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u0438\u0437 \u043d\u0438\u0445 \u043f\u0435\u0440\u0432\u044b\u0435 3 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u043b\u0438 520, 450 \u0438 360 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1f8\/981\/50a\/1f898150a862463bae79b42e3da32beb.jpg\" align=\"right\" width=\"400\"\/> \u041e\u043a\u043e\u043b\u043e 200 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043f\u043e\u043a\u0430 \u0438\u0434\u0443\u0442 \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0431\u0430\u043b\u043b\u043e\u043c. \u041e\u0442\u0442\u043e\u043a \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435, \u0447\u0435\u043c \u0432 MOOC-\u0430\u0445, \u0434\u0430\u0436\u0435 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u043d\u0430\u0448\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439. <\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u043c\u044b \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438: \u0431\u044d\u0433\u0433\u0438\u043d\u0433\u0443 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c\u0443 \u043b\u0435\u0441\u0443. \u0412\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0435\u0435 \u0447\u0430\u0441\u0442\u0438; \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e, \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438; \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441, \u043a\u0430\u043a\u0438\u0435 \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0443\u0436\u043d\u043e \u00ab\u043f\u043e\u0434\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c\u00bb \u0438 \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a. \u0421\u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u00ab\u0449\u0435\u043f\u043e\u0442\u043a\u0443\u00bb \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0430\u0442\u0435\u0439 \u0441\u0435\u0440\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<ol>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/322626\/\">\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Pandas<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/323210\/\">\u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 c Python<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/322534\/\">\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/323890\/\">\u041b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/324402\/\">\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438: \u0431\u044d\u0433\u0433\u0438\u043d\u0433, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441<\/a><\/li>\n<li>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0443\u0447\u0438\u0442\u0435\u043b\u044f: PCA, \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u043f\u043e\u0438\u0441\u043a \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439<\/li>\n<li>\u0418\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u0431\u043e\u0440\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0433\u0435\u043e-\u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-283965","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283965","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=283965"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283965\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}