{"id":285082,"date":"2017-04-17T15:05:26","date_gmt":"2017-04-17T11:05:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=285082"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=285082","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 8. \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u0430\u0445 \u0441 Vowpal Wabbit"},"content":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/96c\/ffb\/939\/96cffb939d3848ebb814641f0c8435f0.jpeg\" align=\"right\" width=\"40%\"\/>  <\/p>\n<p>\u0412\u043e\u0442 \u043c\u044b \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0438 \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u043a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0434\u0441\u0442\u0443\u043f\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u044b \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442. \u041e\u0431\u0441\u0443\u0434\u0438\u043c \u043f\u0440\u0438\u0435\u043c\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c: \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a (SGD) \u0438 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Vowpal Wabbit. \u0414\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e SGD-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0442\u0430\u043a \u0438 \u043d\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 StackOverflow \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0432 10 \u0413\u0431. <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/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. \u041a\u0440\u0438\u0432\u044b\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/325422\/\">\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u0431\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/325654\/\">\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<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/\">\u041e\u0431\u0443\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u0430\u0445 c Vowpal Wabbit<\/a><\/li>\n<li>\u0410\u043d\u0430\u043b\u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python<\/li>\n<li>\u0413\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0431\u0443\u0441\u0442\u0438\u043d\u0433<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h1 id=\"plan\">\u041f\u043b\u0430\u043d<\/h1>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#stohasticheskiy-gradientnyy-spusk-i-onlayn-podhod-k-obucheniyu\">\u0421\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u0438 \u043e\u043d\u043b\u0430\u0439\u043d-\u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e<\/a><br \/> \n<ul>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#stohasticheskiy-gradientnyy-spusk\">\u0421\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#onlayn-podhod-k-obucheniyu\">\u041e\u043d\u043b\u0430\u0439\u043d-\u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#rabota-s-kategorialnymi-priznakami-label-encoding-one-hot-encoding-hashing-trick\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438: Label Encoding, One-Hot Encoding, Hashing trick<\/a><br \/> \n<ul>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#label-encoding\">Label Encoding<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#one-hot-encoding\">One-Hot Encoding<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#heshirovanie-priznakov-hashing-trick\">\u0425\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (Hashing trick)<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#biblioteka-vowpal-wabbit\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Vowpal Wabbit<\/a><br \/> \n<ul>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#novosti-binarnaya-klassifikaciya\">\u041d\u043e\u0432\u043e\u0441\u0442\u0438. \u0411\u0438\u043d\u0430\u0440\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#novosti-mnogoklassovaya-klassifikaciya\">\u041d\u043e\u0432\u043e\u0441\u0442\u0438. \u041c\u043d\u043e\u0433\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#recenzii-k-filmam-imdb\">\u0420\u0435\u0446\u0435\u043d\u0437\u0438\u0438 \u043a \u0444\u0438\u043b\u044c\u043c\u0430\u043c IMDB<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#klassifikaciya-voprosov-na-stackoverflow\">\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 StackOverflow<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#domashnee-zadanie\">\u0414\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/326418\/#poleznye-ssylki\">\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"stohasticheskiy-gradientnyy-spusk-i-onlayn-podhod-k-obucheniyu\">\u0421\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u0438 \u043e\u043d\u043b\u0430\u0439\u043d-\u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e<\/h1>\n<p>  <\/p>\n<h2 id=\"stohasticheskiy-gradientnyy-spusk\">\u0421\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a<\/h2>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u2013 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0435\u043c, \u0438\u0437\u0443\u0447\u0430\u0435\u043c\u044b\u0445 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438, \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0434\u043d\u043e\u0439 \u0435\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u2013 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0447\u0430\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e SGD (Stochastic Gradient Descent). <\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0441\u0443\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 \u2013 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0434\u0435\u043b\u0430\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0448\u0430\u0433\u0438 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043d\u0430\u0438\u0441\u043a\u043e\u0440\u0435\u0439\u0448\u0435\u0433\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0443 \u043f\u043e\u0434\u0430\u0440\u0438\u043b \u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u0438\u0437 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0447\u0442\u043e \u0432\u0435\u043a\u0442\u043e\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5c7\/c3c\/7ac\/5c7c3c7acc79f7b583610ccaafd41547.svg\" alt=\"$\\nabla f = (\\frac{\\partial f}{\\partial x_1}, \\ldots \\frac{\\partial f}{\\partial x_n})^T$\" data-tex=\"inline\"\/><\/math> \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6e0\/d9d\/631\/6e0d9d631279c992fc56b031dd1a9feb.svg\" alt=\"$f(x) = f(x_1, \\ldots x_n)$\" data-tex=\"inline\"\/><\/math> \u0437\u0430\u0434\u0430\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0438\u0441\u043a\u043e\u0440\u0435\u0439\u0448\u0435\u0433\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0417\u043d\u0430\u0447\u0438\u0442, \u0434\u0432\u0438\u0433\u0430\u044f\u0441\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0430\u043d\u0442\u0438\u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4f2\/75d\/a46\/4f275da467a44fc4a8d1a11007776ed2.jpg\"\/>  <\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u044f \u0432 \u0428\u0435\u0440\u0435\u0433\u0435\u0448\u0435 \u2013 \u0432\u0441\u0435\u043c \u043a\u0430\u0442\u0430\u044e\u0449\u0438\u043c \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0445\u043e\u0442\u044f \u0431\u044b \u0440\u0430\u0437 \u0432 \u0436\u0438\u0437\u043d\u0438 \u0442\u0430\u043c \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f. \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0434\u043b\u044f \u0443\u0441\u043f\u043e\u043a\u043e\u0435\u043d\u0438\u044f \u0433\u043b\u0430\u0437, \u043d\u043e \u0441 \u0435\u0435 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u044c \u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430. \u0415\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u2013 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0441\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u0433\u043e\u0440\u044b \u043d\u0430 \u0441\u043d\u043e\u0443\u0431\u043e\u0440\u0434\u0435, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u043a\u043b\u043e\u043d (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e \u0441 \u0436\u0438\u0437\u043d\u044c\u044e). \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0430\u043d\u0442\u0438\u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u2013 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0430 \u043a\u0440\u0443\u0442\u0438\u0437\u043d\u044b \u0441\u043a\u043b\u043e\u043d\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. <\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u2013 \u043f\u0430\u0440\u043d\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f<\/strong><\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0443 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0440\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u043c\u044b \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u043c \u043e\u0434\u043d\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u2013 \u0440\u043e\u0441\u0442 \u043f\u043e \u0432\u0435\u0441\u0443 \u2013 \u0438 \u043f\u043e\u0441\u0442\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u043e\u0441\u0442\u0430 \u043e\u0442 \u0432\u0435\u0441\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0440\u0430\u0441\u0441\u0435\u044f\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">%matplotlib inline from matplotlib import pyplot as plt import seaborn as sns import pandas as pd data_demo = pd.read_csv('..\/..\/data\/weights_heights.csv')<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">plt.scatter(data_demo['Weight'], data_demo['Height']); plt.xlabel('\u0412\u0435\u0441 \u0432 \u0444\u0443\u043d\u0442\u0430\u0445') plt.ylabel('\u0420\u043e\u0441\u0442 \u0432 \u0434\u044e\u0439\u043c\u0430\u0445');<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/dce\/163\/4f2\/dce1634f214a4e8399cdddb08a2fee7d.png\" \/><\/div>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u044b \u0432\u0435\u043a\u0442\u043e\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/baa\/dee\/944\/baadee9444d136cdabc2792cdd7d0b6b.svg\" alt=\"$x$\" data-tex=\"inline\"\/><\/math> \u0434\u043b\u0438\u043d\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1f4\/690\/9a1\/1f46909a1e747ff58f4935981c50a941.svg\" alt=\"$\\ell$\" data-tex=\"inline\"\/><\/math> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f (\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430) \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1e6\/829\/a25\/1e6829a256c8a2712f849dc1d2343b62.svg\" alt=\"$y$\" data-tex=\"inline\"\/><\/math> \u2013 \u0432\u0435\u043a\u0442\u043e\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0440\u043e\u0441\u0442\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f (\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430).<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430: \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u0432\u0435\u0441\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5ec\/533\/acf\/5ec533acf0f35024d8036be9294167b9.svg\" alt=\"$w_0$\" data-tex=\"inline\"\/><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5e4\/53c\/877\/5e453c8778a25353c0008f94d9710d02.svg\" alt=\"$w_1$\" data-tex=\"inline\"\/><\/math>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0435 \u0440\u043e\u0441\u0442\u0430 \u043f\u043e \u0432\u0435\u0441\u0443 \u0432 \u0432\u0438\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d9c\/35f\/4fe\/d9c35f4fe323da0b9a50fcd9988f59c5.svg\" alt=\"$y_i = w_0 + w_1 x_i$\" data-tex=\"inline\"\/><\/math> (\u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ce0\/009\/fc5\/ce0009fc5603a0e2edc997cebe4cc560.svg\" alt=\"$y_i$\" data-tex=\"inline\"\/><\/math> \u2013 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/721\/95b\/0db\/72195b0dbc8d5e1fbd3b06fd91ae2dba.svg\" alt=\"$i$\" data-tex=\"inline\"\/><\/math>-\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u043e\u0441\u0442\u0430, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/341\/dcf\/d5f\/341dcfd5f7bae56feb730788f817ab8f.svg\" alt=\"$x_i$\" data-tex=\"inline\"\/><\/math> \u2013 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/721\/95b\/0db\/72195b0dbc8d5e1fbd3b06fd91ae2dba.svg\" alt=\"$i$\" data-tex=\"inline\"\/><\/math>-\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u0430) \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 (\u043c\u043e\u0436\u043d\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e, \u043d\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/250\/c4f\/55f\/250c4f55fd14e26d9c3350e35a31f355.svg\" alt=\"$\\frac{1}{\\ell}$\" data-tex=\"inline\"\/><\/math> \u043f\u043e\u0433\u043e\u0434\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/220\/e5e\/6e9\/220e5e6e9f1e30bf01481550c826bbaf.svg\" alt=\"$\\frac{1}{2}$\" data-tex=\"inline\"\/><\/math> \u0437\u0430\u0432\u0435\u0434\u0435\u043d\u0430 \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u043e\u0442\u044b):<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c41\/866\/1ed\/c418661ed4a2ba542cca4a841e4f484d.svg\" alt=\"$SE(w_0, w_1) = \\frac{1}{2}\\sum_{i=1}^\\ell(y_i - (w_0 + w_1x_{i}))^2 \\rightarrow min_{w_0,w_1}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0414\u0435\u043b\u0430\u0442\u044c \u043c\u044b \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0432 \u0447\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1b6\/b2e\/45c\/1b6b2e45cd5de26a704a9fa3307aa5e5.svg\" alt=\"$SE(w_0, w_1)$\" data-tex=\"inline\"\/><\/math> \u043f\u043e \u0432\u0435\u0441\u0430\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u2013 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5ec\/533\/acf\/5ec533acf0f35024d8036be9294167b9.svg\" alt=\"$w_0$\" data-tex=\"inline\"\/><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5e4\/53c\/877\/5e453c8778a25353c0008f94d9710d02.svg\" alt=\"$w_1$\" data-tex=\"inline\"\/><\/math>. \u0418\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u043c\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432 (\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0435\u0441\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043c\u0430\u043b\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a29\/92b\/78e\/a2992b78ef3b4d6f7200cee0519bfc87.svg\" alt=\"$\\eta$\" data-tex=\"inline\"\/><\/math>, \u0448\u0430\u0433 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0430\u043d\u0442\u0438\u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438):<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/479\/4db\/4b1\/4794db4b1eff14ba65a6abe1a0cb6924.svg\" alt=\"$\\begin{array}{rcl} w_0^{(t+1)} = w_0^{(t)} -\\eta \\frac{\\partial SE}{\\partial w_0} |_{t} \\\\ w_1^{(t+1)} = w_1^{(t)} -\\eta \\frac{\\partial SE}{\\partial w_1} |_{t} \\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0440\u0443\u0447\u043a\u0435 \u0438 \u0431\u0443\u043c\u0430\u0436\u043a\u0435 \u0438 \u043d\u0430\u0439\u0442\u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/988\/7c6\/5aa\/9887c65aaf90c6d4094b4438654ad63e.svg\" alt=\"$\\begin{array}{rcl} w_0^{(t+1)} = w_0^{(t)} + \\eta \\sum_{i=1}^{\\ell}(y_i - w_0^{(t)} - w_1^{(t)}x_i) \\\\ w_1^{(t+1)} = w_1^{(t)} + \\eta \\sum_{i=1}^{\\ell}(y_i - w_0^{(t)} - w_1^{(t)}x_i)x_i \\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0418 \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (\u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u0432, \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0448\u0430\u0433\u0430 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430, \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u0442.\u0434. \u2013 \u043f\u0440\u043e \u044d\u0442\u043e \u0438 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"http:\/\/www.deeplearningbook.org\/contents\/numerical.html\">\u0433\u043b\u0430\u0432\u0435<\/a> &quot;Numeric Computation&quot; \u043a\u043d\u0438\u0433\u0438 &quot;Deep Learning&quot;) \u043f\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e, \u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0441\u0430 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u0441\u0443\u043c\u043c\u0430 \u043f\u043e \u0432\u0441\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0432\u0438\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3ca\/ed7\/ecb\/3caed7ecb6b1d3690e50eba9f3f8e384.svg\" alt=\"$\\sum_{i=1}^\\ell$\" data-tex=\"inline\"\/><\/math>. \u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0438 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u044b?<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ed1\/85c\/f84\/ed185cf849cb4997b29fbb54fcd48bf9.jpg\"  width=\"70%\"\/><\/div>\n<p>  <\/p>\n<p>\u0421\u0443\u0442\u044c \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 \u2013 \u043d\u0435\u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u043a \u0441\u0443\u043c\u043c\u044b \u0438\u0437 \u0444\u043e\u0440\u043c\u0443\u043b \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442\u0430 \u0432\u0435\u0441\u043e\u0432 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d2e\/747\/ed6\/d2e747ed64b2d721ab41e2546603bd1f.svg\" alt=\"$\\begin{array}{rcl} w_0^{(t+1)} = w_0^{(t)} + \\eta (y_i - w_0^{(t)} - w_1^{(t)}x_i) \\\\ w_1^{(t+1)} = w_1^{(t)} + \\eta (y_i - w_0^{(t)} - w_1^{(t)}x_i)x_i \\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043d\u0430\u0438\u0441\u043a\u043e\u0440\u0435\u0439\u0448\u0435\u0433\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0430\u0440\u0443 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u043c \u0441\u043f\u0443\u0441\u043a\u0435. \u0417\u0430\u0442\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u0432\u0435\u0441\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e. <\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u042d\u043d\u0434\u0440\u044e \u042b\u043d\u0430 \u0438\u0437 \u0435\u0433\u043e <a href=\"https:\/\/www.coursera.org\/learn\/machine-learning\">\u043a\u0443\u0440\u0441\u0430<\/a> \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f8d\/90c\/f83\/f8d90cf83b044255bb07df3373f25fc7.png\" \/><\/div>\n<p>  <\/p>\n<p>\u041d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u044b \u043b\u0438\u043d\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0449\u0435\u043c. \u041a\u0440\u0430\u0441\u043d\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432 (\u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6c4\/480\/fbb\/6c4480fbb4777d706449f21f16740d6f.svg\" alt=\"$\\theta_0$\" data-tex=\"inline\"\/><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a60\/175\/2df\/a601752df129e055b765619ae4e5a9d7.svg\" alt=\"$\\theta_1$\" data-tex=\"inline\"\/><\/math> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0442 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5ec\/533\/acf\/5ec533acf0f35024d8036be9294167b9.svg\" alt=\"$w_0$\" data-tex=\"inline\"\/><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5e4\/53c\/877\/5e453c8778a25353c0008f94d9710d02.svg\" alt=\"$w_1$\" data-tex=\"inline\"\/><\/math> \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435). \u041f\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u043f\u0435\u043d\u0434\u0438\u043a\u0443\u043b\u044f\u0440\u043d\u043e \u043b\u0438\u043d\u0438\u044f\u043c \u0443\u0440\u043e\u0432\u043d\u044f. \u041f\u0440\u0438 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0441\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e, \u043f\u043e\u0440\u043e\u0439 \u0434\u0430\u0436\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0448\u0430\u0433\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b \u2013 \u0443\u0432\u043e\u0434\u044f\u0442 \u043e\u0442 \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430, \u043d\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043e\u0431\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0421\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u0445\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u0447\u0442\u043e \u0438 \u0443 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u0444\u0430\u043a\u0442\u043e\u0432, \u0434\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0421\u0435\u0439\u0447\u0430\u0441 \u0432 \u044d\u043f\u043e\u0445\u0443 Deep Data \u0438 Big Learning \u0447\u0430\u0449\u0435 \u0434\u0430\u0436\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u043c \u0441\u043f\u0443\u0441\u043a\u043e\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e.<\/p>\n<p>  <\/p>\n<h2 id=\"onlayn-podhod-k-obucheniyu\">\u041e\u043d\u043b\u0430\u0439\u043d-\u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e<\/h2>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a, \u0431\u0443\u0434\u0443\u0447\u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0434\u0430\u0435\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445 \u2013 \u0434\u043e \u0441\u043e\u0442\u0435\u043d \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442 (\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u043c\u0435\u044e\u0449\u0435\u0439\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u0438).<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0430\u0440\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/31c\/e63\/b2d\/31ce63b2df8c7e64972a82ab0849a9de.svg\" alt=\"$(X,y)$\" data-tex=\"inline\"\/><\/math> \u0438, \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044f \u0435\u0435 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c (\u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f), \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0432\u0435\u0441\u0430:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d2e\/747\/ed6\/d2e747ed64b2d721ab41e2546603bd1f.svg\" alt=\"$\\begin{array}{rcl} w_0^{(t+1)} = w_0^{(t)} + \\eta (y_i - w_0^{(t)} - w_1^{(t)}x_i) \\\\ w_1^{(t+1)} = w_1^{(t)} + \\eta (y_i - w_0^{(t)} - w_1^{(t)}x_i)x_i \\end{array}$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c (\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0438\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u2013 \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438) \u0441\u043d\u0438\u0437\u0438\u0442\u0441\u044f, \u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043d\u0438\u0437\u0438\u043b\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. <\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043e\u043d\u043b\u0430\u0439\u043d-\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c, \u0442\u0435\u0440\u043c\u0438\u043d \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0435\u0449\u0435 \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a MOOC-\u0438 \u0441\u0442\u0430\u043b\u0438 \u043c\u044d\u0439\u043d\u0441\u0442\u0440\u0438\u043c\u043e\u043c.<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/fec\/fc5\/e6c\/fecfc5e6c6b34feeafe6f66cd1622aaa.jpg\" width=\"50%\" \/><\/div>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u043c\u043d\u043e\u0433\u0438\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 (\u0432\u043e\u0442 \u0445\u043e\u0440\u043e\u0448\u0430\u044f <a href=\"https:\/\/habrahabr.ru\/post\/318970\/\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043a\u043d\u0438\u0433\u0435 Boyd &quot;Convex Optimization&quot;), \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0441\u043a\u043e\u0440\u0435\u0435 \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Vowpal Wabbit, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0440\u044e\u043a\u0430 \u2013 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <code>Scikit-learn<\/code> \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u044b, \u043e\u0431\u0443\u0447\u0430\u0435\u043c\u044b\u0435 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u043c \u0441\u043f\u0443\u0441\u043a\u043e\u043c, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 <code>SGDClassifier<\/code> \u0438 <code>SGDRegressor<\/code> \u0438\u0437 <code>sklearn.linear_model<\/code>. \u0427\u0430\u0441\u0442\u044c\u044e \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0438\u0445 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432.<\/p>\n<p>  <\/p>\n<h1 id=\"rabota-s-kategorialnymi-priznakami-label-encoding-one-hot-encoding-hashing-trick\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438: Label Encoding, One-Hot Encoding, Hashing trick<\/h1>\n<p>  <\/p>\n<h2 id=\"label-encoding\">Label Encoding<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 \u0435\u0432\u043a\u043b\u0438\u0434\u043e\u0432\u044b\u0445 \u0438\u043b\u0438 \u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u0438\u0434\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435 \u0442\u0430\u043a \u0440\u0435\u0434\u043a\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0434\u0430\/\u043d\u0435\u0442 \u0438\u043b\u0438 \u044f\u043d\u0432\u0430\u0440\u044c\/\u0444\u0435\u0432\u0440\u0430\u043b\u044c\/&#8230;\/\u0434\u0435\u043a\u0430\u0431\u0440\u044c. \u041e\u0431\u0441\u0443\u0434\u0438\u043c \u0442\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0438 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043c\u043d\u043e\u0433\u043e, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0443\u0447\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. <\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 UCI bank, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u2013 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import warnings warnings.filterwarnings('ignore') import os import re import numpy as np import pandas as pd  from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import classification_report, accuracy_score from sklearn.metrics import roc_auc_score, roc_curve, confusion_matrix from sklearn.preprocessing import LabelEncoder, OneHotEncoder from sklearn.datasets import fetch_20newsgroups, load_files  import pandas as pd from scipy.sparse import csr_matrix import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns  df = pd.read_csv('..\/..\/data\/bank_train.csv') labels = pd.read_csv('..\/..\/data\/bank_train_target.csv', header=None)  df.head()<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d8a\/8e8\/5fc\/d8a8e85fc1c94e77ab3d30f6ea0f91d9.png\" \/><\/div>\n<p>  <\/p>\n<p>\u041d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0447\u0438\u0441\u043b\u0430\u043c\u0438. \u0412 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u0449\u0435 \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u2014 \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043d\u0430\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a education:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \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\">df['education'].value_counts().plot.barh();<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/29a\/2c2\/e0a\/29a2c2e0ae7c4e159c24339660f67126.png\" \/><\/div>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c <code>university.degree<\/code> \u0432 0, \u0430 <code>basic.9y<\/code> \u0432 1. \u042d\u0442\u0443 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>preprocessing<\/code> \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <code>sklearn<\/code> \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043a\u043b\u0430\u0441\u0441 <code>LabelEncoder<\/code>:<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>fit<\/code> \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0442\u0440\u043e\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443, \u0430 \u043c\u0435\u0442\u043e\u0434 <code>transform<\/code> \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0447\u0438\u0441\u043b\u0430. \u041f\u043e\u0441\u043b\u0435 <code>fit<\/code> \u0443 <code>label_encoder<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e\u043b\u0435 <code>classes_<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0432\u0441\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0438\u0445 \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0432\u0435\u0440\u043d\u043e. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f LabelEncoder<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">label_encoder = LabelEncoder()  mapped_education = pd.Series(label_encoder.fit_transform(df['education'])) mapped_education.value_counts().plot.barh() print(dict(enumerate(label_encoder.classes_)))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>{0: 'basic.4y', 1: 'basic.6y', 2: 'basic.9y', 3: 'high.school', 4: 'illiterate', 5: 'professional.course', 6: 'university.degree', 7: 'unknown'}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/072\/fdf\/f2a\/072fdff2ae834d5b86812f77dc131bac.png\" \/><\/div>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438? LabelEncoder \u0440\u0443\u0433\u043d\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0443\u0433\u0430\u043d\u044c LabelEncoder<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">try:     label_encoder.transform(df['education'].replace('high.school', 'high_school')) except Exception as e:     print('Error:', e)<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Error: y contains new labels: ['high_school']<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041a \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0432\u0435\u0441\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 education \u043d\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439:<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/0c1\/984\/728\/0c19847283ea4f5f87ed5fb477103416.png\" \/><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u0442\u0438\u043f <code>object<\/code> \u2013 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0442\u0438\u043f \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432 pandas \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">categorical_columns = df.columns[df.dtypes == 'object'].union(['education']) for column in categorical_columns:     df[column] = label_encoder.fit_transform(df[column]) df.head()<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/838\/d89\/538\/838d89538aa0418eb3638b06e0ed9eb8.png\" \/><\/div>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u043a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043b \u0435\u0432\u043a\u043b\u0438\u0434\u043e\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043d\u0430\u043c\u0438 \u043d\u0435\u044f\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0431\u044b\u043b\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u0430 \u0430\u043b\u0433\u0435\u0431\u0440\u0430 \u043d\u0430\u0434 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u2013 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 1 \u0438\u0437 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0430 2. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430. \u041d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0431\u043b\u0438\u0437\u043e\u0441\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0430 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def logistic_regression_accuracy_on(dataframe, labels):     features = dataframe.as_matrix()     train_features, test_features, train_labels, test_labels = \\         train_test_split(features, labels)      logit = LogisticRegression()     logit.fit(train_features, train_labels)     return classification_report(test_labels, logit.predict(test_features))  print(logistic_regression_accuracy_on(df[categorical_columns], labels))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>             precision    recall  f1-score   support            0       0.89      1.00      0.94      6159           1       0.00      0.00      0.00       740  avg \/ total       0.80      0.89      0.84      6899<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f One-Hot Encoding<\/p>\n<p>  <\/p>\n<h2 id=\"one-hot-encoding\">One-Hot Encoding<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c 10 \u0440\u0430\u0437\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 one hot encoding \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 10 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0432\u0441\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e <em>\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e<\/em>. \u041d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u043c\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c 1.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 <code>sklearn.preprocessing<\/code> \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <code>OneHotEncoder<\/code>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <code>OneHotEncoder<\/code> \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u043b\u0435\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c &quot;\u043f\u043b\u043e\u0442\u043d\u043e\u0435&quot; \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">onehot_encoder = OneHotEncoder(sparse=False)  encoded_categorical_columns = pd.DataFrame(onehot_encoder.fit_transform(df[categorical_columns])) encoded_categorical_columns.head()<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e76\/076\/a59\/e76076a5978440ed80bec08ccd20e8e4.png\" \/><\/div>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 53 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u2014 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438. \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e One-Hot Encoding \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u2013 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0443 1 (\u043a\u0442\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b \u043a\u0440\u0435\u0434\u0438\u0442) \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 61%, \u043f\u043e\u043b\u043d\u043e\u0442\u0430) \u2013 17%. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">print(logistic_regression_accuracy_on(encoded_categorical_columns, labels))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>             precision    recall  f1-score   support            0       0.90      0.99      0.94      6126           1       0.61      0.17      0.27       773  avg \/ total       0.87      0.89      0.87      6899<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h2 id=\"heshirovanie-priznakov-hashing-trick\">\u0425\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (Hashing trick)<\/h2>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u044b\u043c\u0438, \u0438 \u043c\u044b \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u0441\u0435 \u044d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0436\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, <code>LabelEncoder<\/code> \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432\u0441\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a hashing trick. <\/p>\n<p>  <\/p>\n<p>\u0425\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u043c \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for s in ('university.degree', 'high.school', 'illiterate'):     print(s, '-&gt;', hash(s))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>university.degree -&gt; -5073140156977989958 high.school -&gt; -8439808450962279468 illiterate -&gt; -2719819637717010547<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0443\u0442. \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">hash_space = 25 for s in ('university.degree', 'high.school', 'illiterate'):     print(s, '-&gt;', hash(s) % hash_space)<\/code><\/pre>\n<p>  <\/p>\n<pre><code>university.degree -&gt; 17 high.school -&gt; 7 illiterate -&gt; 3<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u043b\u043e\u0441\u0442\u043e\u0439 \u0441\u0442\u0443\u0434\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u043b\u0438 \u0432 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a, \u0442\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e One-Hot Encoding, \u043d\u043e \u0432 \u0435\u0434\u0438\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">hashing_example = pd.DataFrame([{i: 0.0 for i in range(hash_space)}]) for s in ('job=student', 'marital=single', 'day_of_week=mon'):     print(s, '-&gt;', hash(s) % hash_space)     hashing_example.loc[0, hash(s) % hash_space] = 1 hashing_example<\/code><\/pre>\n<p>  <\/p>\n<pre><code>job=student -&gt; 6 marital=single -&gt; 8 day_of_week=mon -&gt; 16<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0430 \u043f\u0430\u0440\u044b <strong>\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 + \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430<\/strong>. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">assert hash('no') == hash('no') assert hash('housing=no') != hash('loan=no')<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u0435\u0442 \u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u044f \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439? \u041d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0435\u0434\u043a\u043e, \u043d\u043e \u0434\u0430\u0436\u0435 \u0432 \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u044d\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0443\u0445\u0443\u0434\u0448\u0435\u043d\u0438\u044e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/32e\/2e8\/fbe\/32e2e8fbe012461b8791c26feb703edf.jpg\"  width=\"70%\"\/><\/div>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435: &quot;\u0430 \u0447\u0442\u043e \u0437\u0430 \u0445\u0440\u0435\u043d\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442?&quot;, \u0438 \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u0438 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442 \u0437\u0434\u0440\u0430\u0432\u044b\u0439 \u0441\u043c\u044b\u0441\u043b. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u044d\u0442\u0430 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u2013 \u043f\u043e \u0441\u0443\u0442\u0438, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u0430 \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u0441\u0435\u0431\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u0430 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043f\u0440\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 (learning to hash) \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/arxiv.org\/abs\/1509.05472\">\u044d\u0442\u043e\u043c<\/a> \u043e\u0431\u0437\u043e\u0440\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 <a href=\"https:\/\/github.com\/esokolov\/ml-course-hse\/blob\/master\/2016-fall\/lecture-notes\/lecture06-linclass.pdf\">\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445<\/a> \u0415\u0432\u0433\u0435\u043d\u0438\u044f \u0421\u043e\u043a\u043e\u043b\u043e\u0432\u0430.<\/p>\n<p>  <\/p>\n<h1 id=\"biblioteka-vowpal-wabbit\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Vowpal Wabbit<\/h1>\n<p>  <\/p>\n<p>Vowpal Wabbit (VW) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438. \u0415\u0451 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u0441\u043e\u0431\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u043d\u043b\u0430\u0439\u043d-\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u2013 \u0441\u0430\u043c\u0430\u044f \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0438 Vowpal Wabbit \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 VW \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f shell. Vowpal Wabbit \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 (stdin) \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<p><code>[Label] [Importance] [Tag]|Namespace Features |Namespace Features ... |Namespace Features<\/code><\/p>\n<p>  <\/p>\n<p><code>Namespace=String[:Value]<\/code><\/p>\n<p>  <\/p>\n<p><code>Features=(String[:Value] )*<\/code><\/p>\n<p>  <\/p>\n<p>\u0433\u0434\u0435 [] \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0430 (&#8230;)* \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0437. <\/p>\n<p>  <\/p>\n<ul>\n<li><strong>Label<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e\u043c, &quot;\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c&quot; \u043e\u0442\u0432\u0435\u0442\u043e\u043c. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1\/-1, \u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/li>\n<li><strong>Importance<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e\u043c \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u0435\u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043d\u0435\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0437\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u0440\u0430\u043d\u0435\u0435<\/li>\n<li><strong>Tag<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 &quot;\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435&quot; \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c Tag \u043e\u0442 Importance \u043b\u0443\u0447\u0448\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c Tag \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 &#8216;.<\/li>\n<li><strong>Namespace<\/strong> \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u0412 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 Namespace \u0438\u043c\u0435\u043d\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u0439 \u0431\u0443\u043a\u0432\u0435, \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439<\/li>\n<li><strong>Features<\/strong> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 <strong>Namespace<\/strong>. \u041f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043c\u0435\u044e\u0442 \u0432\u0435\u0441 1.0, \u043d\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 feature:0.1. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u043e\u0434 \u0442\u0430\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code>1 1.0 |Subject WHAT car is this |Organization University of Maryland:0.5 College Park<\/code><\/pre>\n<p>  <\/p>\n<p>VW \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0423\u0431\u0435\u0434\u0438\u043c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0438 20newsgroups, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u043d\u043e\u0432\u043e\u0441\u0442\u0438 \u0438\u0437 20 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0440\u0430\u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<p>  <\/p>\n<h2 id=\"novosti-binarnaya-klassifikaciya\">\u041d\u043e\u0432\u043e\u0441\u0442\u0438. \u0411\u0438\u043d\u0430\u0440\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<pre><code class=\"python\">newsgroups = fetch_20newsgroups('..\/..\/data\/news_data')<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u043e\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 20 \u0442\u0435\u043c: alt.atheism, comp.graphics, comp.os.ms-windows.misc, comp.sys.ibm.pc.hardware, comp.sys.mac.hardware, comp.windows.x, misc.forsalerec.autos, rec.motorcycles, rec.sport.baseball, rec.sport.hockey, sci.crypt, sci.electronics, sci.med, sci.space, soc.religion.christian, talk.politics.guns, talk.politics.mideast, talk.politics.misc, talk.religion.misc.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u044d\u0442\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">text = newsgroups['data'][0] target = newsgroups['target_names'][newsgroups['target'][0]]  print('-----') print(target) print('-----') print(text.strip()) print('----')<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<pre><code>----- rec.autos ----- From: lerxst@wam.umd.edu (where's my thing) Subject: WHAT car is this!? Nntp-Posting-Host: rac3.wam.umd.edu Organization: University of Maryland, College Park Lines: 15   I was wondering if anyone out there could enlighten me on this car I saw the other day. It was a 2-door sports car, looked to be from the late 60s\/ early 70s. It was called a Bricklin. The doors were really small. In addition, the front bumper was separate from the rest of the body. This is  all I know. If anyone can tellme a model name, engine specs, years of production, where this car is made, history, or whatever info you have on this funky looking car, please e-mail.  Thanks, - IL    ---- brought to you by your neighborhood Lerxst ---- ----<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0443 Vowpal Wabbit, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0432\u0430 \u043d\u0435 \u043a\u043e\u0440\u043e\u0447\u0435 3 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b (\u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0438 \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044e), \u043d\u043e, \u043a\u0430\u043a \u0443\u0432\u0438\u0434\u0438\u043c, \u0437\u0430\u0434\u0430\u0447\u0430 \u0438 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def to_vw_format(document, label=None):     return str(label or '') + ' |text ' + ' '.join(re.findall('\\w{3,}', document.lower())) + '\\n'  to_vw_format(text, 1 if target == 'rec.autos' else -1)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<pre><code>'1 |text from lerxst wam umd edu where thing subject what car this nntp posting host rac3 wam umd edu organization university maryland college park lines was wondering anyone out there could enlighten this car saw the other day was door sports car looked from the late 60s early 70s was called bricklin the doors were really small addition the front bumper was separate from the rest the body this all know anyone can tellme model name engine specs years production where this car made history whatever info you have this funky looking car please mail thanks brought you your neighborhood lerxst\\n'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b. \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u043e\u043d \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0435 \u043f\u0440\u043e \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438 <em>rec.autos<\/em>. \u0422\u0430\u043a \u043c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0443\u044e \u043d\u043e\u0432\u043e\u0441\u0442\u0438 \u043f\u0440\u043e \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438 \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">all_documents = newsgroups['data'] all_targets = [1 if newsgroups['target_names'][target] == 'rec.autos'                 else -1 for target in newsgroups['target']]<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">train_documents, test_documents, train_labels, test_labels = \\     train_test_split(all_documents, all_targets, random_state=7)  with open('..\/..\/data\/news_data\/20news_train.vw', 'w') as vw_train_data:     for text, target in zip(train_documents, train_labels):         vw_train_data.write(to_vw_format(text, target)) with open('..\/..\/data\/news_data\/20news_test.vw', 'w') as vw_test_data:     for text in test_documents:         vw_test_data.write(to_vw_format(text))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Vowpal Wabbit \u043d\u0430 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u041c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0442\u0435\u0440\u044c \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 hinge (\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 SVM). \u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b <code>20news_model.vw<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">!vw -d ..\/..\/data\/news_data\/20news_train.vw \\   --loss_function hinge -f ..\/..\/data\/news_data\/20news_model.vw<\/code><\/pre>\n<p>  <\/p>\n<pre><code>final_regressor = ..\/..\/data\/news_data\/20news_model.vw Num weight bits = 18 learning rate = 0.5 initial_t = 0 power_t = 0.5 using no cache Reading datafile = ..\/..\/data\/news_data\/20news_train.vw num sources = 1 average  since         example        example  current  current  current loss     last          counter         weight    label  predict features 1.000000 1.000000            1            1.0  -1.0000   0.0000      157 0.911276 0.822551            2            2.0  -1.0000  -0.1774      159 0.605793 0.300311            4            4.0  -1.0000  -0.3994       92 0.419594 0.233394            8            8.0  -1.0000  -0.8167      129 0.313998 0.208402           16           16.0  -1.0000  -0.6509      108 0.196014 0.078029           32           32.0  -1.0000  -1.0000      115 0.183158 0.170302           64           64.0  -1.0000  -0.7072      114 0.261046 0.338935          128          128.0   1.0000  -0.7900      110 0.262910 0.264774          256          256.0  -1.0000  -0.6425       44 0.216663 0.170415          512          512.0  -1.0000  -1.0000      160 0.176710 0.136757         1024         1024.0  -1.0000  -1.0000      194 0.134541 0.092371         2048         2048.0  -1.0000  -1.0000      438 0.104403 0.074266         4096         4096.0  -1.0000  -1.0000      644 0.081329 0.058255         8192         8192.0  -1.0000  -1.0000      174  finished run number of examples per pass = 8485 passes used = 1 weighted example sum = 8485.000000 weighted label sum = -7555.000000 average loss = 0.079837 best constant = -1.000000 best constant's loss = 0.109605 total feature number = 2048932<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0430. VW \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u0445\u043e\u0434\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (\u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0433\u0430\u0441\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8212;quiet). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432\u044b\u0432\u043e\u0434 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0439\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 VW \u043d\u0430 GitHub \u2013 <a href=\"https:\/\/github.com\/JohnLangford\/vowpal_wabbit\/wiki\/Tutorial#vws-diagnostic-information\">\u0442\u0443\u0442<\/a>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e average loss \u0441\u043d\u0438\u0436\u0430\u043b\u0441\u044f \u043f\u043e \u0445\u043e\u0434\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c VW \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u044d\u0442\u0430 \u043e\u0446\u0435\u043d\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432 \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0446\u0438\u0438 -p: <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">!vw -i ..\/..\/data\/news_data\/20news_model.vw -t -d ..\/..\/data\/news_data\/20news_test.vw \\ -p ..\/..\/data\/news_data\/20news_test_predictions.txt<\/code><\/pre>\n<p>  <\/p>\n<pre><code>only testing predictions = ..\/..\/data\/news_data\/20news_test_predictions.txt Num weight bits = 18 learning rate = 0.5 initial_t = 0 power_t = 0.5 using no cache Reading datafile = ..\/..\/data\/news_data\/20news_test.vw num sources = 1 average  since         example        example  current  current  current loss     last          counter         weight    label  predict features 0.000000 0.000000            1            1.0  unknown   1.0000      349 0.000000 0.000000            2            2.0  unknown  -1.0000       50 0.000000 0.000000            4            4.0  unknown  -1.0000      251 0.000000 0.000000            8            8.0  unknown  -1.0000      237 0.000000 0.000000           16           16.0  unknown  -0.8978      106 0.000000 0.000000           32           32.0  unknown  -1.0000      964 0.000000 0.000000           64           64.0  unknown  -1.0000      261 0.000000 0.000000          128          128.0  unknown   0.4621       82 0.000000 0.000000          256          256.0  unknown  -1.0000      186 0.000000 0.000000          512          512.0  unknown  -1.0000      162 0.000000 0.000000         1024         1024.0  unknown  -1.0000      283 0.000000 0.000000         2048         2048.0  unknown  -1.0000      104  finished run number of examples per pass = 2829 passes used = 1 weighted example sum = 2829.000000 weighted label sum = 0.000000 average loss = 0.000000 total feature number = 642215<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f, \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c AUC \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c ROC-\u043a\u0440\u0438\u0432\u0443\u044e:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">with open('..\/..\/data\/news_data\/20news_test_predictions.txt') as pred_file:     test_prediction = [float(label)                               for label in pred_file.readlines()]  auc = roc_auc_score(test_labels, test_prediction) roc_curve = roc_curve(test_labels, test_prediction)  with plt.xkcd():     plt.plot(roc_curve[0], roc_curve[1]);     plt.plot([0,1], [0,1])     plt.xlabel('FPR'); plt.ylabel('TPR'); plt.title('test AUC = %f' % (auc)); plt.axis([-0.05,1.05,-0.05,1.05]);<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2e4\/5a1\/978\/2e45a19788954d6eaee4c5a4c44272c2.png\" \/><\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f AUC \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<h1 id=\"novosti-mnogoklassovaya-klassifikaciya\">\u041d\u043e\u0432\u043e\u0441\u0442\u0438. \u041c\u043d\u043e\u0433\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h1>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0443 \u0436\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0443, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043d\u043e \u0440\u0435\u0448\u0430\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043d\u043e\u0433\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0422\u0443\u0442 <code>Vowpal Wabbit<\/code> \u0441\u043b\u0435\u0433\u043a\u0430 \u043a\u0430\u043f\u0440\u0438\u0437\u043d\u0438\u0447\u0430\u0435\u0442 \u2013 \u043e\u043d \u043b\u044e\u0431\u0438\u0442, \u0447\u0442\u043e\u0431 \u043c\u0435\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u0442 1 \u0434\u043e K, \u0433\u0434\u0435 K \u2013 \u0447\u0438\u0441\u043b\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2013 20). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c LabelEncoder, \u0434\u0430 \u0435\u0449\u0435 \u0438 +1 \u043f\u043e\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c (<code>LabelEncoder<\/code> \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u043c\u0435\u0442\u043a\u0438 \u0432 \u0434\u0438\u0430\u043f\u043e\u0437\u043e\u043d \u043e\u0442 0 \u0434\u043e K-1).<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">all_documents = newsgroups['data'] topic_encoder = LabelEncoder() all_targets_mult = topic_encoder.fit_transform(newsgroups['target']) + 1<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412\u044b\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0442\u0435 \u0436\u0435, \u0430 \u043c\u0435\u0442\u043a\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, <code>train_labels_mult<\/code> \u0438 <code>test_labels_mult<\/code> \u2013 \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u043c\u0435\u0442\u043e\u043a \u043e\u0442 1 \u0434\u043e 20.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">train_documents, test_documents, train_labels_mult, test_labels_mult = \\     train_test_split(all_documents, all_targets_mult, random_state=7)  with open('..\/..\/data\/news_data\/20news_train_mult.vw', 'w') as vw_train_data:     for text, target in zip(train_documents, train_labels_mult):         vw_train_data.write(to_vw_format(text, target)) with open('..\/..\/data\/news_data\/20news_test_mult.vw', 'w') as vw_test_data:     for text in test_documents:         vw_test_data.write(to_vw_format(text))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041e\u0431\u0443\u0447\u0438\u043c Vowpal Wabbit \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043c\u043d\u043e\u0433\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>oaa<\/code> (\u043e\u0442 &quot;one against all&quot;), \u0440\u0430\u0432\u043d\u044b\u0439 \u0447\u0438\u0441\u043b\u0443 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u0438 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c (\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u043e \u2013 \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c <a href=\"https:\/\/github.com\/JohnLangford\/vowpal_wabbit\/wiki\/Tutorial\">\u0442\u044c\u044e\u0442\u043e\u0440\u0438\u0430\u043b\u0435<\/a> \u043f\u043e Vowpal Wabbit):<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0442\u0435\u043c\u043f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (-l, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0.5) \u2013 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438<\/li>\n<li>\u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (&#8212;power_t, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0.5) \u2013 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0442\u0435\u043c\u043f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0447\u0438\u0441\u043b\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430, \u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 <\/li>\n<li>\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c (&#8212;loss_function) \u2013 \u043e\u0442 \u043d\u0435\u0435, \u043f\u043e \u0441\u0443\u0442\u0438, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0431\u0443\u0447\u0430\u0435\u043c\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041f\u0440\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u0432 <a href=\"https:\/\/github.com\/JohnLangford\/vowpal_wabbit\/wiki\/Loss-functions\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a><\/li>\n<li>\n<p>\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044f (-l1) \u2013 \u0442\u0443\u0442 \u043d\u0430\u0434\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432 VW \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u043c\u0430\u043b\u044b\u043c\u0438, \u043e\u043a\u043e\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2ff\/785\/3bf\/2ff7853bfc65733729fd5003091b23b8.svg\" alt=\"$10^{-20}.$\" data-tex=\"inline\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 Vowpal Wabbit \u0441 Hyperopt. \u041f\u043e\u043a\u0430 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 Python 2. <a href=\"https:\/\/habrahabr.ru\/company\/dca\/blog\/272697\/\">\u0421\u0442\u0430\u0442\u044c\u044f<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">%%time !vw --oaa 20 ..\/..\/data\/news_data\/20news_train_mult.vw \\ -f ..\/..\/data\/news_data\/20news_model_mult.vw --loss_function=hinge<\/code><\/pre>\n<p>  <\/p>\n<pre><code>final_regressor = ..\/..\/data\/news_data\/20news_model_mult.vw Num weight bits = 18 learning rate = 0.5 initial_t = 0 power_t = 0.5 using no cache Reading datafile = ..\/..\/data\/news_data\/20news_train_mult.vw num sources = 1 average  since         example        example  current  current  current loss     last          counter         weight    label  predict features 1.000000 1.000000            1            1.0       15        1      157 1.000000 1.000000            2            2.0        2       15      159 1.000000 1.000000            4            4.0       15       10       92 1.000000 1.000000            8            8.0       16       15      129 1.000000 1.000000           16           16.0       13       12      108 0.937500 0.875000           32           32.0        2        9      115 0.906250 0.875000           64           64.0       16       16      114 0.867188 0.828125          128          128.0        8        4      110 0.816406 0.765625          256          256.0        7       15       44 0.646484 0.476562          512          512.0       13        9      160 0.502930 0.359375         1024         1024.0        3        4      194 0.388672 0.274414         2048         2048.0        1        1      438 0.300293 0.211914         4096         4096.0       11       11      644 0.225098 0.149902         8192         8192.0        5        5      174  finished run number of examples per pass = 8485 passes used = 1 weighted example sum = 8485.000000 weighted label sum = 0.000000 average loss = 0.222392 total feature number = 2048932 CPU times: user 7.97 ms, sys: 13.9 ms, total: 21.9 ms Wall time: 378 ms<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">%%time !vw -i ..\/..\/data\/news_data\/20news_model_mult.vw -t \\ -d ..\/..\/data\/news_data\/20news_test_mult.vw \\ -p ..\/..\/data\/news_data\/20news_test_predictions_mult.txt<\/code><\/pre>\n<p>  <\/p>\n<pre><code>only testing predictions = ..\/..\/data\/news_data\/20news_test_predictions_mult.txt Num weight bits = 18 learning rate = 0.5 initial_t = 0 power_t = 0.5 using no cache Reading datafile = ..\/..\/data\/news_data\/20news_test_mult.vw num sources = 1 average  since         example        example  current  current  current loss     last          counter         weight    label  predict features 1.000000 1.000000            1            1.0  unknown        8      349 1.000000 1.000000            2            2.0  unknown        6       50 1.000000 1.000000            4            4.0  unknown       18      251 1.000000 1.000000            8            8.0  unknown       18      237 1.000000 1.000000           16           16.0  unknown        4      106 1.000000 1.000000           32           32.0  unknown       15      964 1.000000 1.000000           64           64.0  unknown        4      261 1.000000 1.000000          128          128.0  unknown        8       82 1.000000 1.000000          256          256.0  unknown       10      186 1.000000 1.000000          512          512.0  unknown        1      162 1.000000 1.000000         1024         1024.0  unknown       11      283 1.000000 1.000000         2048         2048.0  unknown       14      104  finished run number of examples per pass = 2829 passes used = 1 weighted example sum = 2829.000000 weighted label sum = 0.000000 average loss = 1.000000 total feature number = 642215 CPU times: user 4.28 ms, sys: 9.65 ms, total: 13.9 ms Wall time: 166 ms<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">with open('..\/..\/data\/news_data\/20news_test_predictions_mult.txt') as pred_file:     test_prediction_mult = [float(label)                              for label in pred_file.readlines()]<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">accuracy_score(test_labels_mult, test_prediction_mult)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043e\u043b\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u043a\u043e\u043b\u043e 87%.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0440\u0435\u0437\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u0442\u0435\u043c\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0443\u0442\u0430\u0435\u0442 \u0430\u0442\u0435\u0438\u0437\u043c.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">M = confusion_matrix(test_labels_mult, test_prediction_mult) for i in np.where(M[0,:] &gt; 0)[0][1:]:     print(newsgroups['target_names'][i], M[0,i], )<\/code><\/pre>\n<p>  <\/p>\n<pre><code>rec.autos 1 rec.sport.baseball 1 sci.med 1 soc.religion.christian 3 talk.religion.misc 5<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u0442\u0435\u043c\u044b: rec.autos, rec.sport.baseball, sci.med, soc.religion.christian \u0438 talk.religion.misc.<\/p>\n<p>  <\/p>\n<h1 id=\"recenzii-k-filmam-imdb\">\u0420\u0435\u0446\u0435\u043d\u0437\u0438\u0438 \u043a \u0444\u0438\u043b\u044c\u043c\u0430\u043c IMDB<\/h1>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043e\u0442\u0437\u044b\u0432\u043e\u0432 \u043a \u0444\u0438\u043b\u044c\u043c\u0430\u043c, \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 IMDB. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c Vowpal Wabbit.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>load_files<\/code> \u0438\u0437 <code>sklearn.datasets<\/code> \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442\u0437\u044b\u0432\u043e\u0432 \u043f\u043e \u0444\u0438\u043b\u044c\u043c\u0430\u043c <a href=\"https:\/\/yadi.sk\/d\/Tg1Tflur333iLr\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>. \u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0441\u0432\u043e\u0439 \u043f\u0443\u0442\u044c \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 <code>imdb_reviews<\/code> (\u0432 \u043d\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 <em>train<\/em> \u0438 <em>test<\/em>). \u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442 \u2013 \u0442\u0430\u043c 100 \u0442\u044b\u0441. \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445 \u043f\u043e 12500 \u0442\u044b\u0441\u044f\u0447 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0438 \u043f\u043b\u043e\u0445\u0438\u0445 \u043e\u0442\u0437\u044b\u0432\u043e\u0432 \u043a \u0444\u0438\u043b\u044c\u043c\u0430\u043c. \u041e\u0442\u0434\u0435\u043b\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 (\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0435\u043a\u0441\u0442\u044b) \u043e\u0442 \u043c\u0435\u0442\u043e\u043a.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043f\u043e\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u043d\u0430 \u0441\u0432\u043e\u0439 \u043f\u0443\u0442\u044c path_to_movies = '\/Users\/y.kashnitsky\/Yandex.Disk.localized\/ML\/data\/imdb_reviews\/' reviews_train = load_files(os.path.join(path_to_movies, 'train')) text_train, y_train = reviews_train.data, reviews_train.target<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">print(&quot;Number of documents in training data: %d&quot; % len(text_train)) print(np.bincount(y_train))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Number of documents in training data: 25000 [12500 12500]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u043e\u0439.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">reviews_test = load_files(os.path.join(path_to_movies, 'test')) text_test, y_test = reviews_test.data, reviews_train.target print(&quot;Number of documents in test data: %d&quot; % len(text_test)) print(np.bincount(y_test))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Number of documents in test data: 25000 [12500 12500]<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043e\u0442\u0437\u044b\u0432\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code>&quot;Zero Day leads you to think, even re-think why two boys\/young men would do what they did - commit mutual suicide via slaughtering their classmates. It captures what must be beyond a bizarre mode of being for two humans who have decided to withdraw from common civility in order to define their own\/mutual world via coupled destruction.&lt;br \/&gt;&lt;br \/&gt;It is not a perfect movie but given what money\/time the filmmaker and actors had - it is a remarkable product. In terms of explaining the motives and actions of the two young suicide\/murderers it is better than 'Elephant' - in terms of being a film that gets under our 'rationalistic' skin it is a far, far better film than almost anything you are likely to see. &lt;br \/&gt;&lt;br \/&gt;Flawed but honest with a terrible honesty.&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043e\u0442\u0437\u044b\u0432. \u0410 \u0432\u043e\u0442 \u043f\u043b\u043e\u0445\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code>'Words can\\'t describe how bad this movie is. I can\\'t explain it by writing only. You have too see it for yourself to get at grip of how horrible a movie really can be. Not that I recommend you to do that. There are so many clich\\xc3\\xa9s, mistakes (and all other negative things you can imagine) here that will just make you cry. To start with the technical first, there are a LOT of mistakes regarding the airplane. I won\\'t list them here, but just mention the coloring of the plane. They didn\\'t even manage to show an airliner in the colors of a fictional airline, but instead used a 747 painted in the original Boeing livery. Very bad. The plot is stupid and has been done many times before, only much, much better. There are so many ridiculous moments here that i lost count of it really early. Also, I was on the bad guys\\' side all the time in the movie, because the good guys were so stupid. &quot;Executive Decision&quot; should without a doubt be you\\'re choice over this one, even the &quot;Turbulence&quot;-movies are better. In fact, every other movie in the world is better than this one.'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>to_vw_format<\/code>. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e (<code>movie_reviews_train.vw<\/code>), \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e (<code>movie_reviews_valid.vw<\/code>) \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e (<code>movie_reviews_test.vw<\/code>) \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u043b\u044f Vowpal Wabbit. 70% \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u0443\u0447\u0430\u044e\u0448\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435, 30% \u2013 \u043f\u043e\u0434 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">train_share = int(0.7 * len(text_train)) train, valid = text_train[:train_share], text_train[train_share:] train_labels, valid_labels = y_train[:train_share], y_train[train_share:]  with open('..\/..\/data\/movie_reviews_train.vw', 'w') as vw_train_data:     for text, target in zip(train, train_labels):         vw_train_data.write(to_vw_format(str(text), 1 if target == 1 else -1)) with open('..\/..\/data\/movie_reviews_valid.vw', 'w') as vw_train_data:     for text, target in zip(valid, valid_labels):         vw_train_data.write(to_vw_format(str(text), 1 if target == 1 else -1)) with open('..\/..\/data\/movie_reviews_test.vw', 'w') as vw_test_data:     for text in text_test:         vw_test_data.write(to_vw_format(str(text)))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041e\u0431\u0443\u0447\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c Vowpal Wabbit \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>-d, \u043f\u0443\u0442\u044c \u043a \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 (\u0441\u043e\u043e\u0442\u0432. \u0444\u0430\u0439\u043b .vw )<\/li>\n<li>&#8212;loss_function \u2013 hinge (\u0445\u043e\u0442\u044f \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438)<\/li>\n<li>-f \u2013 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c (\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u0436\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 .vw)<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"python\">!vw -d ..\/..\/data\/movie_reviews_train.vw \\ --loss_function hinge -f movie_reviews_model.vw --quiet<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u043d\u043e\u0437 \u0434\u043b\u044f \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 Vowpal Wabbit, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>-i \u2013\u043f\u0443\u0442\u044c \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 (\u0441\u043e\u043e\u0442\u0432. \u0444\u0430\u0439\u043b .vw)<\/li>\n<li>-t -d \u2013 \u043f\u0443\u0442\u044c \u043a \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 (\u0441\u043e\u043e\u0442\u0432. \u0444\u0430\u0439\u043b .vw)<\/li>\n<li>-p \u2013 \u043f\u0443\u0442\u044c \u043a txt-\u0444\u0430\u0439\u043b\u0443, \u043a\u0443\u0434\u0430 \u0437\u0430\u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"python\">!vw -i movie_reviews_model.vw -t -d ..\/..\/data\/movie_reviews_valid.vw \\ -p movie_valid_pred.txt --quiet<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u043d\u043e\u0437 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043e\u043b\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438 ROC AUC. \u0423\u0447\u0442\u0435\u043c, \u0447\u0442\u043e VW \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u043a \u043a\u043b\u0430\u0441\u0441\u0443 +1. \u042d\u0442\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u0430 [-1, 1], \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (0 \u0438\u043b\u0438 1) \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c AUC 88.5% \u0438 \u0434\u043e\u043b\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u2013 94.2% \u0438 \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u0447\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u2013 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">with open('movie_valid_pred.txt') as pred_file:     valid_prediction = [float(label)                               for label in pred_file.readlines()] print(&quot;Accuracy: {}&quot;.format(round(accuracy_score(valid_labels,                 [int(pred_prob &gt; 0) for pred_prob in valid_prediction]), 3))) print(&quot;AUC: {}&quot;.format(round(roc_auc_score(valid_labels, valid_prediction), 3)))<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">!vw -i movie_reviews_model.vw -t -d ..\/..\/data\/movie_reviews_test.vw \\ -p movie_test_pred.txt --quiet<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">with open('movie_test_pred.txt') as pred_file:     test_prediction = [float(label)                               for label in pred_file.readlines()] print(&quot;Accuracy: {}&quot;.format(round(accuracy_score(y_test,                 [int(pred_prob &gt; 0) for pred_prob in test_prediction]), 3))) print(&quot;AUC: {}&quot;.format(round(roc_auc_score(y_test, test_prediction), 3)))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Accuracy: 0.88 AUC: 0.94<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0433\u0440\u0430\u043c\u043c. \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442\u0441\u044f \u2013 \u0434\u043e 89% AUC \u0438 95% \u0432\u0435\u0440\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">!vw -d ..\/..\/data\/movie_reviews_train.vw \\ --loss_function hinge --ngram 2 -f movie_reviews_model2.vw --quiet<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">!vw -i movie_reviews_model2.vw -t -d ..\/..\/data\/movie_reviews_valid.vw \\ -p movie_valid_pred2.txt --quiet<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">with open('movie_valid_pred2.txt') as pred_file:     valid_prediction = [float(label)                               for label in pred_file.readlines()] print(&quot;Accuracy: {}&quot;.format(round(accuracy_score(valid_labels,                 [int(pred_prob &gt; 0) for pred_prob in valid_prediction]), 3))) print(&quot;AUC: {}&quot;.format(round(roc_auc_score(valid_labels, valid_prediction), 3)))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Accuracy: 0.894 AUC: 0.954<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">!vw -i movie_reviews_model2.vw -t -d ..\/..\/data\/movie_reviews_test.vw \\ -p movie_test_pred2.txt --quiet<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">with open('movie_test_pred2.txt') as pred_file:     test_prediction2 = [float(label)                               for label in pred_file.readlines()] print(&quot;Accuracy: {}&quot;.format(round(accuracy_score(y_test,                 [int(pred_prob &gt; 0) for pred_prob in test_prediction2]), 3))) print(&quot;AUC: {}&quot;.format(round(roc_auc_score(y_test, test_prediction2), 3)))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Accuracy: 0.888 AUC: 0.952<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h2 id=\"klassifikaciya-voprosov-na-stackoverflow\">\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 StackOverflow<\/h2>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Vowpal Wabbit \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c\u0438. \u0418\u043c\u0435\u044e\u0442\u0441\u044f 10 \u0413\u0431 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e StackOverflow \u2013 <a href=\"https:\/\/yadi.sk\/d\/krikdUic3Ggjyf\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0430\u043c \u0430\u043a\u043a\u0443\u0440\u0430\u0442 10 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0433\u043e\u0432. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0438\u0441\u0442\u044b\u0435, \u0438 \u043d\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u0431\u0438\u0433\u0434\u0430\u0442\u043e\u0439 \u0434\u0430\u0436\u0435 \u0432 \u043f\u0430\u0431\u0435.<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/94f\/314\/7e1\/94f3147e107c45dc80a42d29cf6d0e6e.jpg\"  width=\"50%\"\/><\/div>\n<p>  <\/p>\n<p>\u0418\u0437 \u0432\u0441\u0435\u0445 \u0442\u0435\u0433\u043e\u0432 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b 10, \u0438 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 10 \u043a\u043b\u0430\u0441\u0441\u043e\u0432: \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 10 \u0442\u0435\u0433\u043e\u0432, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 10 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u0430\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0434\u0430\u044e\u0442\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0445 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u043e\u0431\u044a\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043f\u043e\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u043f\u0443\u0442\u044c \u043a \u0434\u0430\u043d\u043d\u044b\u043c PATH_TO_DATA = '\/Users\/y.kashnitsky\/Documents\/Machine_learning\/org_mlcourse_open\/private\/stackoverflow_hw\/'  !du -hs $PATH_TO_DATA\/stackoverflow_10mln_*.vw<\/code><\/pre>\n<p>  <\/p>\n<pre><code>1,4G    \/Users\/y.kashnitsky\/Documents\/Machine_learning\/org_mlcourse_open\/private\/stackoverflow_hw\/\/stackoverflow_10mln_test.vw 3,3G    \/Users\/y.kashnitsky\/Documents\/Machine_learning\/org_mlcourse_open\/private\/stackoverflow_hw\/\/stackoverflow_10mln_train.vw 1,9G    \/Users\/y.kashnitsky\/Documents\/Machine_learning\/org_mlcourse_open\/private\/stackoverflow_hw\/\/stackoverflow_10mln_train_part.vw 1,4G    \/Users\/y.kashnitsky\/Documents\/Machine_learning\/org_mlcourse_open\/private\/stackoverflow_hw\/\/stackoverflow_10mln_valid.vw<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0443\u0447\u0430\u0442\u044c\u0441\u044f Vowpal Wabbit. 10 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 10 \u043a\u043b\u0430\u0441\u0441, \u0434\u0430\u043b\u0435\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0435\u0440\u0442\u0430 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0435\u043a\u0441\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u0430. <\/p>\n<p>  <\/p>\n<pre><code>10 | i ve got some code in window scroll that checks if an element is visible then triggers another function however only the first section of code is firing both bits of code work in and of themselves if i swap their order whichever is on top fires correctly my code is as follows fn isonscreen function use strict var win window viewport top win scrolltop left win scrollleft bounds this offset viewport right viewport left + win width viewport bottom viewport top + win height bounds right bounds left + this outerwidth bounds bottom bounds top + this outerheight return viewport right lt bounds left viewport left gt bounds right viewport bottom lt bounds top viewport top gt bounds bottom window scroll function use strict var load_more_results ajax load_more_results isonscreen if load_more_results true loadmoreresults var load_more_staff ajax load_more_staff isonscreen if load_more_staff true loadmorestaff what am i doing wrong can you only fire one event from window scroll i assume not<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0443\u0447\u0438\u043c \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 (3.3 \u0413\u0431) \u043c\u043e\u0434\u0435\u043b\u044c Vowpal Wabbit \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438: <\/p>\n<p>  <\/p>\n<ul>\n<li>-oaa 10 \u2013 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u0430 10 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 <\/li>\n<li>-d \u2013 \u043f\u0443\u0442\u044c \u043a \u0434\u0430\u043d\u043d\u044b\u043c <\/li>\n<li>-f \u2013 \u043f\u0443\u0442\u044c \u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 <\/li>\n<li>-b 28 \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c 28 \u0431\u0438\u0442 \u0434\u043b\u044f \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f4d\/8be\/b8f\/f4d8beb8f7490b8ad552e6c08fe77295.svg\" alt=\"$2^{28}$\" data-tex=\"inline\"\/><\/math> \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 (\u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0431\u0438- \u0438 \u0442\u0440\u0438\u0433\u0440\u0430\u043c\u043c\u044b, \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043d\u0430\u0447\u043d\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c)<\/li>\n<li>\u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c random seed<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 VW<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">%%time !vw --oaa 10 -d $PATH_TO_DATA\/stackoverflow_10mln_train.vw \\ -f vw_model1_10mln.vw -b 28 --random_seed 17 --quiet<\/code><\/pre>\n<p>  <\/p>\n<pre><code>CPU times: user 592 ms, sys: 220 ms, total: 813 ms Wall time: 39.9 s<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0432\u0441\u0435\u0433\u043e \u0437\u0430 40 \u0441\u0435\u043a\u0443\u043d\u0434, \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0430 \u0435\u0449\u0435 \u0437\u0430 14 \u0441\u0435\u043a\u0443\u043d\u0434, \u0434\u043e\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u2013 \u043f\u043e\u0447\u0442\u0438 92%. \u0414\u0430\u043b\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0442\u044c \u0437\u0430 \u0441\u0447\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0435, \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0433\u0440\u0430\u043c\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u042d\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0446\u0435\u043d\u043a\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 VW<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">%%time !vw -t -i vw_model1_10mln.vw \\ -d $PATH_TO_DATA\/stackoverflow_10mln_test.vw \\ -p vw_valid_10mln_pred1.csv --random_seed 17 --quiet<\/code><\/pre>\n<p>  <\/p>\n<pre><code>CPU times: user 198 ms, sys: 83.1 ms, total: 281 ms Wall time: 14.1 s<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">import os import numpy as np from sklearn.metrics import accuracy_score  vw_pred = np.loadtxt('vw_valid_10mln_pred1.csv') test_labels = np.loadtxt(os.path.join(PATH_TO_DATA,                                        'stackoverflow_10mln_test_labels.txt')) accuracy_score(test_labels, vw_pred)<\/code><\/pre>\n<p>  <\/p>\n<pre><code>0.91868709729356979<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h1 id=\"domashnee-zadanie\">\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\u0442 \u0440\u0430\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0447\u0442\u043e\u0431 \u0432\u0430\u043c \u043d\u0435 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e Vowpal Wabbit \u2013 \u044d\u0442\u043e \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043c\u0430\u0433\u0438\u044f, \u0432\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440, \u043e\u0431\u0443\u0447\u0430\u0435\u043c\u044b\u0435 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u043c \u0441\u043f\u0443\u0441\u043a\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u0437\u044f\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 (10 \u0413\u0431), \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043d\u0430 StackOverflow \u0438 \u0442\u0435\u0433\u0438 \u044d\u0442\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (\u043f\u043e\u0434\u0443\u043c\u0430\u0432 \u043d\u0430\u0434 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u043c\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439) \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e 10 \u0442\u0435\u0433\u0430\u043c (\u043f\u043e 10 \u044f\u0437\u044b\u043a\u0430\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f). \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0443\u0436\u0435 \u0443\u0434\u0438\u0432\u0438\u043b\u0438\u0441\u044c, \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c VW \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0438\u043b\u0438 \u043c\u0438\u043d\u0443\u0442\u044b \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0436\u0435\u043b\u0435\u0437\u0435, \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u0438\u0445 Hadoop-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432. <\/p>\n<p>  <\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0434\u0430\u043d\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c \u043a \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0443\u0442\u043e\u043a \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u0422\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c\/\u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u043c\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041e\u041e\u041f \u0432 Python<\/li>\n<li>\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 bash-\u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 UNIX \u2013 head, tail, wc, cat, cut \u0438 \u0442.\u0434. \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442 \u0436\u0438\u0437\u043d\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. <\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"poleznye-ssylki\">\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>  <\/p>\n<ul>\n<li>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0415\u0432\u0433\u0435\u043d\u0438\u044f \u0421\u043e\u043a\u043e\u043b\u043e\u0432\u0430: <a href=\"https:\/\/github.com\/esokolov\/ml-course-hse\/blob\/master\/2016-fall\/lecture-notes\/lecture06-linclass.pdf\">\u041c\u043d\u043e\u0433\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438<\/a> (\u0442\u0430\u043c \u0436\u0435 \u043f\u0440\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432), <a href=\"https:\/\/github.com\/esokolov\/ml-course-hse\/blob\/master\/2016-fall\/lecture-notes\/lecture02-linregr.pdf\">\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f<\/a> (\u0442\u0430\u043c \u0436\u0435 \u043f\u0440\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u0438 \u0435\u0433\u043e \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e), <a href=\"https:\/\/github.com\/esokolov\/ml-course-msu\/blob\/master\/ML15\/lecture-notes\/Sem08_vw.pdf\">\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043f\u0440\u043e Vowpal Wabbit<\/li>\n<li><a href=\"http:\/\/www.deeplearningbook.org\/contents\/numerical.html\">\u0413\u043b\u0430\u0432\u0430<\/a> &quot;Numeric Computation&quot; \u043a\u043d\u0438\u0433\u0438 &quot;Deep Learning&quot;<\/li>\n<li>\u041e\u0431\u0448\u0438\u0440\u043d\u0430\u044f <a href=\"https:\/\/github.com\/JohnLangford\/vowpal_wabbit\/wiki\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> Vowpal Wabbit \u043d\u0430 GitHub<\/li>\n<li><a href=\"https:\/\/aadrake.com\/command-line-tools-can-be-235x-faster-than-your-hadoop-cluster.html\">\u0421\u0442\u0430\u0442\u044c\u044f<\/a> \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (VW) \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043a\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 Hadoop-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430<\/li>\n<li>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u0430\u044f <a href=\"https:\/\/habrahabr.ru\/company\/mlclass\/blog\/248779\/\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u0440\u043e VW<\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/company\/mlclass\/blog\/248779\/\">\u0421\u0442\u0430\u0442\u044c\u044f<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u0440\u043e \u0441\u0432\u044f\u0437\u043a\u0443 VW \u0438 hyperopt<\/li>\n<\/ul>\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\/326418\/\"> https:\/\/habrahabr.ru\/post\/326418\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/96c\/ffb\/939\/96cffb939d3848ebb814641f0c8435f0.jpeg\" align=\"right\" width=\"40%\"\/>  <\/p>\n<p>\u0412\u043e\u0442 \u043c\u044b \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0438 \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u043a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0434\u0441\u0442\u0443\u043f\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u044b \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442. \u041e\u0431\u0441\u0443\u0434\u0438\u043c \u043f\u0440\u0438\u0435\u043c\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c: \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a (SGD) \u0438 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Vowpal Wabbit. \u0414\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e SGD-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0442\u0430\u043a \u0438 \u043d\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 StackOverflow \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0432 10 \u0413\u0431. <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\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-285082","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285082","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=285082"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285082\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}