{"id":364103,"date":"2024-05-21T02:10:08","date_gmt":"2024-05-21T02:10:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=364103"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=364103","title":{"rendered":"<span>\u0412 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438: \u043e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/5df\/e28\/2b0\/5dfe282b0893a8b63eeae73b77ac0354.jpg\" width=\"1429\" height=\"952\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5df\/e28\/2b0\/5dfe282b0893a8b63eeae73b77ac0354.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!  \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u0446\u0430 <a href=\"https:\/\/newtechaudit.ru\/\"><u>\u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 NTA<\/u><\/a> \u041a\u043e\u0440\u0441\u0430\u043a\u043e\u0432\u0430 \u0415\u043b\u0435\u043d\u0430.<\/p>\n<p>\u041f\u043e\u0438\u0441\u043a \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u00a0\u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438. \u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u00a0\u0431\u0440\u043e\u0441\u0430\u044e\u0442\u0441\u044f \u0432\u00a0\u0433\u043b\u0430\u0437\u0430\u00a0\u2014 \u0432\u0441\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u0434\u0430\u00a0\u0438 \u0441\u0442\u0438\u043b\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0441\u0445\u043e\u0436: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u044f\u0432\u043a\u0438, \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u043d\u0435\u00a0\u0432\u00a0\u0442\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0435\u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u00a0\u043b\u043e\u0433\u0430\u0445 \u0438\u043b\u0438\u00a0\u043f\u0438\u0441\u044c\u043c\u0430 \u043e\u0442\u00a0\u043c\u043e\u0448\u0435\u043d\u043d\u0438\u043a\u043e\u0432. \u0412\u00a0\u043f\u043e\u0441\u0442\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438\u00a0\u2014 \u043e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u2014 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441 \u043e\u0431\u0440\u0430\u0437\u0446\u0430\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0441\u0440\u0430\u0437\u0443 \u0432 \u0433\u043b\u0430\u0437\u0430 \u043d\u0435 \u0431\u0440\u043e\u0441\u0430\u044e\u0442\u0441\u044f: \u043d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c, \u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u2014 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c.  <\/p>\n<p>\u0427\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430 \u0437\u0430\u0434\u0430\u0447\u0430? \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u044b\u0445 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0442\u0440\u044b\u0432\u043a\u043e\u0432 \u0442\u0435\u043a\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043e\u0431\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u0430\u043a \u0441\u043e\u0440. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0438, \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u043d\u0435 \u0432 \u0442\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0430\u0445 \u0438\u043b\u0438 \u043f\u0438\u0441\u044c\u043c\u0430 \u043e\u0442 \u043c\u043e\u0448\u0435\u043d\u043d\u0438\u043a\u043e\u0432. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0440\u044b\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9B%D0%B5%D1%81%D0%BA%D0%BE%D0%B2,_%D0%9D%D0%B8%D0%BA%D0%BE%D0%BB%D0%B0%D0%B9_%D0%A1%D0%B5%D0%BC%D1%91%D0%BD%D0%BE%D0%B2%D0%B8%D1%87\"><u>\u041d.\u0421. \u041b\u0435\u0441\u043a\u043e\u0432\u0430<\/u><\/a> \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%91%D0%B0%D0%B6%D0%BE%D0%B2,_%D0%9F%D0%B0%D0%B2%D0%B5%D0%BB_%D0%9F%D0%B5%D1%82%D1%80%D0%BE%D0%B2%D0%B8%D1%87\"><u>\u041f.\u041f. \u0411\u0430\u0436\u043e\u0432\u0430<\/u><\/a>. \u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u044d\u0442\u0430 \u043f\u0430\u0440\u0430 \u043f\u0438\u0441\u0430\u0442\u0435\u043b\u0435\u0439? \u041e\u0431\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u043a\u0430\u0437\u044b, \u043e\u0431\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043d\u043e-\u0431\u044b\u0442\u043e\u0432\u043e\u0439 \u0441\u0442\u0438\u043b\u044c, \u0438 \u0441 \u0445\u043e\u0434\u0443 \u043d\u0435 \u0443 \u0432\u0441\u044f\u043a\u043e\u0433\u043e \u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u0430 \u0443\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u0440.  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u2014 <a href=\"https:\/\/medium.com\/grabngoinfo\/one-class-svm-for-anomaly-detection-6c97fdd6d8af\"><u>One-class SVM Classification<\/u><\/a>. \u041e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (\u0435\u0449\u0451 \u0435\u0451 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0443\u043d\u0430\u0440\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439) \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u0430\u043b \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u0422\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B0%D1%81%D1%81%D1%82%D0%BE%D1%8F%D0%BD%D0%B8%D0%B5_%D0%9A%D1%83%D0%BB%D1%8C%D0%B1%D0%B0%D0%BA%D0%B0_%E2%80%94_%D0%9B%D0%B5%D0%B9%D0%B1%D0%BB%D0%B5%D1%80%D0%B0\"><u>\u043c\u0435\u0442\u043e\u0434 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430<\/u><\/a>.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u041d\u0430\u0431\u043e\u0440\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e (\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/www.kaggle.com\/elenakorsakova\/kullback-leibler-divergence-method\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>). \u0412 \u043d\u0438\u0445 \u0432\u043e\u0448\u043b\u0438 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0438\u0437 \u00ab\u041c\u0430\u043b\u0430\u0445\u0438\u0442\u043e\u0432\u043e\u0439 \u0448\u043a\u0430\u0442\u0443\u043b\u043a\u0438\u00bb \u0411\u0430\u0436\u043e\u0432\u0430 \u0438 \u0438\u0437 \u0441\u0431\u043e\u0440\u043d\u0438\u043a\u0430 \u043f\u043e\u0432\u0435\u0441\u0442\u0435\u0439 \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u041b\u0435\u0432\u0448\u0430\u00bb). \u041d\u0430\u0431\u043e\u0440 \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u0411\u0430\u0436\u043e\u0432\u0430 \u0438 \u0432\u043a\u0440\u0430\u043f\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u043d\u0430\u0437\u043e\u0432\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u00ab\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u00bb, \u0430 \u043d\u0430\u0431\u043e\u0440 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u2014 \u00ab\u043c\u0430\u043b\u044b\u043c\u00bb. \u0412 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u043e\u0448\u043b\u043e 2505 \u0442\u0435\u043a\u0441\u0442\u0430 \u0411\u0430\u0436\u043e\u0432\u0430 \u0438 30 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u043e 196 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 1,2% \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439. \u0412 \u043c\u0430\u043b\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u043e\u0448\u043b\u043e 213 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u043f\u043e 208 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u044b:<\/p>\n<pre><code class=\"python\"># \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0430\u043b\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 import os fname = os.path.join('\/kaggle\/input\/bazhov-leskov-dataset\/Leskov.xlsx') with open(fname) as f:     target_corpus = pd.read_excel('\/kaggle\/input\/bazhov-leskov-dataset\/Leskov.xlsx')  # \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 fname = os.path.join('\/kaggle\/input\/bazhov-leskov-dataset\/Bazhov.xlsx') with open(fname) as f:     reference_corpus = pd.read_excel('\/kaggle\/input\/bazhov-leskov-dataset\/Bazhov.xlsx')<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u0435\u043a\u0441\u0442\u043e\u0432:<\/p>\n<blockquote>\n<p>\u0411\u0430\u0436\u043e\u0432: <\/p>\n<p>\u0412\u043e\u0442 \u0431\u044b \u0431\u044b\u043b \u043d\u0430\u0448 \u0422\u0438\u043c\u043e\u0444\u0435\u0438\u0447 \u0434\u043e\u043c\u0430, \u043d\u0435\u00a0\u0442\u043e\u00a0\u0431\u044b \u0431\u044b\u043b\u043e. \u0421\u043f\u043e\u0437\u0430\u0440\u0430\u043d\u043e\u043a \u0431\u044b \u043e\u043d\u00a0\u0440\u0430\u0437\u0432\u0435\u0434\u0430\u043b \u043f\u0440\u043e \u043d\u0435\u0437\u0432\u0430\u043d\u044b\u0445 \u0433\u043e\u0441\u0442\u0435\u0439 \u0438\u00a0\u0433\u043e\u0441\u0442\u0438\u043d\u0446\u0435\u0432 \u0431\u044b \u0438\u043c\u00a0\u043f\u0440\u0438\u043f\u0430\u0441 \u043d\u0435\u00a0\u0441\u0442\u043e\u043b\u044c\u043a\u043e. \u041d\u0430\u043f\u0440\u0435\u0434\u043a\u0438 \u0437\u0430\u0431\u044b\u043b\u0438 \u0431\u044b \u0434\u043e\u0440\u043e\u0433\u0443 \u043a\u00a0\u043d\u0430\u0448\u0435\u043c\u0443 \u0433\u043e\u0440\u043e\u0434\u0443! \u0414\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0443 \u0431\u044b\u043b. \u0417\u0440\u044f \u0435\u0433\u043e \u0437\u0430\u0433\u0443\u0431\u0438\u043b\u0438!<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u041b\u0435\u0441\u043a\u043e\u0432:<\/p>\n<p>\u00ab\u0410\u0445, \u0441\u043a\u0430\u0436\u0438\u0442\u0435,\u00a0\u2014 \u0433\u043e\u0432\u043e\u0440\u044e,\u00a0\u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430!\u00bb \u00ab\u041d\u0443, \u0421\u0442\u0435\u043f\u0430\u043d,\u00a0\u2014 \u0434\u0443\u043c\u0430\u044e,\u00a0\u2014 \u041c\u0430\u0442\u0432\u0435\u0438\u0447, \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u0436 \u0432\u044b \u0431\u044b\u043b\u043e \u0441\u043e \u043c\u043d\u043e\u0439 \u0448\u0442\u0443\u043a\u0443 \u043f\u043e\u0434\u0448\u0443\u0442\u0438\u043b\u0438! \u2014 \u0438 \u0433\u043e\u0432\u043e\u0440\u044e, \u0447\u0442\u043e, \u0441\u0442\u0430\u043b\u043e \u0431\u044b\u0442\u044c \u0436\u0435, \u0433\u043e\u0432\u043e\u0440\u044e, \u043a\u0430\u043a \u044f \u0435\u0433\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u044e, \u043e\u043d, \u043e\u0434\u043d\u0430\u043a\u043e, \u0444\u043e\u0440\u0442\u0435\u043b\u044c!\u00bb<\/p>\n<\/blockquote>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u043d\u0438\u0445 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u2014 \u044d\u0442\u043e \u0435\u0433\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430: \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043e\u0442 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u0438, \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043c\u0435\u043d\u044c\u0448\u0435 \u0442\u0440\u0451\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432 \u043a \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443 \u0438 \u0438\u0445 \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f.  <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 def _remove_punct_num(sample):     import re     import string      remove = string.punctuation     remove = remove.replace('-', '') # don't remove hyphens     pattern = r'[{}]'.format(remove) # create the pattern     sample = re.sub(pattern, '', sample)     sample = re.sub('[\u00ab\u00bb]+', '', sample)     sample = re.sub('\\\\b\\\\d+(\\\\.\\\\d+)?%?', '', sample)     return sample  def text_to_lemmas_KLD(sample):     sample = _remove_punct_num(sample)     tokens = (str(sample)).split()     tokens = [morph.parse(tok.lower())[0].normal_form for tok in tokens if len(tok.lower())>3 and tok.lower() not in STOPLIST]     return tokens  # \u0447\u0438\u0441\u0442\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u044b target_corpus['clean_text'] = target_corpus.text.apply(text_to_lemmas_KLD) reference_corpus['clean_text'] = reference_corpus.text.apply(text_to_lemmas_KLD)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u0441\u043b\u043e\u0432\u0430 \u043a \u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 pymorphy2. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u0430:<\/p>\n<p><em>\u00ab\u0410\u0445, \u0441\u043a\u0430\u0436\u0438\u0442\u0435,\u00a0\u2014 \u0433\u043e\u0432\u043e\u0440\u044e,\u00a0\u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430!\u00bb \u00ab\u041d\u0443, \u0421\u0442\u0435\u043f\u0430\u043d,\u00a0\u2014 \u0434\u0443\u043c\u0430\u044e,\u00a0\u2014 \u041c\u0430\u0442\u0432\u0435\u0438\u0447, \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u0436 \u0432\u044b \u0431\u044b\u043b\u043e \u0441\u043e \u043c\u043d\u043e\u0439 \u0448\u0442\u0443\u043a\u0443 \u043f\u043e\u0434\u0448\u0443\u0442\u0438\u043b\u0438!\u00bb.<\/em><\/p>\n<p>\u2193<\/p>\n<p><em>[&#8216;\u0441\u043a\u0430\u0437\u0430\u0442\u044c&#8217;, &#8216;\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c&#8217;, &#8216;\u0441\u0442\u0435\u043f\u0430\u043d&#8217;, &#8216;\u0434\u0443\u043c\u0430\u0442\u044c&#8217;, &#8216;\u043c\u0430\u0442\u0432\u0435\u0435\u0432\u0438\u0447&#8217;, &#8216;\u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439&#8217;, &#8216;\u0448\u0442\u0443\u043a\u0430&#8217;, &#8216;\u043f\u043e\u0434\u0448\u0443\u0442\u0438\u0442\u044c&#8217;..]<\/em><\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433. \u042d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u0443 \u0441\u043b\u043e\u0432\u0430, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0441\u043b\u043e\u0432\u0430. \u041f\u0440\u0438\u043c\u0435\u0440: \u00ab\u0441\u043a\u0430\u0436\u0438\u0442\u0435\u00bb \u2192 \u00ab\u0441\u043a\u0430\u0436\u00bb. \u041f\u0440\u0438\u043c\u0435\u0440 \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438: \u00ab\u0441\u043a\u0430\u0436\u0438\u0442\u0435\u00bb \u2192 \u00ab\u0441\u043a\u0430\u0437\u0430\u0442\u044c\u00bb. \u041b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0438\u0437-\u0437\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430 \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Snowball Stemmer NLTK. \u0421\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0445\u0443\u0436\u0435 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u044b \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0438 \u043f\u0440\u0438 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0435 \u0447\u0430\u0441\u0442\u043e\u0442 \u044d\u0442\u043e \u0434\u0430\u0441\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443.  <\/p>\n<h2>\u041e\u0442\u0431\u043e\u0440 \u0441\u043b\u043e\u0432: \u043c\u0435\u0442\u043e\u0434 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0431\u0438\u0440\u0430\u044e \u0441\u043b\u043e\u0432\u0430, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0434\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u0440\u043f\u0443\u0441\u0430: \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0440\u043f\u0443\u0441 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e \u0438\u0437 \u043c\u0430\u043b\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430, \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u044b\u0439 \u043a\u043e\u0440\u043f\u0443\u0441 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430. \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u043b\u043e\u0432 (\u043b\u0435\u043c\u043c) \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<pre><code class=\"python\"># \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u0447\u0430\u0441\u0442\u043e\u0442 \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 dictionary_to_investigate = sum((Counter(x) for x in target_corpus.clean_text), Counter()) dictionary_to_reference = sum((Counter(x) for x in reference_corpus.clean_text), Counter())  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u043e\u0442 \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 def count_freq(counter):     total = 0     for key in counter:         total += counter[key]     result = {}     for key in counter:         result[key] = counter[key] \/ total     return result  # \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 investigate = count_freq(dictionary_to_investigate) reference = count_freq(dictionary_to_reference)<\/code><\/pre>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043a\u043e\u0440\u043f\u0443\u0441\u043e\u0432 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430. \u042d\u0442\u043e \u043c\u0435\u0440\u0430 \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e, \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0433\u043e, \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435. \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u0442\u0430\u043a:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\" D_{KL}(P\\parallel Q)=\\int_{X}^{}p\\textrm{log}\\frac{p}{q}d\\mu \" alt=\" D_{KL}(P\\parallel Q)=\\int_{X}^{}p\\textrm{log}\\frac{p}{q}d\\mu \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c04\/80b\/0ed\/c0480b0eddd7f9630b6cc2d90bfacb58.svg\" width=\"230\" height=\"47\"\/><\/p>\n<p>\u0433\u0434\u0435 \u00b5 \u2014 \u043b\u044e\u0431\u0430\u044f \u043c\u0435\u0440\u0430 \u043d\u0430 X, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u00b5 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 p = dP\/d\u00b5 \u0438 q = dQ\/d\u00b5 (\u0430 \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445). \u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430 \u0432 \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u043e\u043b\u0438 \u043d\u0435 \u0438\u0433\u0440\u0430\u0435\u0442. \u0415\u0433\u043e \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0432\u0438\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0440\u0430\u0432\u043d\u043e\u0441\u0438\u043b\u0435\u043d \u0432\u044b\u0431\u043e\u0440\u0443 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430 \u0441 \u043b\u044e\u0431\u044b\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c. \u041a\u043e\u0434 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430-\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 def partial_KLD(px, qx):         if not all([px, qx]):             return 0         return px * log2(px\/qx)     def top_KLD_outliers(p, q, threshold, include_new=True):     keys = set(p.keys()).union(q.keys())     result = {}     for key in keys:         if key in p and key not in q:             if include_new:                 result[key] = float('inf')         elif key in p and key in q:             pkld = partial_KLD(float(p[key]), float(q[key]))             if pkld > threshold:                 result[key] = pkld     return result<\/code><\/pre>\n<p>D<sub>KL<\/sub>(P\u2016Q) \u2014 \u0431\u0435\u0437\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430. \u0427\u0435\u043c\u0443 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u0430? \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043b\u043e\u0432 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c D<sub>KL<\/sub>(P\u2016Q)=0. \u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0432\u043e \u0440\u0435\u0434\u043a\u043e\u0435, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041e\u0431\u0430 \u044d\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u044f \u043c\u043d\u0435 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b: \u043b\u0438\u0431\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0438\u0437\u043a\u043e\u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043b\u0438\u0431\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 \u0441\u043b\u043e\u0432\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043e\u0442\u0441\u0435\u043a\u0430\u044e, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u043e\u0442\u0441\u0435\u0447\u043a\u0443 \u043f\u043e D<sub>KL<\/sub>(P\u2016Q) \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 0,0001:<\/p>\n<pre><code class=\"python\"># \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u043b\u0435\u043c\u043c \u043c\u0430\u043b\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 outliers = top_KLD_outliers(investigate, reference, 0.0001, False)<\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 D<sub>KL<\/sub>(P\u2016Q). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 781 \u0441\u043b\u043e\u0432\u043e (\u0430 \u0442\u043e\u0447\u043d\u0435\u0435 781 \u043b\u0435\u043c\u043c\u0430), \u0441\u0430\u043c\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u00ab\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u00bb \u0438 \u00ab\u0433\u043e\u0441\u0443\u0434\u0430\u0440\u044c\u00bb. <\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0439 \u043c\u0435\u0440\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c D<sub>KL<\/sub>(P\u2016Q) \u2260 D<sub>KL<\/sub>(Q\u2016P). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0430\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u0439 \u0438 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u044b\u0439 \u043a\u043e\u0440\u043f\u0443\u0441\u0430.  <\/p>\n<h2>\u041f\u043e\u0438\u0441\u043a<\/h2>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u2014 \u043f\u043e\u0438\u0441\u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u0411\u0430\u0436\u043e\u0432\u0430. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0435\u0441\u0442\u044c \u043b\u0438 \u043e\u043d\u043e \u0441\u0440\u0435\u0434\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0432, \u0438 \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u0431\u0435\u0440\u0443 \u0435\u0433\u043e D<sub>KL<\/sub>(P\u2016Q). \u0414\u0430\u043b\u0435\u0435, \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u044e \u0432\u0441\u0435 D<sub>KL<\/sub>(P\u2016Q), \u0430 \u0437\u0430\u0442\u0435\u043c, \u0434\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0443\u043c\u043d\u043e\u0436\u0430\u044e \u044d\u0442\u0443 \u0441\u0443\u043c\u043c\u0443 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0438 \u0434\u0435\u043b\u044e \u043d\u0430 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432 \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 \u0447\u0438\u0441\u0442\u043a\u0438.  <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"Specificity_{text}=\\frac{\\sum DKL(P\\parallel Q)\\times N_{specific words}}{N_{clean words}}\" alt=\"Specificity_{text}=\\frac{\\sum DKL(P\\parallel Q)\\times N_{specific words}}{N_{clean words}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/402\/854\/7b5\/4028547b5433d842426e61090f45267d.svg\" width=\"414\" height=\"49\"\/><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u043f\u043e \u03a3D<sub>KL<\/sub>(P\u2016Q) \u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u043e\u0442\u0441\u0435\u0447\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u043d\u0430\u0431\u043e\u0440 \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430.    <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432  def find_specificity(cell):     total_specificity = 0     total_specific_words = 0     for key in cell:         total_clean_words = len(cell)         if key in outliers:             total_specificity += float(outliers[key])             total_specific_words += 1     return total_specificity*total_specific_words\/total_clean_words  # \u0441\u0442\u0440\u043e\u0438\u043c \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 reference_corpus['specificity'] = reference_corpus['clean_text'].apply(find_specificity) reference_corpus = reference_corpus.sort_values(by='specificity', ascending=False)<\/code><\/pre>\n<h2>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0442\u0441\u0435\u0447\u043a\u0443?  <\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0442\u043e\u043f-50 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432. \u0422\u0435 \u0442\u0435\u043a\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0448\u0435 0,74 \u2014 \u044d\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430. \u0418\u0445 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 26 \u0448\u0442\u0443\u043a. \u0418 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u0441 \u0430\u0432\u0442\u043e\u0440\u0430\u043c\u0438 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00ab\u041b\u0435\u0441\u043a\u043e\u0432\u00bb. \u0422\u0435 \u0442\u0435\u043a\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0438\u0436\u0435 0,21\u00a0\u2014 \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u044d\u0442\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4dc\/f18\/ebe\/4dcf18ebe05c051ae160a01f6331e82f.png\" alt=\"\u0413\u0440\u0430\u0444\u0438\u043a \u0442\u043e\u043f-50 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438.\" title=\"\u0413\u0440\u0430\u0444\u0438\u043a \u0442\u043e\u043f-50 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438.\" width=\"670\" height=\"452\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4dc\/f18\/ebe\/4dcf18ebe05c051ae160a01f6331e82f.png\"\/><\/p>\n<div><figcaption>\u0413\u0440\u0430\u0444\u0438\u043a \u0442\u043e\u043f-50 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438.<\/figcaption><\/div>\n<\/figure>\n<p>\u0410 \u0432\u043e\u0442 \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e 0,74 \u0438 0,21 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u0430\u044f \u0437\u043e\u043d\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0440\u0435\u0437\u043a\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f. \u0418 \u0442\u0443\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u044b \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043f\u0440\u043e\u0449\u0435. \u0412 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0432\u0430\u0436\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u043f\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0443, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u0435\u0447\u044c \u0442\u0435\u043a\u0441\u0442\u044b \u043f\u043e \u043f\u043e\u0440\u043e\u0433\u0443 0,21. \u041e\u0442\u0431\u0440\u043e\u0441\u0438\u043c 32 \u0442\u0435\u043a\u0441\u0442\u0430, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 30 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u0438 2 \u0442\u0435\u043a\u0441\u0442\u0430 \u0411\u0430\u0436\u043e\u0432\u0430. \u041d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d2c\/e11\/c31\/d2ce11c31b2f38b16701451bb9aff376.png\" alt=\"\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 (\u043e\u0442\u0441\u0435\u0447\u043a\u0430 0,21): Actual label \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u0435\u0442\u043a\u0430, Predicted label \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430; 0 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430, 30 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2503 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430.\" title=\"\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 (\u043e\u0442\u0441\u0435\u0447\u043a\u0430 0,21): Actual label \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u0435\u0442\u043a\u0430, Predicted label \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430; 0 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430, 30 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2503 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430.\" width=\"633\" height=\"508\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d2c\/e11\/c31\/d2ce11c31b2f38b16701451bb9aff376.png\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/habr.com\/ru\/articles\/758510\/\"><u>\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439<\/u><\/a> \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 (\u043e\u0442\u0441\u0435\u0447\u043a\u0430 0,21): Actual label \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u0435\u0442\u043a\u0430, Predicted label \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430; 0 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430, 30 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2503 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430.<\/figcaption><\/div>\n<\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0446\u0435\u043b\u0435\u0432\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b,\u00a0\u2014 \u0430\u00a0\u044d\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430,\u00a0\u2014 \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u0435\u0447\u044c \u043f\u043e \u043f\u043e\u0440\u043e\u0433\u0443 0,74. \u0422\u0430\u043a \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432\u0441\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430, \u043d\u043e \u0441\u0440\u0435\u0434\u0438 2505 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u044b \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f 4 \u0442\u0435\u043a\u0441\u0442\u0430 \u041b\u0435\u0441\u043a\u043e\u0432\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430 \u043d\u0430 \u043a\u0440\u0438\u0432\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438. \u0418\u0449\u0443 \u0435\u0451 \u043a\u0430\u043a \u0432\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0443\u044e \u043e\u0442 \u0441\u043b\u0435\u0433\u043a\u0430 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438.   <\/p>\n<pre><code class=\"python\">raw = reference_corpus.specificity.to_list() smooth = gaussian_filter1d(raw, 8) smooth_d2 = np.gradient(np.gradient(smooth)) inflection_points = np.where(np.diff(np.sign(smooth_d2)))[0]<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0433\u0440\u0430\u0444\u0438\u043a:  <\/p>\n<pre><code class=\"python\"># plot threshold results plt.plot(raw, label='Noisy Data') plt.plot(smooth, label='Smoothed Data') plt.plot(np.max(smooth)*(smooth_d2)\/(np.max(smooth_d2)-np.min(smooth_d2)), label='Second Derivative (scaled)') for i, infl in enumerate(inflection_points, 1):     plt.axvline(x=infl, color='k', label=f'Inflection Point {i}') plt.legend(bbox_to_anchor=(1.55, 1.0))<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e50\/e15\/383\/e50e1538359d324e094230d3c694d526.png\" alt=\"\u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0435\u0447\u043a\u0438 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u043f\u043e \u0442\u043e\u0447\u043a\u0435 \u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430 \u043a\u0440\u0438\u0432\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432: \u0441\u0438\u043d\u044f\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 (\u0437\u0430\u0448\u0443\u043c\u043b\u0435\u043d\u043d\u044b\u0439) \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438; \u043e\u0440\u0430\u043d\u0436\u0435\u0432\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438; \u0437\u0435\u043b\u0435\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0433\u0440\u0430\u0444\u0438\u043a \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 (\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439). \u041f\u0440\u0438 \u0445 = 26 \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0437\u043d\u0430\u043a. \u0422\u0430\u043a \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 (26; 0,74).\" title=\"\u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0435\u0447\u043a\u0438 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u043f\u043e \u0442\u043e\u0447\u043a\u0435 \u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430 \u043a\u0440\u0438\u0432\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432: \u0441\u0438\u043d\u044f\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 (\u0437\u0430\u0448\u0443\u043c\u043b\u0435\u043d\u043d\u044b\u0439) \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438; \u043e\u0440\u0430\u043d\u0436\u0435\u0432\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438; \u0437\u0435\u043b\u0435\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0433\u0440\u0430\u0444\u0438\u043a \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 (\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439). \u041f\u0440\u0438 \u0445 = 26 \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0437\u043d\u0430\u043a. \u0422\u0430\u043a \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 (26; 0,74).\" width=\"1125\" height=\"586\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e50\/e15\/383\/e50e1538359d324e094230d3c694d526.png\"\/><\/p>\n<div><figcaption>\u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0435\u0447\u043a\u0438 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u043f\u043e \u0442\u043e\u0447\u043a\u0435 \u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430 \u043a\u0440\u0438\u0432\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432: \u0441\u0438\u043d\u044f\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 (\u0437\u0430\u0448\u0443\u043c\u043b\u0435\u043d\u043d\u044b\u0439) \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438; \u043e\u0440\u0430\u043d\u0436\u0435\u0432\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438; \u0437\u0435\u043b\u0435\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u0433\u0440\u0430\u0444\u0438\u043a \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 (\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439). \u041f\u0440\u0438 \u0445 = 26 \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0437\u043d\u0430\u043a. \u0422\u0430\u043a \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 (26; 0,74).<\/figcaption><\/div>\n<\/figure>\n<p>\u0418 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"python\">reference_corpus[:inflection_points[0]].to_excel('KLD_result.xlsx', index=False)<\/code><\/pre>\n<h2>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441 One-class SVM classification<\/h2>\n<p>\u041d\u0430\u0431\u043e\u0440\u044b \u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0430 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430. \u0414\u043b\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.feature_extraction.text.TfidfVectorizer.html\"><u>TfidfVectorizer<\/u><\/a>. \u041c\u0435\u0442\u043e\u0434 One-class SVM \u0432\u0437\u044f\u0442 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.svm.OneClassSVM.html\"><u>Scikit learn<\/u><\/a>.<\/p>\n<p>\u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0441 One-class SVM classification \u043d\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e, \u043a\u0430\u043a \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439: \u0431\u044b\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043e 18 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a 12 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0447\u0438\u0441\u043b\u0435\u043d\u043e \u043a \u043a\u043b\u0430\u0441\u0441\u0443 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445. \u041d\u043e \u0447\u0442\u043e \u0445\u0443\u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u2014 99 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430 \u0431\u044b\u043b\u043e \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u043e \u043a \u0442\u0435\u043a\u0441\u0442\u0430\u043c \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u0430 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 4% \u0432\u0441\u0435\u0445 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432!<\/p>\n<pre><code class=\"python\"># \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 import numpy as np import matplotlib.pyplot as plt import seaborn as sns  class_names=[0,1] # name  of classes fig, ax = plt.subplots() tick_marks = np.arange(len(class_names)) plt.xticks(tick_marks, class_names) plt.yticks(tick_marks, class_names) # create heatmap sns.heatmap(pd.DataFrame(results), annot=True, cmap=\"YlGnBu\",fmt='g', linewidths=1, linecolor='#dddddd', annot_kws={\"size\": 16}) ax.xaxis.set_label_position(\"top\") plt.tight_layout() plt.title('Confusion matrix | One-class SVM classification', y=1.1) plt.ylabel('Actual label') plt.xlabel('Predicted label') for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +              ax.get_xticklabels() + ax.get_yticklabels()):     item.set_fontsize(16)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/06a\/c77\/921\/06ac77921c848216bc7b6f7700bf7f5f.png\" alt=\"\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 One-class SVM Classification: Actual label \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u0435\u0442\u043a\u0430, Predicted label \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430; 12 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430, 18 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 99 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2406 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430.\" title=\"\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 One-class SVM Classification: Actual label \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u0435\u0442\u043a\u0430, Predicted label \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430; 12 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430, 18 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 99 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2406 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430.\" width=\"634\" height=\"518\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/06a\/c77\/921\/06ac77921c848216bc7b6f7700bf7f5f.png\"\/><\/p>\n<div><figcaption>\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 One-class SVM Classification: Actual label \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u0435\u0442\u043a\u0430, Predicted label \u2014 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430; 12 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u0411\u0430\u0436\u043e\u0432\u0430, 18 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 99 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430, 2406 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0411\u0430\u0436\u043e\u0432\u0430.<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0432 \u043f\u043e\u0441\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0441 \u043e\u0431\u0440\u0430\u0437\u0446\u0430\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043d\u0435\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 (2535 \u0441\u0442\u0440\u043e\u043a vs. 213 \u0441\u0442\u0440\u043e\u043a).<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 SVM: \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u043c\u0438 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0430\u043c \u0411\u0430\u0436\u043e\u0432\u0430 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0432\u0435\u0441 4% \u0434\u043b\u044f SVM \u0438 \u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u043f\u0440\u043e\u0442\u0438\u0432 12 \u0434\u043b\u044f SVM. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043b\u043e\u0433\u0430\u0445, \u043f\u0438\u0441\u044c\u043c\u0430 \u043e\u0442 \u043c\u043e\u0448\u0435\u043d\u043d\u0438\u043a\u043e\u0432, \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u044f\u0432\u043a\u0438, \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u043d\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432 \u0438 \u043d\u0430\u0431\u043e\u0440\u044b \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/www.kaggle.com\/elenakorsakova\/kullback-leibler-divergence-method.\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/783428\/\"> https:\/\/habr.com\/ru\/articles\/783428\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!  \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u0446\u0430 <a href=\"https:\/\/newtechaudit.ru\/\"><u>\u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 NTA<\/u><\/a> \u041a\u043e\u0440\u0441\u0430\u043a\u043e\u0432\u0430 \u0415\u043b\u0435\u043d\u0430.<\/p>\n<p>\u041f\u043e\u0438\u0441\u043a \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u00a0\u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438. \u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u00a0\u0431\u0440\u043e\u0441\u0430\u044e\u0442\u0441\u044f \u0432\u00a0\u0433\u043b\u0430\u0437\u0430\u00a0\u2014 \u0432\u0441\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u0434\u0430\u00a0\u0438 \u0441\u0442\u0438\u043b\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0441\u0445\u043e\u0436: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u044f\u0432\u043a\u0438, \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u043d\u0435\u00a0\u0432\u00a0\u0442\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0435\u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u00a0\u043b\u043e\u0433\u0430\u0445 \u0438\u043b\u0438\u00a0\u043f\u0438\u0441\u044c\u043c\u0430 \u043e\u0442\u00a0\u043c\u043e\u0448\u0435\u043d\u043d\u0438\u043a\u043e\u0432. \u0412\u00a0\u043f\u043e\u0441\u0442\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438\u00a0\u2014 \u043e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u2014 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441 \u043e\u0431\u0440\u0430\u0437\u0446\u0430\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0441\u0440\u0430\u0437\u0443 \u0432 \u0433\u043b\u0430\u0437\u0430 \u043d\u0435 \u0431\u0440\u043e\u0441\u0430\u044e\u0442\u0441\u044f: \u043d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c, \u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u2014 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c.  <\/p>\n<p>\u0427\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430 \u0437\u0430\u0434\u0430\u0447\u0430? \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u044b\u0445 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0442\u0440\u044b\u0432\u043a\u043e\u0432 \u0442\u0435\u043a\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043e\u0431\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u0430\u043a \u0441\u043e\u0440. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u044f\u0432\u043a\u0438, \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u043d\u0435 \u0432 \u0442\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0430\u0445 \u0438\u043b\u0438 \u043f\u0438\u0441\u044c\u043c\u0430 \u043e\u0442 \u043c\u043e\u0448\u0435\u043d\u043d\u0438\u043a\u043e\u0432. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0440\u044b\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9B%D0%B5%D1%81%D0%BA%D0%BE%D0%B2,_%D0%9D%D0%B8%D0%BA%D0%BE%D0%BB%D0%B0%D0%B9_%D0%A1%D0%B5%D0%BC%D1%91%D0%BD%D0%BE%D0%B2%D0%B8%D1%87\"><u>\u041d.\u0421. \u041b\u0435\u0441\u043a\u043e\u0432\u0430<\/u><\/a> \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%91%D0%B0%D0%B6%D0%BE%D0%B2,_%D0%9F%D0%B0%D0%B2%D0%B5%D0%BB_%D0%9F%D0%B5%D1%82%D1%80%D0%BE%D0%B2%D0%B8%D1%87\"><u>\u041f.\u041f. \u0411\u0430\u0436\u043e\u0432\u0430<\/u><\/a>. \u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u044d\u0442\u0430 \u043f\u0430\u0440\u0430 \u043f\u0438\u0441\u0430\u0442\u0435\u043b\u0435\u0439? \u041e\u0431\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u043a\u0430\u0437\u044b, \u043e\u0431\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043d\u043e-\u0431\u044b\u0442\u043e\u0432\u043e\u0439 \u0441\u0442\u0438\u043b\u044c, \u0438 \u0441 \u0445\u043e\u0434\u0443 \u043d\u0435 \u0443 \u0432\u0441\u044f\u043a\u043e\u0433\u043e \u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u0430 \u0443\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u0440.  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u2014 <a href=\"https:\/\/medium.com\/grabngoinfo\/one-class-svm-for-anomaly-detection-6c97fdd6d8af\"><u>One-class SVM Classification<\/u><\/a>. \u041e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043e\u0432\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (\u0435\u0449\u0451 \u0435\u0451 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0443\u043d\u0430\u0440\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439) \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u0430\u043b \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u0422\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B0%D1%81%D1%81%D1%82%D0%BE%D1%8F%D0%BD%D0%B8%D0%B5_%D0%9A%D1%83%D0%BB%D1%8C%D0%B1%D0%B0%D0%BA%D0%B0_%E2%80%94_%D0%9B%D0%B5%D0%B9%D0%B1%D0%BB%D0%B5%D1%80%D0%B0\"><u>\u043c\u0435\u0442\u043e\u0434 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430<\/u><\/a>.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u041d\u0430\u0431\u043e\u0440\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e (\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/www.kaggle.com\/elenakorsakova\/kullback-leibler-divergence-method\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>). \u0412 \u043d\u0438\u0445 \u0432\u043e\u0448\u043b\u0438 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0438\u0437 \u00ab\u041c\u0430\u043b\u0430\u0445\u0438\u0442\u043e\u0432\u043e\u0439 \u0448\u043a\u0430\u0442\u0443\u043b\u043a\u0438\u00bb \u0411\u0430\u0436\u043e\u0432\u0430 \u0438 \u0438\u0437 \u0441\u0431\u043e\u0440\u043d\u0438\u043a\u0430 \u043f\u043e\u0432\u0435\u0441\u0442\u0435\u0439 \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u041b\u0435\u0432\u0448\u0430\u00bb). \u041d\u0430\u0431\u043e\u0440 \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u0411\u0430\u0436\u043e\u0432\u0430 \u0438 \u0432\u043a\u0440\u0430\u043f\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u043d\u0430\u0437\u043e\u0432\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u00ab\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u00bb, \u0430 \u043d\u0430\u0431\u043e\u0440 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u2014 \u00ab\u043c\u0430\u043b\u044b\u043c\u00bb. \u0412 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u043e\u0448\u043b\u043e 2505 \u0442\u0435\u043a\u0441\u0442\u0430 \u0411\u0430\u0436\u043e\u0432\u0430 \u0438 30 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430, \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u043e 196 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 1,2% \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439. \u0412 \u043c\u0430\u043b\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u043e\u0448\u043b\u043e 213 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u043f\u043e 208 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u044b:<\/p>\n<pre><code class=\"python\"># \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0430\u043b\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 import os fname = os.path.join('\/kaggle\/input\/bazhov-leskov-dataset\/Leskov.xlsx') with open(fname) as f:     target_corpus = pd.read_excel('\/kaggle\/input\/bazhov-leskov-dataset\/Leskov.xlsx')  # \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 fname = os.path.join('\/kaggle\/input\/bazhov-leskov-dataset\/Bazhov.xlsx') with open(fname) as f:     reference_corpus = pd.read_excel('\/kaggle\/input\/bazhov-leskov-dataset\/Bazhov.xlsx')<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u0435\u043a\u0441\u0442\u043e\u0432:<\/p>\n<blockquote>\n<p>\u0411\u0430\u0436\u043e\u0432: <\/p>\n<p>\u0412\u043e\u0442 \u0431\u044b \u0431\u044b\u043b \u043d\u0430\u0448 \u0422\u0438\u043c\u043e\u0444\u0435\u0438\u0447 \u0434\u043e\u043c\u0430, \u043d\u0435\u00a0\u0442\u043e\u00a0\u0431\u044b \u0431\u044b\u043b\u043e. \u0421\u043f\u043e\u0437\u0430\u0440\u0430\u043d\u043e\u043a \u0431\u044b \u043e\u043d\u00a0\u0440\u0430\u0437\u0432\u0435\u0434\u0430\u043b \u043f\u0440\u043e \u043d\u0435\u0437\u0432\u0430\u043d\u044b\u0445 \u0433\u043e\u0441\u0442\u0435\u0439 \u0438\u00a0\u0433\u043e\u0441\u0442\u0438\u043d\u0446\u0435\u0432 \u0431\u044b \u0438\u043c\u00a0\u043f\u0440\u0438\u043f\u0430\u0441 \u043d\u0435\u00a0\u0441\u0442\u043e\u043b\u044c\u043a\u043e. \u041d\u0430\u043f\u0440\u0435\u0434\u043a\u0438 \u0437\u0430\u0431\u044b\u043b\u0438 \u0431\u044b \u0434\u043e\u0440\u043e\u0433\u0443 \u043a\u00a0\u043d\u0430\u0448\u0435\u043c\u0443 \u0433\u043e\u0440\u043e\u0434\u0443! \u0414\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0443 \u0431\u044b\u043b. \u0417\u0440\u044f \u0435\u0433\u043e \u0437\u0430\u0433\u0443\u0431\u0438\u043b\u0438!<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u041b\u0435\u0441\u043a\u043e\u0432:<\/p>\n<p>\u00ab\u0410\u0445, \u0441\u043a\u0430\u0436\u0438\u0442\u0435,\u00a0\u2014 \u0433\u043e\u0432\u043e\u0440\u044e,\u00a0\u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430!\u00bb \u00ab\u041d\u0443, \u0421\u0442\u0435\u043f\u0430\u043d,\u00a0\u2014 \u0434\u0443\u043c\u0430\u044e,\u00a0\u2014 \u041c\u0430\u0442\u0432\u0435\u0438\u0447, \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u0436 \u0432\u044b \u0431\u044b\u043b\u043e \u0441\u043e \u043c\u043d\u043e\u0439 \u0448\u0442\u0443\u043a\u0443 \u043f\u043e\u0434\u0448\u0443\u0442\u0438\u043b\u0438! \u2014 \u0438 \u0433\u043e\u0432\u043e\u0440\u044e, \u0447\u0442\u043e, \u0441\u0442\u0430\u043b\u043e \u0431\u044b\u0442\u044c \u0436\u0435, \u0433\u043e\u0432\u043e\u0440\u044e, \u043a\u0430\u043a \u044f \u0435\u0433\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u044e, \u043e\u043d, \u043e\u0434\u043d\u0430\u043a\u043e, \u0444\u043e\u0440\u0442\u0435\u043b\u044c!\u00bb<\/p>\n<\/blockquote>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u043d\u0438\u0445 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u2014 \u044d\u0442\u043e \u0435\u0433\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430: \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043e\u0442 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u0438, \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043c\u0435\u043d\u044c\u0448\u0435 \u0442\u0440\u0451\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432 \u043a \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443 \u0438 \u0438\u0445 \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f.  <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 def _remove_punct_num(sample):     import re     import string      remove = string.punctuation     remove = remove.replace('-', '') # don't remove hyphens     pattern = r'[{}]'.format(remove) # create the pattern     sample = re.sub(pattern, '', sample)     sample = re.sub('[\u00ab\u00bb]+', '', sample)     sample = re.sub('\\\\b\\\\d+(\\\\.\\\\d+)?%?', '', sample)     return sample  def text_to_lemmas_KLD(sample):     sample = _remove_punct_num(sample)     tokens = (str(sample)).split()     tokens = [morph.parse(tok.lower())[0].normal_form for tok in tokens if len(tok.lower())>3 and tok.lower() not in STOPLIST]     return tokens  # \u0447\u0438\u0441\u0442\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u044b target_corpus['clean_text'] = target_corpus.text.apply(text_to_lemmas_KLD) reference_corpus['clean_text'] = reference_corpus.text.apply(text_to_lemmas_KLD)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u0441\u043b\u043e\u0432\u0430 \u043a \u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 pymorphy2. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u0430:<\/p>\n<p><em>\u00ab\u0410\u0445, \u0441\u043a\u0430\u0436\u0438\u0442\u0435,\u00a0\u2014 \u0433\u043e\u0432\u043e\u0440\u044e,\u00a0\u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430!\u00bb \u00ab\u041d\u0443, \u0421\u0442\u0435\u043f\u0430\u043d,\u00a0\u2014 \u0434\u0443\u043c\u0430\u044e,\u00a0\u2014 \u041c\u0430\u0442\u0432\u0435\u0438\u0447, \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u0436 \u0432\u044b \u0431\u044b\u043b\u043e \u0441\u043e \u043c\u043d\u043e\u0439 \u0448\u0442\u0443\u043a\u0443 \u043f\u043e\u0434\u0448\u0443\u0442\u0438\u043b\u0438!\u00bb.<\/em><\/p>\n<p>\u2193<\/p>\n<p><em>[&#8216;\u0441\u043a\u0430\u0437\u0430\u0442\u044c&#8217;, &#8216;\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c&#8217;, &#8216;\u0441\u0442\u0435\u043f\u0430\u043d&#8217;, &#8216;\u0434\u0443\u043c\u0430\u0442\u044c&#8217;, &#8216;\u043c\u0430\u0442\u0432\u0435\u0435\u0432\u0438\u0447&#8217;, &#8216;\u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439&#8217;, &#8216;\u0448\u0442\u0443\u043a\u0430&#8217;, &#8216;\u043f\u043e\u0434\u0448\u0443\u0442\u0438\u0442\u044c&#8217;..]<\/em><\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433. \u042d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u0443 \u0441\u043b\u043e\u0432\u0430, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0441\u043b\u043e\u0432\u0430. \u041f\u0440\u0438\u043c\u0435\u0440: \u00ab\u0441\u043a\u0430\u0436\u0438\u0442\u0435\u00bb \u2192 \u00ab\u0441\u043a\u0430\u0436\u00bb. \u041f\u0440\u0438\u043c\u0435\u0440 \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438: \u00ab\u0441\u043a\u0430\u0436\u0438\u0442\u0435\u00bb \u2192 \u00ab\u0441\u043a\u0430\u0437\u0430\u0442\u044c\u00bb. \u041b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0438\u0437-\u0437\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430 \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Snowball Stemmer NLTK. \u0421\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0445\u0443\u0436\u0435 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u044b \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0438 \u043f\u0440\u0438 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0435 \u0447\u0430\u0441\u0442\u043e\u0442 \u044d\u0442\u043e \u0434\u0430\u0441\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443.  <\/p>\n<h2>\u041e\u0442\u0431\u043e\u0440 \u0441\u043b\u043e\u0432: \u043c\u0435\u0442\u043e\u0434 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0431\u0438\u0440\u0430\u044e \u0441\u043b\u043e\u0432\u0430, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0434\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u0440\u043f\u0443\u0441\u0430: \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0440\u043f\u0443\u0441 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e \u0438\u0437 \u043c\u0430\u043b\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430, \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u044b\u0439 \u043a\u043e\u0440\u043f\u0443\u0441 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430. \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u043b\u043e\u0432 (\u043b\u0435\u043c\u043c) \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<pre><code class=\"python\"># \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u0447\u0430\u0441\u0442\u043e\u0442 \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 dictionary_to_investigate = sum((Counter(x) for x in target_corpus.clean_text), Counter()) dictionary_to_reference = sum((Counter(x) for x in reference_corpus.clean_text), Counter())  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u043e\u0442 \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 def count_freq(counter):     total = 0     for key in counter:         total += counter[key]     result = {}     for key in counter:         result[key] = counter[key] \/ total     return result  # \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 investigate = count_freq(dictionary_to_investigate) reference = count_freq(dictionary_to_reference)<\/code><\/pre>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043a\u043e\u0440\u043f\u0443\u0441\u043e\u0432 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430. \u042d\u0442\u043e \u043c\u0435\u0440\u0430 \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e, \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0433\u043e, \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435. \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u0442\u0430\u043a:<\/p>\n<p>\u0433\u0434\u0435 \u00b5 \u2014 \u043b\u044e\u0431\u0430\u044f \u043c\u0435\u0440\u0430 \u043d\u0430 X, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u00b5 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 p = dP\/d\u00b5 \u0438 q = dQ\/d\u00b5 (\u0430 \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043b\u0435\u043c\u043c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445). \u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430 \u0432 \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u043e\u043b\u0438 \u043d\u0435 \u0438\u0433\u0440\u0430\u0435\u0442. \u0415\u0433\u043e \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0432\u0438\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0440\u0430\u0432\u043d\u043e\u0441\u0438\u043b\u0435\u043d \u0432\u044b\u0431\u043e\u0440\u0443 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430 \u0441 \u043b\u044e\u0431\u044b\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c. \u041a\u043e\u0434 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430-\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 def partial_KLD(px, qx):         if not all([px, qx]):             return 0         return px * log2(px\/qx)     def top_KLD_outliers(p, q, threshold, include_new=True):     keys = set(p.keys()).union(q.keys())     result = {}     for key in keys:         if key in p and key not in q:             if include_new:                 result[key] = float('inf')         elif key in p and key in q:             pkld = partial_KLD(float(p[key]), float(q[key]))             if pkld > threshold:                 result[key] = pkld     return result<\/code><\/pre>\n<p>D<sub>KL<\/sub>(P\u2016Q) \u2014 \u0431\u0435\u0437\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430. \u0427\u0435\u043c\u0443 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u0430? \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043b\u043e\u0432 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c D<sub>KL<\/sub>(P\u2016Q)=0. \u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0432\u043e \u0440\u0435\u0434\u043a\u043e\u0435, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041e\u0431\u0430 \u044d\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u044f \u043c\u043d\u0435 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b: \u043b\u0438\u0431\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0438\u0437\u043a\u043e\u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043b\u0438\u0431\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u043a\u043e\u0440\u043f\u0443\u0441\u0430\u0445 \u0441\u043b\u043e\u0432\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043e\u0442\u0441\u0435\u043a\u0430\u044e, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u043e\u0442\u0441\u0435\u0447\u043a\u0443 \u043f\u043e D<sub>KL<\/sub>(P\u2016Q) \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 0,0001:<\/p>\n<pre><code class=\"python\"># \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u043b\u0435\u043c\u043c \u043c\u0430\u043b\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 outliers = top_KLD_outliers(investigate, reference, 0.0001, False)<\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 D<sub>KL<\/sub>(P\u2016Q). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 781 \u0441\u043b\u043e\u0432\u043e (\u0430 \u0442\u043e\u0447\u043d\u0435\u0435 781 \u043b\u0435\u043c\u043c\u0430), \u0441\u0430\u043c\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u00ab\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u00bb \u0438 \u00ab\u0433\u043e\u0441\u0443\u0434\u0430\u0440\u044c\u00bb. <\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430\u2014\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0439 \u043c\u0435\u0440\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c D<sub>KL<\/sub>(P\u2016Q) \u2260 D<sub>KL<\/sub>(Q\u2016P). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0430\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u0439 \u0438 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u044b\u0439 \u043a\u043e\u0440\u043f\u0443\u0441\u0430.  <\/p>\n<h2>\u041f\u043e\u0438\u0441\u043a<\/h2>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u2014 \u043f\u043e\u0438\u0441\u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u041b\u0435\u0441\u043a\u043e\u0432\u0430 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u0411\u0430\u0436\u043e\u0432\u0430. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0435\u0441\u0442\u044c \u043b\u0438 \u043e\u043d\u043e \u0441\u0440\u0435\u0434\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0432, \u0438 \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u0431\u0435\u0440\u0443 \u0435\u0433\u043e D<sub>KL<\/sub>(P\u2016Q). \u0414\u0430\u043b\u0435\u0435, \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u044e \u0432\u0441\u0435 D<sub>KL<\/sub>(P\u2016Q), \u0430 \u0437\u0430\u0442\u0435\u043c, \u0434\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0443\u043c\u043d\u043e\u0436\u0430\u044e \u044d\u0442\u0443 \u0441\u0443\u043c\u043c\u0443 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0438 \u0434\u0435\u043b\u044e \u043d\u0430 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432 \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 \u0447\u0438\u0441\u0442\u043a\u0438.  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u043f\u043e \u03a3D<sub>KL<\/sub>(P\u2016Q) \u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u043e\u0442\u0441\u0435\u0447\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u043d\u0430\u0431\u043e\u0440 \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u044b \u041b\u0435\u0441\u043a\u043e\u0432\u0430.    <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432  def find_specificity(cell):     total_specificity = 0     total_specific_words = 0     for key in cell:         total_clean_words = len(cell)         if key in outliers:             total_specificity += float(outliers[key])             total_specific_words += 1     return total_specificity*total_specific_words\/total_clean_words  # \u0441\u0442\u0440\u043e\u0438\u043c \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 reference_corpus['specificity'] = reference_corpus['clean_text'].apply(find_specificity) reference_corpus = reference_corpus.sort_values(by='specificity', ascending=False)<\/code><\/pre>\n<h2>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0442\u0441\u0435\u0447\u043a\u0443?  <\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0442\u043e\u043f-50 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432. \u0422\u0435 \u0442\u0435\u043a\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0448\u0435 0,74 \u2014 \u044d\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0442\u0435\u043a\u0441\u0442\u044b<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-364103","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364103","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=364103"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364103\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}