{"id":288461,"date":"2018-08-24T12:45:10","date_gmt":"2018-08-24T08:45:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288461"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2018-08-24T08:45:10","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288461","title":{"rendered":"\u041a\u0430\u043a \u043c\u044b \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 \u043f\u044f\u0442\u044c \u0440\u0430\u0437, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043d\u0430 Python"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/company\/idfinance\/blog\/421091\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-z\/kh\/d3\/-zkhd3-g2bfo-piumvjuva0iei4.png\" alt=\"image\"><\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043f\u0440\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442 \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0444\u0435\u0440\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0433\u0434\u0435 \u0435\u0449\u0435 \u0441 \u0434\u0430\u0432\u043d\u0438\u0445 \u0432\u0440\u0435\u043c\u0451\u043d \u0433\u043b\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u0438\u043d \u0432\u0438\u0434 \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u00ab\u0431\u0435\u043b\u044b\u0439 \u044f\u0449\u0438\u043a\u00bb \u2014 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u2013 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u044b\u0439 \u0441\u043a\u043e\u0440\u0438\u043d\u0433.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0447\u0438\u043d:<\/p>\n<p>  \u2022 \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u00ab\u0447\u0435\u0440\u043d\u044b\u0445 \u044f\u0449\u0438\u043a\u043e\u0432\u00bb \u0432\u0440\u043e\u0434\u0435 \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0430, \u043a\u0443\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 500 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<br \/>  \u2022 \u041c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0451 \u0435\u0449\u0435 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u044f \u0443 \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\u0430 \u0438\u0437-\u0437\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<br \/>  \u2022 \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u043a \u0438\u043d\u0442\u0435\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439: \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0426\u0435\u043d\u0442\u0440\u043e\u0431\u0430\u043d\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b\u043b\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043a\u0440\u0435\u0434\u0438\u0442\u0435 \u0437\u0430\u0435\u043c\u0449\u0438\u043a\u0443<br \/>  \u2022 \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 data mining \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, rapid miner, SAS Enterprise Miner, STATISTICA \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0430\u043a\u0435\u0442), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u0434\u0430\u0436\u0435 \u043d\u0435 \u0438\u043c\u0435\u044f \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/p>\n<p>  \u042d\u0442\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0434\u0435\u043b\u0430\u044e\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0444\u0435\u0440\u0430\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u00ab\u0432\u044b\u0436\u0438\u043c\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u00bb \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/>  \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430 \u043c\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 data mining \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 open source \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 Python, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u043b\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p>  <b>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430<\/b><\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jn\/e2\/da\/jne2da4ifmsjuhgui2piws8kbsi.png\" alt=\"image\"><\/p>\n<p>  \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043a \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043d\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c\u0438. \u041d\u0430\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0431\u0438\u043d\u043d\u0438\u043d\u0433 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (\u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0433\u0434\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435), \u0438\u0445 \u043e\u0442\u0441\u0435\u0432 \u043f\u043e Information Value (IV), \u0438 \u0440\u0443\u0447\u043d\u0443\u044e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0432\u0441\u0435\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u0431\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 DSL.<br \/>  \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 90-\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 data mining \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u0438 \u0438 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, L2-\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<br \/>  \u0412 \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u044d\u0442\u0430\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u0435\u043b\u0430\u044e\u0442 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438 Data Scientist\u2019\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441.<\/p>\n<p>  <b>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0432 Python<\/b><\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 Python \u0437\u0430 \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0438 \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0438 \u043d\u0430\u0447\u0430\u043b\u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0430\u043f\u044b \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. <br \/>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0441\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u2013 \u044d\u0442\u043e\u0442 \u044d\u0442\u0430\u043f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0432.<br \/>  \u0412 Python \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0437 \u0431\u0430\u0437\u044b \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pymysql.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def con():     conn = pymysql.connect(         host='10.100.10.100',         port=3306,         user='******* ',         password='*****',         db='mysql')     return conn;  df = pd.read_sql(''' SELECT  *  FROM idf_ru.data_for_scoring ''', con=con())<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0435\u0434\u043a\u0438\u0435 \u0438 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0435\u0439 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f ovefitting\u2019\u0430, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0446\u0435\u043b\u0435\u0432\u0443\u044e, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043b\u0438\u0448\u043d\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0438\u043c \u043d\u0430 \u0442\u0440\u0435\u0439\u043d \u0438 \u0442\u0435\u0441\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def filling(df):     cat_vars = df.select_dtypes(include=[object]).columns     num_vars = df.select_dtypes(include=[np.number]).columns     df[cat_vars] = df[cat_vars].fillna('_MISSING_')     df[num_vars] = df[num_vars].fillna(np.nan)     return df  def replace_not_frequent(df, cols, perc_min=5, value_to_replace = \"_ELSE_\"):         else_df = pd.DataFrame(columns=['var', 'list'])         for i in cols:             if i != 'date_requested' and i != 'credit_id':                 t = df[i].value_counts(normalize=True)                 q = list(t[t.values &lt; perc_min\/100].index)                 if q:                     else_df = else_df.append(pd.DataFrame([[i, q]], columns=['var', 'list']))                 df.loc[df[i].value_counts(normalize=True)[df[i]].values &lt; perc_min\/100, i] =value_to_replace         else_df = else_df.set_index('var')         return df, else_df  cat_vars = df.select_dtypes(include=[object]).columns df = filling(df)  df, else_df = replace_not_frequent_2(df, cat_vars)  df.drop(['credit_id', 'target_value', 'bor_credit_id', 'bchg_credit_id', 'last_credit_id', 'bcacr_credit_id',  'bor_bonuses_got' ], axis=1, inplace=True)  df_train, df_test, y_train, y_test = train_test_split(df, y, test_size=0.33, stratify=df.y, random_state=42)<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u0432 \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0435 \u0434\u043b\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0438\u0438 \u2013 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c WOE-binning \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0412 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043c\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u043b\u044f \u043d\u0430\u0441 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u0438. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u0431\u0438\u043d\u043d\u0438\u043d\u0433\u0430 \u0432\u0437\u044f\u043b\u0438 <a href=\"https:\/\/www.researchgate.net\/publication\/322520135_Monotone_optimal_binning_algorithm_for_credit_risk_modeling\">\u044d\u0442\u0443 <\/a>\u0441\u0442\u0430\u0442\u044c\u044e 2017 \u0433\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/medium.com\/@sundarstyles89\/weight-of-evidence-and-information-value-using-python-6f05072e83eb\">\u044d\u0442\u0443<\/a>, \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0430\u043c\u0438 \u0441 \u043d\u0443\u043b\u044f. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u043c\u0438 (Gini \u043d\u0430 \u0442\u0435\u0441\u0442\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u043d\u0430 3-5 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0431\u0438\u043d\u043d\u0438\u043d\u0433\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 data mining \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c).<br \/>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445 \u0438\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 excel), \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u0431\u0438\u043b\u0438\u0441\u044c \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e\u0441\u0442\u044c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/da\/ij\/2u\/daij2uewkyujfn3jhdapc-yyfia.png\" alt=\"image\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c6\/if\/3u\/c6if3uqy--eqewru4nm9au1gwgw.png\" alt=\"image\"><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u0431\u0438\u043d\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def plot_bin(ev, for_excel=False):     ind = np.arange(len(ev.index))      width = 0.35     fig, ax1 = plt.subplots(figsize=(10, 7))     ax2 = ax1.twinx()     p1 = ax1.bar(ind, ev['NONEVENT'], width, color=(24\/254, 192\/254, 196\/254))     p2 = ax1.bar(ind, ev['EVENT'], width, bottom=ev['NONEVENT'], color=(246\/254, 115\/254, 109\/254))      ax1.set_ylabel('Event Distribution', fontsize=15)     ax2.set_ylabel('WOE', fontsize=15)      plt.title(list(ev.VAR_NAME)[0], fontsize=20)      ax2.plot(ind, ev['WOE'], marker='o', color='blue')     # Legend     plt.legend((p2[0], p1[0]), ('bad', 'good'), loc='best', fontsize=10)      #Set xticklabels     q = list()     for i in range(len(ev)):         try:             mn = str(round(ev.MIN_VALUE[i], 2))             mx = str(round(ev.MAX_VALUE[i], 2))         except:             mn = str((ev.MIN_VALUE[i]))             mx = str((ev.MAX_VALUE[i]))         q.append(mn + '-' + mx)      plt.xticks(ind, q, rotation='vertical')     for tick in ax1.get_xticklabels():         tick.set_rotation(60)     plt.savefig('{}.png'.format(ev.VAR_NAME[0]), dpi=500, bbox_inches = 'tight')     plt.show()   def plot_all_bins(iv_df):     for i in [x.replace('WOE_','') for x in X_train.columns]:         ev = iv_df[iv_df.VAR_NAME==i]         ev.reset_index(inplace=True)         plot_bin(ev)     <\/code><\/pre>\n<p>   <\/div>\n<\/div>\n<p>  \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0431\u0438\u043d\u043d\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u00ab\u0432\u0435\u0440\u0441\u0438\u044f \u041e\u0421\u00bb, \u0433\u0434\u0435 \u0432\u0441\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b \u043d\u0430 Android \u0438 iOS \u0431\u044b\u043b\u0438 \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0431\u0438\u043d\u043d\u0438\u043d\u0433\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def adjust_binning(df, bins_dict):     for i in range(len(bins_dict)):         key = list(bins_dict.keys())[i]         if type(list(bins_dict.values())[i])==dict:             df[key] = df[key].map(list(bins_dict.values())[i])         else:             #Categories labels             categories = list()             for j in range(len(list(bins_dict.values())[i])):                 if j == 0:                     categories.append('&lt;'+ str(list(bins_dict.values())[i][j]))                     try:                                                 categories.append('(' + str(list(bins_dict.values())[i][j]) +'; '+ str(list(bins_dict.values())[i][j+1]) + ']')                     except:                                                categories.append('(' + str(list(bins_dict.values())[i][j]))                 elif j==len(list(bins_dict.values())[i])-1:                     categories.append(str(list(bins_dict.values())[i][j]) +'&gt;')                 else:                     categories.append('(' + str(list(bins_dict.values())[i][j]) +'; '+ str(list(bins_dict.values())[i][j+1]) + ']')                          values = [df[key].min()] + list(bins_dict.values())[i]  + [df[key].max()]                     df[key + '_bins'] = pd.cut(df[key], values, include_lowest=True, labels=categories).astype(object).fillna('_MISSING_').astype(str)             df[key] = df[key + '_bins']#.map(df.groupby(key + '_bins')[key].agg('median'))             df.drop([key + '_bins'], axis=1, inplace=True)     return df  bins_dict = {        'equi_delinquencyDays': [ 200,400,600]     'loan_purpose': {'medicine':'1_group',                     'repair':'1_group',                     'helpFriend':'2_group'} }   df = adjust_binning(df, bins_dict)<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u044d\u0442\u0430\u043f\u043e\u043c \u0438\u0434\u0451\u0442 \u043e\u0442\u0431\u043e\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u043e Information Value. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0442 \u043e\u0444\u0444 0.1 (\u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u043b\u044b). <br \/>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e. \u0418\u0437 \u0434\u0432\u0443\u0445 \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0443, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 IV \u043c\u0435\u043d\u044c\u0448\u0435. \u041a\u0430\u0442 \u043e\u0444\u0444 \u043f\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044e \u0431\u044b\u043b \u0432\u0437\u044f\u0442 0.75.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sv\/7g\/f0\/sv7gf0nt_7sayq8jgjsjo_bfmpy.png\" alt=\"image\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0439<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def delete_correlated_features(df, cut_off=0.75, exclude = []):     # Create correlation matrix     corr_matrix = df.corr().abs()      # Select upper triangle of correlation matrix     upper = corr_matrix.where(np.triu(np.ones(corr_matrix.shape), k=1).astype(np.bool))          # Plotting All correlations     f, ax = plt.subplots(figsize=(15, 10))     plt.title('All correlations', fontsize=20)     sns.heatmap(X_train.corr(), annot=True)          # Plotting highly correlated     try:         f, ax = plt.subplots(figsize=(15, 10))         plt.title('High correlated', fontsize=20)         sns.heatmap(corr_matrix[(corr_matrix&gt;cut_off) &amp; (corr_matrix!=1)].dropna(axis=0, how='all').dropna(axis=1, how='all'), annot=True, linewidths=.5)     except:         print ('No highly correlated features found')              # Find index of feature columns with correlation greater than cut_off     to_drop = [column for column in upper.columns if any(upper[column] &gt; cut_off)]     to_drop = [column for column in to_drop if column not in exclude]     print ('Dropped columns:', to_drop, '\\n')     df2 = df.drop(to_drop, axis=1)     print ('Features left after correlation check: {}'.format(len(df.columns)-len(to_drop)), '\\n')             print ('Not dropped columns:', list(df2.columns), '\\n')          # Plotting final correlations     f, ax = plt.subplots(figsize=(15, 10))     plt.title('Final correlations', fontsize=20)     sns.heatmap(df2.corr(), annot=True)     plt.show()          return df2 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u043e\u0442\u0431\u043e\u0440\u0430 \u043f\u043e IV \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <a href=\"http:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.feature_selection.RFE.html\">RFE <\/a>\u0438\u0437 sklearn.<br \/>  \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u2013 \u043f\u043e\u0441\u043b\u0435 13 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043b\u0438\u0448\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c. \u0414\u043b\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 15 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0445\u0438\u043c \u0442\u043e\u043d\u043e\u043c, \u0447\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RFE.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4y\/sm\/2c\/4ysm2cgo50qcscs2rigxeksod6y.png\" alt=\"image\">   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">RFE<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def RFE_feature_selection(clf_lr, X, y):     rfecv = RFECV(estimator=clf_lr, step=1, cv=StratifiedKFold(5), verbose=0, scoring='roc_auc')     rfecv.fit(X, y)      print(\"Optimal number of features : %d\" % rfecv.n_features_)      # Plot number of features VS. cross-validation scores     f, ax = plt.subplots(figsize=(14, 9))     plt.xlabel(\"Number of features selected\")     plt.ylabel(\"Cross validation score (nb of correct classifications)\")     plt.plot(range(1, len(rfecv.grid_scores_) + 1), rfecv.grid_scores_)     plt.show()     mask = rfecv.get_support()     X = X.ix[:, mask]     return X<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0438\u043b\u0430\u0441\u044c \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0438 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0435\u0451 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043d\u0430 \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0432\u0441\u0435 \u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u043d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 Gini (\u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u043d\u0435\u0433\u043e <a href=\"https:\/\/habr.com\/company\/ods\/blog\/350440\/\">\u0442\u0443\u0442<\/a>).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kb\/mm\/uf\/kbmmufj5bxr4jybxad88d1pyggg.png\" alt=\"image\"> <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def plot_score(clf, X_test, y_test, feat_to_show=30, is_normalize=False, cut_off=0.5):     #cm = confusion_matrix(pd.Series(clf.predict_proba(X_test)[:,1]).apply(lambda x: 1 if x&gt;cut_off else 0), y_test)     print ('ROC_AUC:  ', round(roc_auc_score(y_test, clf.predict_proba(X_test)[:,1]), 3))     print ('Gini:     ', round(2*roc_auc_score(y_test, clf.predict_proba(X_test)[:,1]) - 1, 3))     print ('F1_score: ', round(f1_score(y_test, clf.predict(X_test)), 3))     print ('Log_loss: ', round(log_loss(y_test, clf.predict(X_test)), 3))          print ('\\n')     print ('Classification_report: \\n', classification_report(pd.Series(clf.predict_proba(X_test)[:,1]).apply(lambda x: 1 if x&gt;cut_off else 0), y_test))     skplt.metrics.plot_confusion_matrix(y_test, pd.Series(clf.predict_proba(X_test)[:,1]).apply(lambda x: 1 if x&gt;cut_off else 0), title=\"Confusion Matrix\",                     normalize=is_normalize,figsize=(8,8),text_fontsize='large')     display(eli5.show_weights(clf, top=20, feature_names = list(X_test.columns)))  clf_lr = LogisticRegressionCV(random_state=1, cv=7) clf_lr.fit(X_train, y_train)  plot_score(clf_lr, X_test, y_test, cut_off=0.5)<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u043b\u0438\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0441 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b (\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u0433\u0440\u0443\u043f\u043f\u044b \u0431\u0438\u043d\u043e\u0432, \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Gini \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0442.\u0434.) \u0432 excel. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c xlsxwriter, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0442\u0430\u043a \u0438 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u043c\u0438. <br \/>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043b\u0438\u0441\u0442\u043e\u0432 \u044d\u043a\u0441\u0435\u043b\u044f: <\/p>\n<p>   <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/um\/fg\/fn\/umfgfnwv9fo7hxo8lqq8fwyppes.png\" alt=\"image\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xw\/ym\/1y\/xwym1ynrybf7uhvlagzjrjshz_y.png\" alt=\"image\"><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0438\u0441\u044c \u0432 excel<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"> #WRITING writer = pd.ExcelWriter('PDL_Score_20180815-3.xlsx', engine='xlsxwriter')  workbook  = writer.book worksheet = workbook.add_worksheet('Sample information') bold = workbook.add_format({'bold': True}) percent_fmt = workbook.add_format({'num_format': '0.00%'})  worksheet.set_column('A:A', 20) worksheet.set_column('B:B', 15) worksheet.set_column('C:C', 10)  # Sample worksheet.write('A2', 'Sample conditions', bold) worksheet.write('A3', 1) worksheet.write('A4', 2) worksheet.write('A5', 3) worksheet.write('A6', 4)  # Model worksheet.write('A8', 'Model development', bold)  worksheet.write('A9', 1) #labels worksheet.write('C8', 'Bads') worksheet.write('D8', 'Goods') worksheet.write('B9', 'Train') worksheet.write('B10', 'Valid') worksheet.write('B11', 'Total')  # goods and bads worksheet.write('C9', y_train.value_counts()[1]) worksheet.write('C10', y_test.value_counts()[1]) worksheet.write('D9', y_train.value_counts()[0]) worksheet.write('D10', y_test.value_counts()[0]) worksheet.write('C11', y.value_counts()[1]) worksheet.write('D11', y.value_counts()[0])  # NPL worksheet.write('A13', 2) worksheet.write('B13', 'NPL') worksheet.write('C13', (y.value_counts()[1]\/(y.value_counts()[1]+y.value_counts()[0])), percent_fmt)  worksheet.write('A16', 3) worksheet.write('C15', 'Gini') worksheet.write('B16', 'Train') worksheet.write('B17', 'Valid') worksheet.write('B18', 'CV Scores') worksheet.write('C18', str([round(sc, 2) for sc in scores]))  worksheet.write('C16', round(2*roc_auc_score(y_train, clf_lr.predict_proba(X_train)[:,1]) - 1, 3)) worksheet.write('C17', round(2*roc_auc_score(y_test, clf_lr.predict_proba(X_test)[:,1]) - 1, 3))  # Regreesion coefs feat.to_excel(writer, sheet_name='Regression coefficients', index=False) worksheet2 = writer.sheets['Regression coefficients'] worksheet2.set_column('A:A', 15) worksheet2.set_column('B:B', 50)  #WOE  ivs[['VAR_NAME', 'Variable range', 'WOE', 'COUNT', 'WOE_group']].to_excel(writer, sheet_name='WOE', index=False) worksheet3 = writer.sheets['WOE'] worksheet3.set_column('A:A', 50) worksheet3.set_column('B:B', 60) worksheet3.set_column('C:C', 30) worksheet3.set_column('D:D', 20) worksheet3.set_column('E:E', 12) for num, i in enumerate([x.replace('WOE_','') for x in X_train.columns]):         ev = iv_df[iv_df.VAR_NAME==i]         ev.reset_index(inplace=True)         worksheet3.insert_image('G{}'.format(num*34+1), '{}.png'.format(i))  df3.to_excel(writer, sheet_name='Data', index=False)  table.to_excel(writer, sheet_name='Scores by buckets', header = True, index = True) worksheet4 = writer.sheets['Scores by buckets'] worksheet4.set_column('A:A', 20) worksheet4.insert_image('J1', 'score_distribution.png') Ginis.to_excel(writer, sheet_name='Gini distribution', header = True, index = True) worksheet5 = writer.sheets['Gini distribution'] worksheet5.insert_image('E1', 'gini_stability.png') writer.save()<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 excel \u0432 \u043a\u043e\u043d\u0446\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\u043e\u043c, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u0442\u0434\u0430\u0451\u0442\u0441\u044f \u0432 IT \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d.<\/p>\n<p>  <b>\u0418\u0442\u043e\u0433<\/b><\/p>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438, \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u044d\u0442\u0430\u043f\u044b \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430 \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u043d\u0430\u0432\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043e\u0442 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u043d\u043e\u0432, \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0442.\u0434), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0432\u044b\u0434\u0430\u0441\u0442 excel \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438.<br \/>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434 \u043d\u0443\u0436\u0434\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u0438 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435 \u043e\u0431\u043e\u0439\u0434\u0435\u0448\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043d\u0430 \u0440\u044b\u043d\u043a\u0435 data mining \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u043a\u0430\u043c \u043a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u044b\u0439 \u0431\u0438\u043d\u043d\u0438\u043d\u0433, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e, RFE, \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0438 \u0442.\u0434.<br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e Python \u043c\u044b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u0442\u0440\u0443\u0434\u0430 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0432.<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/421091\/\"> https:\/\/habr.com\/post\/421091\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/company\/idfinance\/blog\/421091\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-z\/kh\/d3\/-zkhd3-g2bfo-piumvjuva0iei4.png\" alt=\"image\"><\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043f\u0440\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442 \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0444\u0435\u0440\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0433\u0434\u0435 \u0435\u0449\u0435 \u0441 \u0434\u0430\u0432\u043d\u0438\u0445 \u0432\u0440\u0435\u043c\u0451\u043d \u0433\u043b\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u0438\u043d \u0432\u0438\u0434 \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u00ab\u0431\u0435\u043b\u044b\u0439 \u044f\u0449\u0438\u043a\u00bb \u2014 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u2013 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u044b\u0439 \u0441\u043a\u043e\u0440\u0438\u043d\u0433.  <\/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-288461","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288461","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=288461"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288461\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}