{"id":373949,"date":"2024-05-21T05:48:28","date_gmt":"2024-05-21T05:48:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=373949"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=373949","title":{"rendered":"<span>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0436\u0430\u043d\u0440\u0430 \u0444\u0438\u043b\u044c\u043c\u0430 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e<\/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<div class=\"persona\"><img class=\"image persona__image\"\/><\/p>\n<h5 class=\"persona__heading\">\u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438: \u041e\u043b\u0435\u0433 \u0411\u043b\u043e\u0445\u0438\u043d<\/h5>\n<p>\u0412\u044b\u043f\u0443\u0441\u043a\u043d\u0438\u043a OTUS<\/p>\n<\/div>\n<p>\u0412 \u0445\u043e\u0434\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0435\u043c\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u043a\u0443\u0440\u0441 <a href=\"https:\/\/otus.pw\/ZF1Y\/\">Machine Learning. Professional<\/a>, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u0444\u0438\u043b\u044c\u043c\u0430\u0445, \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c\u0430\u0445, \u0441\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u0438 \u043f\u0440\u043e\u0447\u0435\u0439 \u0441\u0445\u043e\u0436\u0435\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u0438. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043e\u0436\u0430\u043b\u0435\u044f, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0438\u043d\u043e\u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u044e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0442, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<h3>\u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u043c\u043e\u0432) \u0441 \u0441\u0430\u0439\u0442\u0430 <a href=\"https:\/\/www.kinopoisk.ru\/\">\u041a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a<\/a>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0444\u0438\u043b\u044c\u043c\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0436\u0430\u043d\u0440 \u043a\u0430\u0440\u0442\u0438\u043d\u044b.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/22d\/93f\/96e\/22d93f96e70f50de2f5e574823221e21.png\" width=\"1042\" height=\"611\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/22d\/93f\/96e\/22d93f96e70f50de2f5e574823221e21.png\"\/><\/figure>\n<p>\u0410 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0444\u0438\u043b\u044c\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u043e\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fc1\/be8\/3b7\/fc1be83b7155e9c0a6980c60360f58ed.png\" width=\"1269\" height=\"1500\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fc1\/be8\/3b7\/fc1be83b7155e9c0a6980c60360f58ed.png\"\/><\/figure>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0443\u0434\u0438\u0432\u0448\u0438\u0441\u044c, \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import numpy as np   # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446, \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u043b\u0438\u043d\u0430\u043b\u0430 import pandas as pd  # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0447\u0435\u043a import time          # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438  from selenium import webdriver   browser = webdriver.Firefox() time.sleep(0.3) browser.implicitly_wait(0.3)   from bs4 import BeautifulSoup from lxml import etree from tqdm.notebook import tqdm  def get_dom(page_link):     browser.get(page_link)     html = browser.page_source     soup = BeautifulSoup(html, 'html.parser')      return etree.HTML(str(soup))   def get_listpage_links(page_no):     # page_link = f'https:\/\/www.kinopoisk.ru\/lists\/movies\/year--2010-2019\/?page={page_no}'     page_link = f'https:\/\/www.kinopoisk.ru\/lists\/movies\/year--2021\/?page={page_no}'     dom = get_dom(page_link)      return dom.xpath(\"body\/\/div[@data-tid='8a6cbb06']\/a[@href]\/@href\")  def get_moviepage_info(movie_link):     page_link = 'https:\/\/www.kinopoisk.ru' + movie_link     dom = get_dom(page_link)      elem = dom.xpath(\"body\/\/div\/span\/\/span[@data-tid='939058a8']\")     rating = elem[0].text if elem else ''     elem = dom.xpath(\"body\/\/div\/\/h1[@data-tid='f22e0093']\/span\")     name = elem[0].text if elem else ''      features = {}     elem = dom.xpath(\"body\/\/div\/div[@data-test-id='encyclopedic-table' and @data-tid='bd126b5e']\")[0]     for child in elem.getchildren():         #print(etree.tostring(child))         feature = child.xpath('div[1]')[0].text         ahrefs = child.xpath('div[position()>1]\/\/a[text()] | div[position()>1]\/\/div[text() and not(*)] | div[position()>1]\/\/span[text()]')         values = [ahr.text for ahr in ahrefs]         features[feature] = values      elem = dom.xpath(\"body\/\/div\/p[text() and not(*) and @data-tid='bfd38da2']\")     short_descr = elem[0].text if elem else ''      elem = dom.xpath(\"body\/\/div\/p[text() and not(*) and @data-tid='bbb11238']\")     descr = ' '.join([x.text for x in elem])      return (name, rating, short_descr, descr, features)  _df = pd.DataFrame(columns=['id', 'type', 'name', 'rating', 'short_descr', 'descr', 'features']) for page_number in tqdm(range(1, 912), desc='List pages'):     try:         links = get_listpage_links(page_number)         _df = pd.DataFrame(columns=['id', 'type', 'name', 'rating', 'short_descr', 'descr', 'features'])         for movie_link in links:           movie_id = movie_link.split('\/')[1:3]           name, rating, short_descr, descr, features = get_moviepage_info(movie_link)           data_row = {'id':movie_id[1], 'type':movie_id[0], 'name':name, 'rating':rating, 'short_descr':short_descr, 'descr':descr, 'features': features}           _df = pd.concat([_df, pd.DataFrame([data_row])], ignore_index=True)         with open('kinopoisk_2010-2019.csv', 'a') as f:             _df.to_csv(f, mode='a', header=f.tell()==0, index=False)     except Exception as err:         print(f\"Unexpected {err=}, {type(err)=}\")  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0442\u043e\u0433\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e\u0435\u043b\u043e \u0436\u0434\u0430\u0442\u044c) \u0441\u0442\u0430\u043b\u0438 \u0441\u0432\u044b\u0448\u0435 50 \u0442\u044b\u0441\u044f\u0447 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e \u0444\u0438\u043b\u044c\u043c\u0430\u0445. \u041d\u0430\u043c, \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u0436\u0430\u043d\u0440\u043e\u0432.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c62\/8f8\/0ea\/c628f80ea74c96c3d0eee71173890431.png\" alt=\"\u041d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"1316\" height=\"546\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c62\/8f8\/0ea\/c628f80ea74c96c3d0eee71173890431.png\"\/><\/p>\n<div><figcaption>\u041d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0436\u0430\u043d\u0440\u043e\u0432, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cbc\/210\/7fa\/cbc2107fac6b143436228fc29d4c3502.png\" alt=\"alt\" title=\"\" width=\"361\" height=\"338\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cbc\/210\/7fa\/cbc2107fac6b143436228fc29d4c3502.png\"\/><\/figure>\n<p>\u0418\u0437\u0431\u0430\u0432\u0438\u043c\u0441\u044f \u043e\u0442 \u0442\u0435\u0445 \u0436\u0430\u043d\u0440\u043e\u0432, \u0433\u0434\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u0435\u043d\u044c\u0448\u0435 100, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0443\u0431\u0435\u0440\u0435\u043c \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0436\u0430\u043d\u0440 &#171;&#8212;&#171;. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0430\u043a\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 26 \u0436\u0430\u043d\u0440\u043e\u0432 \u0438 \u0431\u043e\u043b\u0435\u0435 53 \u0442\u044b\u0441\u044f\u0447 \u0444\u0438\u043b\u044c\u043c\u043e\u0432. \u0414\u043e\u043b\u0436\u043d\u043e \u0445\u0432\u0430\u0442\u0438\u0442\u044c \ud83d\ude42<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4b2\/2ca\/72e\/4b22ca72e017229c120885ba3cef9277.png\" alt=\"alt\" title=\"\" width=\"332\" height=\"259\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4b2\/2ca\/72e\/4b22ca72e017229c120885ba3cef9277.png\"\/><\/figure>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b multi-class \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u043c\u0438 (\u0447\u0442\u043e \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0434\u0430\u0436\u0435 \u0437\u0440\u0438\u0442\u0435\u043b\u044e-\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0435\u0433\u043e \u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 &#8212; \u0434\u0440\u0430\u043c\u044b, \u043a\u043e\u043c\u0435\u0434\u0438\u0438 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u0435\u043b\u043e\u0434\u0440\u0430\u043c\u044b), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u044d\u0442\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0441 \u043c\u043e\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u0436\u0430\u043d\u0440\u044b, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435, \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: \u0431\u043e\u0435\u0432\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 (\u0430 &#171;\u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c&#187; \u0438 &#171;\u0431\u043e\u0435\u0432\u0438\u043a&#187; &#8212; \u0440\u0430\u0437\u043d\u044b\u0435 \u0436\u0430\u043d\u0440\u044b \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a\u0430), \u0430 \u0430\u043d\u0438\u043c\u0435 &#8212; \u0438 \u0432\u043e\u0432\u0441\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c\u043e\u043c (\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u044f\u0442 \u043c\u043d\u0435 \u043c\u043e\u0435 \u043d\u0435\u0432\u0435\u0436\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0436\u0430\u043d\u0440\u0430, \u0435\u0441\u043b\u0438 \u044f \u043e\u0448\u0438\u0431\u0430\u044e\u0441\u044c \ud83d\ude42 ). \u0412 \u043e\u0431\u0449\u0435\u043c, \u043f\u0440\u0438\u043c\u0435\u043c \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0438\u043b\u044c\u043c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043b\u0438\u0448\u044c \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0436\u0430\u043d\u0440\u0443, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 multilabel \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u043e\u043c\u0443 \u0444\u0438\u043b\u044c\u043c\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0442\u043e\u043a \u0440\u0430\u0437\u043d\u044b\u0445 \u0436\u0430\u043d\u0440\u043e\u0432.<\/p>\n<p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 sklearn. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 DataFrame (pandas.DataFrame) \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 genre_multi, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0436\u0430\u043d\u0440\u043e\u0432 (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 &#171;\u0434\u0440\u0430\u043c\u0430,\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b,\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f,\u043a\u043e\u043c\u0435\u0434\u0438\u044f&#187;). \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0436\u0430\u043d\u0440\u0430-\u043a\u043b\u0430\u0441\u0441\u0430, \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0443\u043b\u0438 \u0438\u043b\u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0438, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0443\u043a\u0430\u0437\u0430\u043d \u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0436\u0430\u043d\u0440 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u044b, \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"> from sklearn.preprocessing import MultiLabelBinarizer mlb = MultiLabelBinarizer() mlb_result = mlb.fit_transform([str(data.loc[i,'genre_multi']).split(',') for i in range(len(data))]) data = pd.concat([data, pd.DataFrame(mlb_result, columns = list(mlb.classes_))], axis=1)  target_strings = mlb.classes_  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>name<\/p>\n<\/th>\n<th>\n<p>descr<\/p>\n<\/th>\n<th>\n<p>lemmatized_descr<\/p>\n<\/th>\n<th>\n<p>genre_multi<\/p>\n<\/th>\n<th>\n<p>\u0430\u043d\u0438\u043c\u0435<\/p>\n<\/th>\n<th>\n<p>\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u0431\u043e\u0435\u0432\u0438\u043a<\/p>\n<\/th>\n<th>\n<p>\u0432\u0435\u0441\u0442\u0435\u0440\u043d<\/p>\n<\/th>\n<th>\n<p>\u0432\u043e\u0435\u043d\u043d\u044b\u0439<\/p>\n<\/th>\n<th>\n<p>\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432<\/p>\n<\/th>\n<th>\n<p>&#8230;<\/p>\n<\/th>\n<th>\n<p>\u043c\u044e\u0437\u0438\u043a\u043b<\/p>\n<\/th>\n<th>\n<p>\u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0422\u0412<\/p>\n<\/th>\n<th>\n<p>\u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439<\/p>\n<\/th>\n<th>\n<p>\u0441\u043f\u043e\u0440\u0442<\/p>\n<\/th>\n<th>\n<p>\u0442\u043e\u043a-\u0448\u043e\u0443<\/p>\n<\/th>\n<th>\n<p>\u0442\u0440\u0438\u043b\u043b\u0435\u0440<\/p>\n<\/th>\n<th>\n<p>\u0443\u0436\u0430\u0441\u044b<\/p>\n<\/th>\n<th>\n<p>\u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0430<\/p>\n<\/th>\n<th>\n<p>\u0444\u044d\u043d\u0442\u0435\u0437\u0438<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1+1 (2011)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0432 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0441\u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u0431\u043e\u0433&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435\u0441\u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u043e\u0433\u0430\u0442\u044b\u0439&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0440\u0430\u043c\u0430,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0414\u0436\u0435\u043d\u0442\u043b\u044c\u043c\u0435\u043d\u044b (2019)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0434\u0438\u043d \u0443\u0448\u043b\u044b\u0439 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0435\u0446 \u0435\u0449\u0451 \u0441\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0435\u0442 &#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0443\u0448\u043b\u044b\u0439 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0435\u0446 \u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u043e\u0434 \u043f\u0440\u0438\u0442\u043e\u0440\u0433\u043e\u0432\u044b\u0432\u0430&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u0431\u043e\u0435\u0432\u0438\u043a<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u043e\u043b\u043a \u0441 \u0423\u043e\u043b\u043b-\u0441\u0442\u0440\u0438\u0442 (2013)<\/p>\n<\/td>\n<td>\n<p align=\"left\">1987 \u0433\u043e\u0434. \u0414\u0436\u043e\u0440\u0434\u0430\u043d \u0411\u0435\u043b\u0444\u043e\u0440\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u043c &#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0433\u043e\u0434 \u0434\u0436\u043e\u0440\u0434\u0430\u043d \u0431\u0435\u043b\u0444\u043e\u0440\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0431\u0440\u043e\u043a\u0435\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u044b&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0440\u0430\u043c\u0430,\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b,\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f,\u043a\u043e\u043c\u0435\u0434\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0438<\/h3>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0438 &#8212; \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 &#171;\u043c\u0435\u0442\u043e\u043a&#187;: \u043f\u0440\u0438 multilabel-\u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0442\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u0435\u043a \u0434\u043b\u0438\u043d\u044b N, \u0433\u0434\u0435 N &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0436\u0430\u043d\u0440\u043e\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u0440\u0430\u0432\u043d\u043e 2<sup>26<\/sup>, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/> \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 train_test_split \u0441 \u043e\u043f\u0446\u0438\u0435\u0439 stratify \u0438\u0437 sklearn.model_selection \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0432\u0441\u0435\u043c\u0438\u0440\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u0435 2011 \u0433\u043e\u0434\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from iterstrat.ml_stratifiers import MultilabelStratifiedShuffleSplit from sklearn.utils import indexable, _safe_indexing from sklearn.utils.validation import _num_samples from sklearn.model_selection._split import _validate_shuffle_split from itertools import chain  def multilabel_train_test_split(*arrays,                                 test_size=None,                                 train_size=None,                                 random_state=None,                                 shuffle=True,                                 stratify=None):     \"\"\"     Train test split for multilabel classification. Uses the algorithm from:      'Sechidis K., Tsoumakas G., Vlahavas I. (2011) On the Stratification of Multi-Label Data'.     \"\"\"     if stratify is None:         return train_test_split(*arrays, test_size=test_size,train_size=train_size,                                 random_state=random_state, stratify=None, shuffle=shuffle)          assert shuffle, \"Stratified train\/test split is not implemented for shuffle=False\"          n_arrays = len(arrays)     arrays = indexable(*arrays)     n_samples = _num_samples(arrays[0])     n_train, n_test = _validate_shuffle_split(         n_samples, test_size, train_size, default_test_size=0.25     )     cv = MultilabelStratifiedShuffleSplit(test_size=n_test, train_size=n_train, random_state=random_state)     train, test = next(cv.split(X=arrays[0], y=stratify))      return list(         chain.from_iterable(             (_safe_indexing(a, train), _safe_indexing(a, test)) for a in arrays         )     )  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043e\u0442\u0447\u0435\u0442\u044b \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435, \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 20% \u043e\u0442 \u0432\u0441\u0435\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b<\/h3>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u043e &#171;\u0444\u0438\u043b\u044c\u043c&#187;.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import nltk nltk.download('stopwords') stop_words = nltk.corpus.stopwords.words('russian') stop_words.append('\u0444\u0438\u043b\u044c\u043c') #word_tokenizer = nltk.WordPunctTokenizer()  import re regex = re.compile(r'[\u0410-\u042f\u0430-\u044fA-z\u0451\u0401-]+')  def words_only(text, regex=regex):     try:         return \" \".join(regex.findall(text)).lower()     except:         return \"\"  from pymystem3 import Mystem from string import punctuation  mystem = Mystem()   #Preprocess function def preprocess_text(text):     text = words_only(text)     tokens = mystem.lemmatize(text.lower())     tokens = [token for token in tokens if token not in stop_words\\               and token != \" \" \\               and token.strip() not in punctuation]          text = \" \".join(tokens)          return text<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>\u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0438 TF-IDF<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u044b\u043b\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tf%E2%80%93idf\">TF-IDF<\/a>. Multilabel \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c &#171;\u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f&#187; \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 sklearn \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0436\u0435 <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.multioutput.MultiOutputClassifier.html\">MultiOutputClassifier<\/a> \u0438\u0437 \u0432\u0441\u0435 \u0442\u043e\u0439 \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 sklearn. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 pipeline \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0434\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0434\u043b\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0438 \u0441\u0430\u043c\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438. \u0423\u0434\u043e\u0431\u043d\u043e!<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">pipe = Pipeline([     ('tfidf', TfidfVectorizer(max_features=1700, min_df=0.0011, max_df=0.35, norm='l2')),     ('logregr', MultiOutputClassifier(estimator= LogisticRegression(max_iter=10000, class_weight='balanced', multi_class='multinomial', C=0.009, penalty='l2'))), ])  pipe.fit(train_texts, train_y)  pred_y = pipe.predict(test_texts) print(classification_report(y_true=test_y, y_pred=pred_y, target_names=target_strings))  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0442\u0447\u0435\u0442 \u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/158\/e6a\/ad5\/158e6aad50b81cebbee261a0af43902f.png\" alt=\"alt\" width=\"462\" height=\"580\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/158\/e6a\/ad5\/158e6aad50b81cebbee261a0af43902f.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0430\u0431\u0435\u0433\u0430\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u043f\u0435\u0440\u0435\u0434, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u0435\u0442\u0440\u0438\u043a\u0438 recall \u0443 \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0441\u0430\u043c\u044b\u043c\u0438 \u0432\u044b\u0441\u043e\u043a\u0438\u043c\u0438 \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0432\u0448\u0438\u0445 \u0432 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435.<br \/> \u0414\u0430 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c &#8212; \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0436\u0430\u043d\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440.<\/p>\n<h4>Catboost + TF-IDF<\/h4>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043c \u0441 <a href=\"https:\/\/catboost.ai\/\">Catboost<\/a>. \u0425\u043e\u0442\u044f Catboost \u0441\u0430\u043c &#171;\u0443\u043c\u0435\u0435\u0442 \u0432 multilabel \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e&#187;, \u043c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0435\u043c (\u0437\u0430\u0447\u0435\u043c \u043c\u044b \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0435\u043c &#8212; \u0441\u0442\u0430\u043d\u0435\u0442 \u044f\u0441\u043d\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435): \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 &#171;\u0437\u0430\u0432\u0435\u0440\u043d\u0435\u043c&#187; CatBoostClassifier \u0432 MultiOutputClassifier. \u0417\u0430\u043e\u0434\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 multilabel \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Catboost. \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434: \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u043b\u0438\u0441\u044c \u043c\u0430\u043b\u043e, \u0437\u0430\u0442\u043e \u0441 MultiOutputClassifier \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 CPU \u0437\u0430 89 \u043c\u0438\u043d\u0443\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 150 \u043c\u0438\u043d\u0443\u0442 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 multilabel \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Catboost.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 MultiOutputClassifier<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from catboost import CatBoostClassifier  pipe2 = Pipeline([     ('tfidf', TfidfVectorizer(max_features=1700, min_df=0.0031, max_df=0.4, norm='l2')),     ('gboost', MultiOutputClassifier(estimator= CatBoostClassifier(task_type='CPU', verbose=False))), ])  pipe2.fit(train_texts, train_y)  pred_y = pipe2.predict(test_texts) print(classification_report(y_true=test_y, y_pred=pred_y, target_names=target_strings))<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0435\u0437 MultiOutputClassifier<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">pipe3 = Pipeline([     ('tfidf', TfidfVectorizer(max_features=1700, min_df=0.0031, max_df=0.4, norm='l2')),     ('gboost', CatBoostClassifier(task_type='CPU', loss_function='MultiLogloss',  class_names=target_strings, verbose=False)), ])  pipe3.fit(train_texts, train_y)  pred_y = pipe3.predict(test_texts) print(classification_report(y_true=test_y, y_pred=pred_y, target_names=target_strings))<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Catboost <strong>\u0441 MultiOutputClassifier<\/strong> :<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/108\/2f3\/8ba\/1082f38bac43ca0500479589b4ae6b73.png\" alt=\"alt\" width=\"458\" height=\"579\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/108\/2f3\/8ba\/1082f38bac43ca0500479589b4ae6b73.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Catboost <strong>\u0431\u0435\u0437 MultiOutputClassifier<\/strong> :<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4d0\/4e2\/0b6\/4d04e20b6233db71e965bdd85298a034.png\" alt=\"alt\" width=\"455\" height=\"581\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4d0\/4e2\/0b6\/4d04e20b6233db71e965bdd85298a034.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0443 Catboost \u0443\u043a\u043b\u043e\u043d \u0441\u043a\u043e\u0440\u0435\u0435 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 precision, \u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 recall \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c, \u0437\u0430\u0447\u0435\u043c \u043c\u043d\u0435 \u0431\u044b\u043b \u043d\u0443\u0436\u0435\u043d MultiOutputClassifier \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0430: \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043b\u043e\u0432\u0430, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0436\u0430\u043d\u0440\u0430. \u0427\u0442\u043e \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0438 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0435\u043c. \u0410 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0441\u043b\u043e\u0432 \ud83d\ude42<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import matplotlib.pyplot as plt from wordcloud import WordCloud  def gen_wordcloud(words, importances):     d = {}     for i, word in enumerate(words):         d[word] = abs(importances[i])      wordcloud = WordCloud()     wordcloud.generate_from_frequencies(frequencies=d)      return wordcloud  for idx, x in enumerate(target_strings):     c1 = pipe['logregr'].estimators_[idx].coef_[0]     words1 = pipe['tfidf'].get_feature_names_out()     wc1 = gen_wordcloud(words1, c1)      c2 = pipe2['gboost'].estimators_[idx].feature_importances_     words2 = pipe2['tfidf'].get_feature_names_out()     wc2 = gen_wordcloud(words2, c2)      f, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 10))      ax1.imshow(wc1, interpolation=\"bilinear\")     ax1.set_title(f'Log regr - {x}')     ax1.axis('off')     ax2.imshow(wc2, interpolation=\"bilinear\")     ax2.set_title(f'Catboost - {x}')     ax2.axis('off')      plt.tight_layout()<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4ba\/1a3\/99a\/4ba1a399a2566c96408215a56e1286b5.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4ba\/1a3\/99a\/4ba1a399a2566c96408215a56e1286b5.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7d8\/da2\/c93\/7d8da2c93e97ea571fc58f8802e04593.png\" alt=\"alt\" width=\"1189\" height=\"330\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7d8\/da2\/c93\/7d8da2c93e97ea571fc58f8802e04593.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/266\/346\/43a\/26634643a647b9e002b7543c7f06ae7f.png\" alt=\"alt\" width=\"1189\" height=\"330\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/266\/346\/43a\/26634643a647b9e002b7543c7f06ae7f.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 23 \u0436\u0430\u043d\u0440\u0430<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4df\/ad7\/31f\/4dfad731fc9b24b3c408aaccb5d2ae0f.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4df\/ad7\/31f\/4dfad731fc9b24b3c408aaccb5d2ae0f.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/537\/523\/89f\/53752389f74fb44e29b13d4fd8ed5f33.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/537\/523\/89f\/53752389f74fb44e29b13d4fd8ed5f33.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/66e\/17c\/2da\/66e17c2da817df40bf97ce55737c3c96.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/66e\/17c\/2da\/66e17c2da817df40bf97ce55737c3c96.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a5a\/674\/448\/a5a674448c8ea50a1c6229b078f6578d.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a5a\/674\/448\/a5a674448c8ea50a1c6229b078f6578d.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6c2\/fdd\/d3c\/6c2fddd3c6801ca080010ddb41d03e65.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6c2\/fdd\/d3c\/6c2fddd3c6801ca080010ddb41d03e65.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c52\/7ad\/b01\/c527adb01adb68c9fb3c059c41fe41ad.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c52\/7ad\/b01\/c527adb01adb68c9fb3c059c41fe41ad.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1d1\/c7d\/030\/1d1c7d03006e80b04cef77118eeaf67b.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1d1\/c7d\/030\/1d1c7d03006e80b04cef77118eeaf67b.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bee\/fc6\/19d\/beefc619d9ac3a62cc29b476b2d8b2dd.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bee\/fc6\/19d\/beefc619d9ac3a62cc29b476b2d8b2dd.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d03\/850\/673\/d03850673b0df62acdb9df27a7f25292.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d03\/850\/673\/d03850673b0df62acdb9df27a7f25292.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c88\/9ec\/d43\/c889ecd43379e68f27d2e74d685f3ad3.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c88\/9ec\/d43\/c889ecd43379e68f27d2e74d685f3ad3.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8ab\/ebb\/429\/8abebb4298e64bc1f9fd8d5ddf899e1e.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ab\/ebb\/429\/8abebb4298e64bc1f9fd8d5ddf899e1e.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c5b\/a77\/d4c\/c5ba77d4c697ca2728f0d54b15ea3a34.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c5b\/a77\/d4c\/c5ba77d4c697ca2728f0d54b15ea3a34.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d35\/204\/2d7\/d352042d7270fe169a23879e890d3c93.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d35\/204\/2d7\/d352042d7270fe169a23879e890d3c93.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b5d\/590\/662\/b5d590662686bdc36bebe3b0dc7b5965.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b5d\/590\/662\/b5d590662686bdc36bebe3b0dc7b5965.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b75\/5aa\/e58\/b755aae58e170095f4543ae9bed3ff00.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b75\/5aa\/e58\/b755aae58e170095f4543ae9bed3ff00.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/471\/205\/3d8\/4712053d8a09b0c961bf93d4113df251.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/471\/205\/3d8\/4712053d8a09b0c961bf93d4113df251.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/094\/afa\/fe1\/094afafe1c10874299f425aa92dc1934.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/094\/afa\/fe1\/094afafe1c10874299f425aa92dc1934.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0b8\/4b6\/88b\/0b84b688b9e4b58f8da47f45b422ae26.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b8\/4b6\/88b\/0b84b688b9e4b58f8da47f45b422ae26.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1b3\/da4\/0f9\/1b3da40f97bfd53c653ca08e31445172.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1b3\/da4\/0f9\/1b3da40f97bfd53c653ca08e31445172.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/02a\/8f9\/fda\/02a8f9fdafd7ddfdc25443563ed137a9.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/02a\/8f9\/fda\/02a8f9fdafd7ddfdc25443563ed137a9.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/db3\/e8f\/4d6\/db3e8f4d620f5c11c386660a98132e61.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/db3\/e8f\/4d6\/db3e8f4d620f5c11c386660a98132e61.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d04\/fd7\/09c\/d04fd709c805017a6ff3a0661d6c4bbb.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d04\/fd7\/09c\/d04fd709c805017a6ff3a0661d6c4bbb.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8b7\/b0d\/acc\/8b7b0dacc973302e03990745de30e416.png\" alt=\"alt\" width=\"1189\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8b7\/b0d\/acc\/8b7b0dacc973302e03990745de30e416.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0438 Catboost \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0434\u043b\u044f \u0436\u0430\u043d\u0440\u0430 &#171;\u0434\u0440\u0430\u043c\u0430&#187;, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043e\u0433\u0430\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0438\u043c \u043b\u0438\u0448\u044c \u043d\u0435\u043d\u0430\u0434\u043e\u043b\u0433\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<h3>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/h3>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u043e \u043d\u0438\u0445, \u0442\u043e \u0431\u0438\u0448\u044c \u043e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0435\u0445\u043d\u0438\u043a\u0443 fine-tuning \u043a \u043f\u0440\u0435\u0434\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043d\u044b\u043c NLP \u043c\u043e\u0434\u0435\u043b\u044f\u043c, \u0441 \u0446\u0435\u043b\u044c\u044e \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0436\u0430\u043d\u0440\u0430 \u0444\u0438\u043b\u044c\u043c\u0430 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e.<\/p>\n<p>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0435\u0434\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <a href=\"https:\/\/huggingface.co\/\">huggingface<\/a>:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/huggingface.co\/cointegrated\/rubert-tiny2\"><em>cointegrated\/rubert-tiny2<\/em><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/huggingface.co\/ai-forever\/ruBert-base\"><em>ai-forever\/ruBert-base<\/em><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/huggingface.co\/ai-forever\/ruBert-large\"><em>ai-forever\/ruBert-large<\/em><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/huggingface.co\/ai-forever\/ruRoberta-large\"><em>ai-forever\/ruRoberta-large<\/em><\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438 (tokenizers). \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from transformers import BertTokenizer, AutoTokenizer   selected_model = 'ai-forever\/ruBert-base' # Load the tokenizer. tokenizer = AutoTokenizer.from_pretrained(selected_model)  from torch.utils.data import TensorDataset   def make_dataset(texts, labels):     # Tokenize all of the sentences and map the tokens to thier word IDs.     input_ids = []     attention_masks = []     token_type_ids = []      # For every sentence...     for sent in texts:         # `encode_plus` will:         #   (1) Tokenize the sentence.         #   (2) Prepend the `[CLS]` token to the start.         #   (3) Append the `[SEP]` token to the end.         #   (4) Map tokens to their IDs.         #   (5) Pad or truncate the sentence to `max_length`         #   (6) Create attention masks for [PAD] tokens.         encoded_dict = tokenizer.encode_plus(                             sent,                      # Sentence to encode.                             add_special_tokens = True, # Add '[CLS]' and '[SEP]'                             max_length = 500,          # Pad &amp; truncate all sentences.                             padding='max_length',                             return_attention_mask = True,   # Construct attn. masks.                             return_tensors = 'pt',     # Return pytorch tensors.                             truncation=True,                             return_token_type_ids=True                     )          # Add the encoded sentence to the list.         input_ids.append(encoded_dict['input_ids'])          token_type_ids.append(encoded_dict['token_type_ids'])          # And its attention mask (simply differentiates padding from non-padding).         attention_masks.append(encoded_dict['attention_mask'])      # Convert the lists into tensors.     input_ids = torch.cat(input_ids, dim=0)     token_type_ids = torch.cat(token_type_ids, dim=0)     attention_masks = torch.cat(attention_masks, dim=0)     labels = torch.tensor(labels.values)     dataset = TensorDataset(input_ids, token_type_ids, attention_masks, labels)      return dataset<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 fransformers \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043e\u0441\u043d\u0430\u0449\u0430\u044e\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a\u043b\u0430\u0441\u0441 AutoModelForSequenceClassification. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 problem_type=&#187;multi_label_classification&#187; \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e multilabel \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c: <a href=\"https:\/\/pytorch.org\/docs\/stable\/generated\/torch.nn.BCEWithLogitsLoss.html\">BCEWithLogitsLoss<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import transformers  model = transformers.AutoModelForSequenceClassification.from_pretrained(     selected_model,      problem_type=\"multi_label_classification\",     num_labels = 26, # The number of output labels--2 for binary classification.                     # You can increase this for multi-class tasks.     output_attentions = False, # Whether the model returns attentions weights.     output_hidden_states = False, # Whether the model returns all hidden-states. )<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u043a\u0438, \u043c\u0435\u043d\u044f\u044e\u0449\u0435\u0441\u044f \u043f\u043e \u0445\u043e\u0434\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 tensorboard. \u0413\u0440\u0430\u0444\u0438\u043a\u0438, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from torch.utils.tensorboard import SummaryWriter from sklearn import metrics  def log_metrics(writer, loss, outputs, targets, postfix):     print(outputs)     outputs = np.array(outputs)     predictions = np.zeros(outputs.shape)     predictions[np.where(outputs >= 0.5)] = 1     outputs = predictions     accuracy = metrics.accuracy_score(targets, outputs)     f1_score_micro = metrics.f1_score(targets, outputs, average='micro')     f1_score_macro = metrics.f1_score(targets, outputs, average='macro')     recall_score_micro = metrics.recall_score(targets, outputs, average='micro')     recall_score_macro = metrics.recall_score(targets, outputs, average='macro')     precision_score_micro = metrics.precision_score(targets, outputs, average='micro', zero_division=0.0)     precision_score_macro = metrics.precision_score(targets, outputs, average='macro', zero_division=0.0)      writer.add_scalar(f'Loss\/{postfix}', loss, epoch)     writer.add_scalar(f'Accuracy\/{postfix}', accuracy, epoch)     writer.add_scalar(f'F1 (Micro)\/{postfix}', f1_score_micro, epoch)     writer.add_scalar(f'F1 (Macro)\/{postfix}', f1_score_macro, epoch)     writer.add_scalar(f'Recall (Micro)\/{postfix}', recall_score_micro, epoch)     writer.add_scalar(f'Recall (Macro)\/{postfix}', recall_score_macro, epoch)     writer.add_scalar(f'Precision (Micro)\/{postfix}', precision_score_micro, epoch)     writer.add_scalar(f'Precision (Macro)\/{postfix}', precision_score_macro, epoch)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u043d\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u043e\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u0438\u043c\u0435\u043b\u0441\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0441 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u043e\u0439 NVIDIA GeForce RTX 2080 Ti (12 GB), \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u043e\u0441\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 GPU. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b batch_size, \u0430 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0441\u044c \u0432 \u0440\u0430\u0437\u044b. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u044f \u0441\u043e\u0431\u0440\u0430\u043b \u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">optimizer = torch.optim.AdamW(model.parameters(),                   lr = 2e-5, # args.learning_rate - default is 5e-5, our notebook had 2e-5                   eps = 1e-8 # args.adam_epsilon  - default is 1e-8.                 )  from transformers import get_linear_schedule_with_warmup  # Number of training epochs. The BERT authors recommend between 2 and 4. # We chose to run for 4, but we'll see later that this may be over-fitting the # training data. epochs = model_setup[selected_model]['epochs']  # Total number of training steps is [number of batches] x [number of epochs]. # (Note that this is not the same as the number of training samples). total_steps = len(train_dataloader) * epochs  # Create the learning rate scheduler. scheduler = get_linear_schedule_with_warmup(optimizer,                                             num_warmup_steps = 0, # Default value in run_glue.py                                             num_training_steps = total_steps)  from tqdm import tqdm  def train(epoch):     # print(f'Epoch {epoch+1} training started.')     total_train_loss = 0     model.train()     fin_targets=[]     fin_outputs=[]     with tqdm(train_dataloader, unit=\"batch\") as tepoch:         for data in tepoch:             tepoch.set_description(f\"Epoch {epoch+1}\")             ids = data[0].to(device, dtype = torch.long)             mask = data[2].to(device, dtype = torch.long)             token_type_ids = data[1].to(device, dtype = torch.long)             targets = data[3].to(device, dtype = torch.float)              res = model(ids,                              token_type_ids=None,                              attention_mask=mask,                              labels=targets)             loss = res['loss']             logits = res['logits']              optimizer.zero_grad()             total_train_loss += loss.item()             fin_targets.extend(targets.cpu().detach().numpy().tolist())             fin_outputs.extend(torch.sigmoid(logits).cpu().detach().numpy().tolist())              optimizer.zero_grad()             loss.backward()             torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)             optimizer.step()             scheduler.step()             tepoch.set_postfix(loss=loss.item())          return total_train_loss \/ len(train_dataloader), fin_outputs, fin_targets   def validate(epoch):     model.eval()     fin_targets=[]     fin_outputs=[]     total_loss = 0.0     with torch.no_grad():         for step, data in enumerate(test_dataloader, 0):             ids = data[0].to(device, dtype = torch.long)             mask = data[2].to(device, dtype = torch.long)             token_type_ids = data[1].to(device, dtype = torch.long)             targets = data[3].to(device, dtype = torch.float)             res = model(ids,                              token_type_ids=None,                              attention_mask=mask,                              labels=targets)             loss = res['loss']             logits = res['logits']             total_loss += loss.item()             fin_targets.extend(targets.cpu().detach().numpy().tolist())             fin_outputs.extend(torch.sigmoid(logits).cpu().detach().numpy().tolist())     return total_loss\/len(test_dataloader), fin_outputs, fin_targets  writer = SummaryWriter(comment= '-' + selected_model.replace('\/', '-'))  for epoch in range(epochs):     avg_train_loss, outputs, targets = train(epoch)      log_metrics(writer, avg_train_loss, outputs, targets, 'train')          avg_val_loss, outputs, targets = validate(epoch)     log_metrics(writer, avg_val_loss, outputs, targets, 'val')<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u044f \u043f\u0440\u0438\u0432\u0435\u043b \u0440\u044f\u0434\u043e\u043c &#171;\u043b\u0435\u0433\u0435\u043d\u0434\u0443&#187;, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u043a \u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438.\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c14\/806\/5c6\/c148065c62a72e7d7867157bcbc2caf8.png\" alt=\"alt\" width=\"683\" height=\"255\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c14\/806\/5c6\/c148065c62a72e7d7867157bcbc2caf8.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a34\/f14\/b2b\/a34f14b2bf6f92f09a5b6653231f9165.png\" alt=\"alt\" width=\"309\" height=\"159\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a34\/f14\/b2b\/a34f14b2bf6f92f09a5b6653231f9165.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0443 &#171;\u0441\u0440\u0435\u0434\u043d\u0435\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0439&#187; \u043c\u043e\u0434\u0435\u043b\u0438 &#171;ai-forever\/ruBert-base&#187;. &#171;cointegrated\/rubert-tiny2&#187; \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043f\u043e\u0437\u0430\u0434\u0438 \u043e\u0442 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f, \u0447\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e &#171;\u0431\u043e\u043b\u044c\u0448\u0438\u0435&#187; \u043c\u043e\u0434\u0435\u043b\u0438 &#171;ai-forever\/ruBert-large&#187; \u0438 &#171;ai-forever\/ruRoberta-large&#187; \u0443\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 &#171;ai-forever\/ruBert-large&#187; \u044d\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u043d\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0435 \u0441\u0430\u043c\u044b\u043c\u0438 \u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u043b\u043e \u0431\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043b\u0438\u0434\u0435\u0440\u044b.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u043f\u0440\u043e\u0447\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u041d\u0435 \u0437\u0440\u044f \u0436\u0435 \u044f \u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u043d\u0438\u0445 \u0432\u0440\u0435\u043c\u044f \ud83d\ude42<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9e4\/355\/971\/9e4355971e3bb15d9022350620b7a9ce.png\" alt=\"alt\" width=\"691\" height=\"258\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9e4\/355\/971\/9e4355971e3bb15d9022350620b7a9ce.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73d\/5d4\/b94\/73d5d4b945f21586f5f21c7fe75a0ecd.png\" alt=\"alt\" width=\"696\" height=\"256\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/73d\/5d4\/b94\/73d5d4b945f21586f5f21c7fe75a0ecd.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d84\/f78\/3c7\/d84f783c7996f7c290ea681fbb79111c.png\" alt=\"alt\" width=\"703\" height=\"257\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d84\/f78\/3c7\/d84f783c7996f7c290ea681fbb79111c.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/258\/cc4\/d5f\/258cc4d5f5a157f154aad67c875b824b.png\" alt=\"alt\" width=\"692\" height=\"255\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/258\/cc4\/d5f\/258cc4d5f5a157f154aad67c875b824b.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ea\/bbc\/876\/2eabbc876460baec7d7d54889519471e.png\" alt=\"alt\" width=\"701\" height=\"255\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2ea\/bbc\/876\/2eabbc876460baec7d7d54889519471e.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/85d\/7ea\/037\/85d7ea0370a3f762661db2d430d3cdc9.png\" alt=\"alt\" width=\"690\" height=\"260\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/85d\/7ea\/037\/85d7ea0370a3f762661db2d430d3cdc9.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e loss-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0430 \u0443\u0436\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0442\u044c, \u043c\u0435\u0442\u0440\u0438\u043a\u0438 recall \u0438 f1 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u043b\u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c\u0441\u044f \u0438 \u0434\u0430\u043b\u0435\u0435, \u0430 \u0432\u043e\u0442 \u0441 \u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439 precision \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0445\u0443\u0434\u0448\u0430\u043b\u0430\u0441\u044c.<\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0435\u0449\u0430\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430. \u0416\u0438\u0440\u043d\u044b\u043c \u0448\u0440\u0438\u0444\u0442\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043b\u0443\u0447\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430 &#8212; \u0432\u0440\u0435\u043c\u044f \u0434\u043e \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u0418\u043c\u044f \u043c\u043e\u0434\u0435\u043b\u0438<\/p>\n<\/th>\n<th>\n<p>Loss<\/p>\n<\/th>\n<th>\n<p>Precision (micro\/ macro)<\/p>\n<\/th>\n<th>\n<p>Recall (micro\/ macro)<\/p>\n<\/th>\n<th>\n<p>F1 (micro\/ macro)<\/p>\n<\/th>\n<th>\n<p>Batch size<\/p>\n<\/th>\n<th>\n<p>\u0412\u0440\u0435\u043c\u044f, \u043c\u0438\u043d<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">cointegrated\/rubert-tiny2<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.1819<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.6307 \/ 0.4246<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.373 \/ 0.2136<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.4688 \/ 0.2661<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>25<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">ai-forever\/ruBert-base<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>0.1553<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>0.6863<\/strong> \/ 0.5963<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.5039 \/ 0.4105<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.5811 \/ 0.4907<\/p>\n<\/td>\n<td>\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">57<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">ai-forever\/ruBert-large<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.1582<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.6673 \/ 0.5817<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.4922 \/ 0.3824<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.5665 \/ 0.4482<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">112<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">ai-forever\/ruRoberta-large<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.1644<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.6672 \/ <strong>0.6275<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>0.5457<\/strong> \/ <strong>0.4672<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>0.6004<\/strong> \/ <strong>0.5285<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">320<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e &#171;ai-forever\/ruRoberta-large&#187; \u043d\u0430\u0431\u0440\u0430\u043b\u0430 \u043d\u0430\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043c\u0435\u0442\u0440\u0438\u043a, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u043b\u0443\u0447\u0448\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c. \u0415\u0441\u043b\u0438 \u0431\u044b \u043d\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u044f \u0431\u044b, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043e\u0431\u044a\u044f\u0432\u0438\u043b \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0435\u0435. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435, \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f &#171;ai-forever\/ruBert-base&#187;.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<h4>\u041e\u0442\u0447\u0435\u0442 \u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 ruBERT-base<\/h4>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/adc\/486\/3c5\/adc4863c51146b967b42be68e265014c.png\" alt=\"alt\" width=\"452\" height=\"512\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/adc\/486\/3c5\/adc4863c51146b967b42be68e265014c.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u0443 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 classification report<\/h3>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f<\/h4>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bef\/a22\/a90\/befa22a901526e8bcdc20bd07dc3a381.png\" alt=\"alt\" width=\"462\" height=\"580\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bef\/a22\/a90\/befa22a901526e8bcdc20bd07dc3a381.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<h4>CatBoost<\/h4>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/260\/251\/7a8\/2602517a839a3a14cd535fc119088f75.png\" alt=\"alt\" width=\"454\" height=\"65\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/260\/251\/7a8\/2602517a839a3a14cd535fc119088f75.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<h4>ruBert-base<\/h4>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/31c\/e54\/de8\/31ce54de84e85c415578aa2c5c193ecd.png\" alt=\"alt\" width=\"450\" height=\"63\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/31c\/e54\/de8\/31ce54de84e85c415578aa2c5c193ecd.png\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 recall, \u043a\u0430\u043a \u0440\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0435 \u0443 \u043d\u0430\u0448\u0435\u0439 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 &#8212; \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043c\u0435\u0442\u0440\u0438\u043a precision \u0438 f1 \u043b\u0443\u0447\u0448\u0438\u0435 \u0443 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/h3>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/p>\n<h4>\u0414\u0436\u0435\u043d\u0442\u043b\u044c\u043c\u0435\u043d\u044b (2019)<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/1aa\/50c\/009\/1aa50c009b2e66dcea32ce0863136abc.jpg\" alt=\"alt\" width=\"895\" height=\"505\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1aa\/50c\/009\/1aa50c009b2e66dcea32ce0863136abc.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u041e\u0434\u0438\u043d \u0443\u0448\u043b\u044b\u0439 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0435\u0446 \u0435\u0449\u0451 \u0441\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0435\u0442 \u043f\u0440\u0438\u0442\u043e\u0440\u0433\u043e\u0432\u044b\u0432\u0430\u043b \u043d\u0430\u0440\u043a\u043e\u0442\u0438\u043a\u0430\u043c\u0438, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b \u0441\u0445\u0435\u043c\u0443 \u043d\u0435\u043b\u0435\u0433\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u043e\u0433\u0430\u0449\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0439 \u043e\u0431\u0435\u0434\u043d\u0435\u0432\u0448\u0435\u0439 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0439 \u0430\u0440\u0438\u0441\u0442\u043e\u043a\u0440\u0430\u0442\u0438\u0438 \u0438 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u043e\u0433\u0430\u0442\u0435\u043b. \u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u043d\u044b\u0440\u043b\u0438\u0432\u044b\u0439 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0441\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a \u0420\u044d\u044e, \u043f\u0440\u0430\u0432\u043e\u0439 \u0440\u0443\u043a\u0435 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0446\u0430, \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0442\u043e\u043c\u0443 \u043a\u0443\u043f\u0438\u0442\u044c \u043a\u0438\u043d\u043e\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043f\u0440\u0435\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0431\u043e\u0441\u0441\u0430 \u043f\u0440\u0438 \u0443\u0447\u0430\u0441\u0442\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u043b\u043e\u043d\u0434\u043e\u043d\u0441\u043a\u043e\u0433\u043e \u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u0440\u0430 \u2014 \u043f\u0430\u0440\u0442\u043d\u0451\u0440\u0430-\u0435\u0432\u0440\u0435\u044f, \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u043e\u0439 \u0434\u0438\u0430\u0441\u043f\u043e\u0440\u044b, \u0447\u0435\u0440\u043d\u043e\u043a\u043e\u0436\u0438\u0445 \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u043e\u0432 \u0438 \u0434\u0430\u0436\u0435 \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e \u043e\u043b\u0438\u0433\u0430\u0440\u0445\u0430.<\/p>\n<\/blockquote>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a\u0430: \u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u0431\u043e\u0435\u0432\u0438\u043a<br \/>\u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f: \u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f,\u0431\u043e\u0435\u0432\u0438\u043a,\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439,\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b<br \/>Catboost: \u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b<br \/>BERT: \u0434\u0440\u0430\u043c\u0430,\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b<\/p>\n<h4>\u041a\u0430\u043a \u043f\u0440\u0438\u0440\u0443\u0447\u0438\u0442\u044c \u0434\u0440\u0430\u043a\u043e\u043d\u0430 (2010)<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/a1b\/e4e\/b96\/a1be4eb9676869e5e792716d1c10fd9f.jpg\" alt=\"alt\" width=\"1200\" height=\"598\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a1b\/e4e\/b96\/a1be4eb9676869e5e792716d1c10fd9f.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0412\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u043e\u0434\u0440\u043e\u0441\u0442\u043a\u0430 \u0418\u043a\u043a\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043b\u0438\u0437\u043a\u0438 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438 \u0435\u0433\u043e \u0433\u0435\u0440\u043e\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043b\u0435\u043c\u0435\u043d\u0438, \u043c\u043d\u043e\u0433\u043e \u043b\u0435\u0442 \u0432\u0435\u0434\u0443\u0449\u0435\u0433\u043e \u0432\u043e\u0439\u043d\u0443 \u0441 \u0434\u0440\u0430\u043a\u043e\u043d\u0430\u043c\u0438. \u041c\u0438\u0440 \u0418\u043a\u043a\u0438\u043d\u0433\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u043e\u0433 \u043d\u0430 \u0433\u043e\u043b\u043e\u0432\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442 \u0434\u0440\u0430\u043a\u043e\u043d\u0430 \u0411\u0435\u0437\u0437\u0443\u0431\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0435\u043c\u0443 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0432\u0438\u043a\u0438\u043d\u0433\u0430\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u043c\u0438\u0440 \u0441 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b\u2026<\/p>\n<\/blockquote>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a\u0430: \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c,\u0444\u044d\u043d\u0442\u0435\u0437\u0438,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f,\u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439<\/p>\n<p>\u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f: \u0430\u043d\u0438\u043c\u0435,\u0432\u043e\u0435\u043d\u043d\u044b\u0439,\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439,\u0438\u0441\u0442\u043e\u0440\u0438\u044f,\u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c\u0435\u0442\u0440\u0430\u0436\u043a\u0430,\u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c,\u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f,\u0441\u0435\u043c\u0435\u0439y\u044b\u0439,\u0444\u044d\u043d\u0442\u0435\u0437\u0438<br \/>Catboost: \u0434\u0440\u0430\u043c\u0430<br \/>BERT: \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c,\u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f,\u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439,\u0444\u044d\u043d\u0442\u0435\u0437\u0438<\/p>\n<h4>\u041a\u0430\u043a \u043f\u0440\u043e\u0433\u0443\u043b\u044f\u0442\u044c \u0448\u043a\u043e\u043b\u0443 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0439 (2017)<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/f6c\/312\/759\/f6c31275933355f92339c8b1b50228eb.jpg\" alt=\"alt\" width=\"596\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f6c\/312\/759\/f6c31275933355f92339c8b1b50228eb.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0412\u0441\u043b\u0435\u0434 \u0437\u0430 \u0433\u043e\u0440\u043e\u0434\u0441\u043a\u0438\u043c \u043c\u0430\u043b\u044c\u0447\u0438\u043a\u043e\u043c \u041f\u043e\u043b\u0435\u043c \u0437\u0440\u0438\u0442\u0435\u043b\u044f\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0442\u043e, \u0447\u0435\u043c\u0443 \u0432 \u0448\u043a\u043e\u043b\u0435 \u043d\u0435 \u0443\u0447\u0430\u0442. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u043a\u0430\u043a \u0436\u0438\u0442\u044c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043c\u0438\u0440 \u043b\u0435\u0441\u0430. \u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u0445\u043e\u0437\u044f\u0438\u043d \u2014 \u043c\u0440\u0430\u0447\u043d\u044b\u0439 \u0433\u0440\u0430\u0444, \u0435\u0441\u0442\u044c \u0432\u043b\u0430\u0441\u0442\u044c \u2014 \u0434\u043e\u0431\u0440\u043e\u0434\u0443\u0448\u043d\u044b\u0439, \u043d\u043e \u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u043b\u0435\u0441\u043d\u0438\u0447\u0438\u0439 \u0411\u043e\u0440\u0435\u043b\u044c, \u0438 \u0435\u0441\u0442\u044c \u0431\u0440\u0430\u043a\u043e\u043d\u044c\u0435\u0440 \u0422\u043e\u0442\u043e\u0448 \u2014 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u0440\u0435\u0448\u0438\u0432\u0448\u0438\u0439 \u0431\u044b\u0442\u044c \u0432\u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0430, \u0434\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0442\u0438\u043f.  \u0427\u044c\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u041f\u043e\u043b\u044c: \u0434\u043e\u0431\u0440\u043e\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u043e\u0433\u043e \u043b\u0435\u0441\u043d\u0438\u0447\u0435\u0433\u043e \u0411\u043e\u0440\u0435\u043b\u044f \u0438\u043b\u0438 \u0431\u0440\u0430\u043a\u043e\u043d\u044c\u0435\u0440\u0430 \u0422\u043e\u0442\u043e\u0448\u0430? \u0410 \u043c\u043e\u0436\u0435\u0442, \u044e\u043d\u044b\u0439 \u0441\u043e\u0440\u0432\u0430\u043d\u0435\u0446 \u0438 \u0432\u043e\u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u043d\u0430\u0434\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u0433\u0440\u0430\u0444\u0443?<\/p>\n<\/blockquote>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a\u0430: \u0434\u0440\u0430\u043c\u0430,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439<\/p>\n<p>\u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f: \u0430\u043d\u0438\u043c\u0435,\u0434\u0435\u0442\u0441\u043a\u0438\u0439,\u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c,\u043c\u044e\u0437\u0438\u043a\u043b,\u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f,\u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439,\u0444\u044d\u043d\u0442\u0435\u0437\u0438<br \/>Catboost:<br \/>BERT: \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c,\u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439<\/p>\n<p>\u041c\u043e\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: \u0444\u0438\u043b\u044c\u043c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439, \u0447\u0442\u043e Catboost \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \ud83d\ude42<\/p>\n<h4>\u041a\u0430\u043a \u044f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0432\u0430\u0448\u0443 \u043c\u0430\u043c\u0443<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/1ea\/aba\/73e\/1eaaba73e9ca3d7e326a0c2a9c0ee655.jpg\" alt=\"alt\" width=\"1024\" height=\"597\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1ea\/aba\/73e\/1eaaba73e9ca3d7e326a0c2a9c0ee655.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>alt<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0432\u0443\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u0430\u0445: \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c &#8212; 2034 \u0433\u043e\u0434\u0443, \u0433\u0434\u0435 \u043f\u0430\u043f\u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0435 \u0441 \u043c\u0430\u043c\u043e\u0439 \u0438 \u044d\u0442\u0430\u043f\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u0445 \u0441\u0435\u043c\u044c\u0438, \u0438 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c, \u0433\u0434\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c. \u0413\u0435\u0440\u043e\u0439 \u0441\u0435\u0433\u043e\u0434\u043d\u044f &#8212;  \u043c\u043e\u043b\u043e\u0434\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u0414\u0438\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0449\u0435 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u043a\u0430\u043a \u0441\u043b\u043e\u0436\u0438\u0442\u0441\u044f \u0435\u0433\u043e \u0436\u0438\u0437\u043d\u044c. \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u0435\u043c\u0443 \u0434\u0430\u0436\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0434\u0435\u0432\u0443\u0448\u043a\u0443 \u0441\u0432\u043e\u0435\u0439 \u043c\u0435\u0447\u0442\u044b\u2026 \u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435? \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0414\u0438\u043c\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0435\u0433\u043e \u0434\u0440\u0443\u0437\u044c\u044f: \u041f\u0430\u0448\u0430 \u0438 \u041b\u044e\u0441\u044f \u2013 \u043c\u043e\u043b\u043e\u0434\u0430\u044f \u043f\u0430\u0440\u0430, \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0432\u043e\u0442-\u0432\u043e\u0442 \u043f\u043e\u0436\u0435\u043d\u0438\u0442\u044c\u0441\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u043e\u0431\u0449\u0438\u0439 \u0434\u0440\u0443\u0433 \u042e\u0440\u0430, \u043e\u0440\u0442\u043e\u0434\u043e\u043a\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u043b\u043e\u0441\u0442\u044f\u043a \u0438 \u0446\u0438\u043d\u0438\u043a, \u0447\u0435\u0439 \u0438\u0434\u0435\u0430\u043b \u2013 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c \u043d\u0430 \u043e\u0434\u043d\u0443 \u043d\u043e\u0447\u044c. \u041e\u043d \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0433\u043b\u0443\u043f\u0435\u0435 \u0434\u043e\u043b\u0433\u0438\u0445 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439, \u0430 \u0431\u0440\u0430\u043a \u2013 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435.<\/p>\n<\/blockquote>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a\u0430: \u043a\u043e\u043c\u0435\u0434\u0438\u044f<br \/>\u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f: \u0434\u0440\u0430\u043c\u0430,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u043c\u0435\u043b\u043e\u0434\u0440\u0430\u043c\u0430<br \/>Catboost: \u0434\u0440\u0430\u043c\u0430,\u043c\u0435\u043b\u043e\u0434\u0440\u0430\u043c\u0430<br \/>BERT: \u043a\u043e\u043c\u0435\u0434\u0438\u044f<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043c\u043e\u0435\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0431\u044b\u0432\u0430\u0435\u0442, \u043d\u0435\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u043c\u0430 &#171;\u041a\u0430\u043a \u043f\u0440\u0438\u0440\u0443\u0447\u0438\u0442\u044c \u0434\u0440\u0430\u043a\u043e\u043d\u0430&#187; \u043d\u0430 \u043c\u043e\u0439 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0437\u043b\u044f\u0434, \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0435\u0434\u0438\u0439\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0414\u0430 \u0438 \u043f\u0438\u0441\u0430\u043b\u0438 \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \ud83d\ude42 \u0410 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0436\u0430\u043d\u0440\u0430\u0445 \u043b\u0438\u0448\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435. \u0414\u0430 \u0438 \u043e\u043d\u0430, \u0441\u043a\u043e\u0440\u0435\u0435, \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u0430.<\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0442\u043e\u0436\u0435 \ud83d\ude42<\/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\/808521\/\"> https:\/\/habr.com\/ru\/articles\/808521\/<\/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<div class=\"persona\">\n<h5 class=\"persona__heading\">\u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438: \u041e\u043b\u0435\u0433 \u0411\u043b\u043e\u0445\u0438\u043d<\/h5>\n<p>\u0412\u044b\u043f\u0443\u0441\u043a\u043d\u0438\u043a OTUS<\/p>\n<\/div>\n<p>\u0412 \u0445\u043e\u0434\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0435\u043c\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u043a\u0443\u0440\u0441 <a href=\"https:\/\/otus.pw\/ZF1Y\/\">Machine Learning. Professional<\/a>, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u0444\u0438\u043b\u044c\u043c\u0430\u0445, \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c\u0430\u0445, \u0441\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u0438 \u043f\u0440\u043e\u0447\u0435\u0439 \u0441\u0445\u043e\u0436\u0435\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u0438. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043e\u0436\u0430\u043b\u0435\u044f, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0438\u043d\u043e\u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u044e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0442, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<h3>\u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u043c\u043e\u0432) \u0441 \u0441\u0430\u0439\u0442\u0430 <a href=\"https:\/\/www.kinopoisk.ru\/\">\u041a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a<\/a>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0444\u0438\u043b\u044c\u043c\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0436\u0430\u043d\u0440 \u043a\u0430\u0440\u0442\u0438\u043d\u044b.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0410 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0444\u0438\u043b\u044c\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u043e\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0443\u0434\u0438\u0432\u0448\u0438\u0441\u044c, \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import numpy as np   # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446, \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u043b\u0438\u043d\u0430\u043b\u0430 import pandas as pd  # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0447\u0435\u043a import time          # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438  from selenium import webdriver   browser = webdriver.Firefox() time.sleep(0.3) browser.implicitly_wait(0.3)   from bs4 import BeautifulSoup from lxml import etree from tqdm.notebook import tqdm  def get_dom(page_link):     browser.get(page_link)     html = browser.page_source     soup = BeautifulSoup(html, 'html.parser')      return etree.HTML(str(soup))   def get_listpage_links(page_no):     # page_link = f'https:\/\/www.kinopoisk.ru\/lists\/movies\/year--2010-2019\/?page={page_no}'     page_link = f'https:\/\/www.kinopoisk.ru\/lists\/movies\/year--2021\/?page={page_no}'     dom = get_dom(page_link)      return dom.xpath(\"body\/\/div[@data-tid='8a6cbb06']\/a[@href]\/@href\")  def get_moviepage_info(movie_link):     page_link = 'https:\/\/www.kinopoisk.ru' + movie_link     dom = get_dom(page_link)      elem = dom.xpath(\"body\/\/div\/span\/\/span[@data-tid='939058a8']\")     rating = elem[0].text if elem else ''     elem = dom.xpath(\"body\/\/div\/\/h1[@data-tid='f22e0093']\/span\")     name = elem[0].text if elem else ''      features = {}     elem = dom.xpath(\"body\/\/div\/div[@data-test-id='encyclopedic-table' and @data-tid='bd126b5e']\")[0]     for child in elem.getchildren():         #print(etree.tostring(child))         feature = child.xpath('div[1]')[0].text         ahrefs = child.xpath('div[position()>1]\/\/a[text()] | div[position()>1]\/\/div[text() and not(*)] | div[position()>1]\/\/span[text()]')         values = [ahr.text for ahr in ahrefs]         features[feature] = values      elem = dom.xpath(\"body\/\/div\/p[text() and not(*) and @data-tid='bfd38da2']\")     short_descr = elem[0].text if elem else ''      elem = dom.xpath(\"body\/\/div\/p[text() and not(*) and @data-tid='bbb11238']\")     descr = ' '.join([x.text for x in elem])      return (name, rating, short_descr, descr, features)  _df = pd.DataFrame(columns=['id', 'type', 'name', 'rating', 'short_descr', 'descr', 'features']) for page_number in tqdm(range(1, 912), desc='List pages'):     try:         links = get_listpage_links(page_number)         _df = pd.DataFrame(columns=['id', 'type', 'name', 'rating', 'short_descr', 'descr', 'features'])         for movie_link in links:           movie_id = movie_link.split('\/')[1:3]           name, rating, short_descr, descr, features = get_moviepage_info(movie_link)           data_row = {'id':movie_id[1], 'type':movie_id[0], 'name':name, 'rating':rating, 'short_descr':short_descr, 'descr':descr, 'features': features}           _df = pd.concat([_df, pd.DataFrame([data_row])], ignore_index=True)         with open('kinopoisk_2010-2019.csv', 'a') as f:             _df.to_csv(f, mode='a', header=f.tell()==0, index=False)     except Exception as err:         print(f\"Unexpected {err=}, {type(err)=}\")  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0442\u043e\u0433\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e\u0435\u043b\u043e \u0436\u0434\u0430\u0442\u044c) \u0441\u0442\u0430\u043b\u0438 \u0441\u0432\u044b\u0448\u0435 50 \u0442\u044b\u0441\u044f\u0447 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e \u0444\u0438\u043b\u044c\u043c\u0430\u0445. \u041d\u0430\u043c, \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u0436\u0430\u043d\u0440\u043e\u0432.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0436\u0430\u043d\u0440\u043e\u0432, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0418\u0437\u0431\u0430\u0432\u0438\u043c\u0441\u044f \u043e\u0442 \u0442\u0435\u0445 \u0436\u0430\u043d\u0440\u043e\u0432, \u0433\u0434\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u0435\u043d\u044c\u0448\u0435 100, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0443\u0431\u0435\u0440\u0435\u043c \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0436\u0430\u043d\u0440 &#171;&#8212;&#171;. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0430\u043a\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 26 \u0436\u0430\u043d\u0440\u043e\u0432 \u0438 \u0431\u043e\u043b\u0435\u0435 53 \u0442\u044b\u0441\u044f\u0447 \u0444\u0438\u043b\u044c\u043c\u043e\u0432. \u0414\u043e\u043b\u0436\u043d\u043e \u0445\u0432\u0430\u0442\u0438\u0442\u044c \ud83d\ude42<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b multi-class \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u043c\u0438 (\u0447\u0442\u043e \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0434\u0430\u0436\u0435 \u0437\u0440\u0438\u0442\u0435\u043b\u044e-\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0435\u0433\u043e \u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 &#8212; \u0434\u0440\u0430\u043c\u044b, \u043a\u043e\u043c\u0435\u0434\u0438\u0438 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u0435\u043b\u043e\u0434\u0440\u0430\u043c\u044b), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u044d\u0442\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0441 \u043c\u043e\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u0436\u0430\u043d\u0440\u044b, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435, \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: \u0431\u043e\u0435\u0432\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 (\u0430 &#171;\u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c&#187; \u0438 &#171;\u0431\u043e\u0435\u0432\u0438\u043a&#187; &#8212; \u0440\u0430\u0437\u043d\u044b\u0435 \u0436\u0430\u043d\u0440\u044b \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u0438\u043d\u043e\u043f\u043e\u0438\u0441\u043a\u0430), \u0430 \u0430\u043d\u0438\u043c\u0435 &#8212; \u0438 \u0432\u043e\u0432\u0441\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c\u043e\u043c (\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u044f\u0442 \u043c\u043d\u0435 \u043c\u043e\u0435 \u043d\u0435\u0432\u0435\u0436\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0436\u0430\u043d\u0440\u0430, \u0435\u0441\u043b\u0438 \u044f \u043e\u0448\u0438\u0431\u0430\u044e\u0441\u044c \ud83d\ude42 ). \u0412 \u043e\u0431\u0449\u0435\u043c, \u043f\u0440\u0438\u043c\u0435\u043c \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0438\u043b\u044c\u043c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043b\u0438\u0448\u044c \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0436\u0430\u043d\u0440\u0443, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 multilabel \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u043e\u043c\u0443 \u0444\u0438\u043b\u044c\u043c\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0442\u043e\u043a \u0440\u0430\u0437\u043d\u044b\u0445 \u0436\u0430\u043d\u0440\u043e\u0432.<\/p>\n<p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 sklearn. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 DataFrame (pandas.DataFrame) \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 genre_multi, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0436\u0430\u043d\u0440\u043e\u0432 (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 &#171;\u0434\u0440\u0430\u043c\u0430,\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b,\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f,\u043a\u043e\u043c\u0435\u0434\u0438\u044f&#187;). \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0436\u0430\u043d\u0440\u0430-\u043a\u043b\u0430\u0441\u0441\u0430, \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0443\u043b\u0438 \u0438\u043b\u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0438, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0443\u043a\u0430\u0437\u0430\u043d \u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0436\u0430\u043d\u0440 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u044b, \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"> from sklearn.preprocessing import MultiLabelBinarizer mlb = MultiLabelBinarizer() mlb_result = mlb.fit_transform([str(data.loc[i,'genre_multi']).split(',') for i in range(len(data))]) data = pd.concat([data, pd.DataFrame(mlb_result, columns = list(mlb.classes_))], axis=1)  target_strings = mlb.classes_  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>name<\/p>\n<\/th>\n<th>\n<p>descr<\/p>\n<\/th>\n<th>\n<p>lemmatized_descr<\/p>\n<\/th>\n<th>\n<p>genre_multi<\/p>\n<\/th>\n<th>\n<p>\u0430\u043d\u0438\u043c\u0435<\/p>\n<\/th>\n<th>\n<p>\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u0431\u043e\u0435\u0432\u0438\u043a<\/p>\n<\/th>\n<th>\n<p>\u0432\u0435\u0441\u0442\u0435\u0440\u043d<\/p>\n<\/th>\n<th>\n<p>\u0432\u043e\u0435\u043d\u043d\u044b\u0439<\/p>\n<\/th>\n<th>\n<p>\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432<\/p>\n<\/th>\n<th>\n<p>&#8230;<\/p>\n<\/th>\n<th>\n<p>\u043c\u044e\u0437\u0438\u043a\u043b<\/p>\n<\/th>\n<th>\n<p>\u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0422\u0412<\/p>\n<\/th>\n<th>\n<p>\u0441\u0435\u043c\u0435\u0439\u043d\u044b\u0439<\/p>\n<\/th>\n<th>\n<p>\u0441\u043f\u043e\u0440\u0442<\/p>\n<\/th>\n<th>\n<p>\u0442\u043e\u043a-\u0448\u043e\u0443<\/p>\n<\/th>\n<th>\n<p>\u0442\u0440\u0438\u043b\u043b\u0435\u0440<\/p>\n<\/th>\n<th>\n<p>\u0443\u0436\u0430\u0441\u044b<\/p>\n<\/th>\n<th>\n<p>\u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0430<\/p>\n<\/th>\n<th>\n<p>\u0444\u044d\u043d\u0442\u0435\u0437\u0438<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1+1 (2011)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0432 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0441\u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u0431\u043e\u0433&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435\u0441\u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u043e\u0433\u0430\u0442\u044b\u0439&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0440\u0430\u043c\u0430,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0414\u0436\u0435\u043d\u0442\u043b\u044c\u043c\u0435\u043d\u044b (2019)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0434\u0438\u043d \u0443\u0448\u043b\u044b\u0439 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0435\u0446 \u0435\u0449\u0451 \u0441\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0435\u0442 &#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0443\u0448\u043b\u044b\u0439 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0435\u0446 \u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u043e\u0434 \u043f\u0440\u0438\u0442\u043e\u0440\u0433\u043e\u0432\u044b\u0432\u0430&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b,\u043a\u043e\u043c\u0435\u0434\u0438\u044f,\u0431\u043e\u0435\u0432\u0438\u043a<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u043e\u043b\u043a \u0441 \u0423\u043e\u043b\u043b-\u0441\u0442\u0440\u0438\u0442 (2013)<\/p>\n<\/td>\n<td>\n<p align=\"left\">1987 \u0433\u043e\u0434. \u0414\u0436\u043e\u0440\u0434\u0430\u043d \u0411\u0435\u043b\u0444\u043e\u0440\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u043c &#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0433\u043e\u0434 \u0434\u0436\u043e\u0440\u0434\u0430\u043d \u0431\u0435\u043b\u0444\u043e\u0440\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0431\u0440\u043e\u043a\u0435\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u044b&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0440\u0430\u043c\u0430,\u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b,\u0431\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u044f,\u043a\u043e\u043c\u0435\u0434\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0438<\/h3>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0438 &#8212; \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 &#171;\u043c\u0435\u0442\u043e\u043a&#187;: \u043f\u0440\u0438 multilabel-\u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0442\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u0435\u043a \u0434\u043b\u0438\u043d\u044b N, \u0433\u0434\u0435 N &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0436\u0430\u043d\u0440\u043e\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u0440\u0430\u0432\u043d\u043e 2<sup>26<\/sup>, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/> \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 train_test_split \u0441 \u043e\u043f\u0446\u0438\u0435\u0439 stratify \u0438\u0437 sklearn.model_selection \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0432\u0441\u0435\u043c\u0438\u0440\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u0435 2011 \u0433\u043e\u0434\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from iterstrat.ml_stratifiers import MultilabelStratifiedShuffleSplit from sklearn.utils import indexable, _safe_indexing from sklearn.utils.validation import _num_samples from sklearn.model_selection._split import _validate_shuffle_split from itertools import chain  def multilabel_train_test_split(*arrays,                                 test_size=None,                                 train_size=None,                                 random_state=None,                                 shuffle=True,                                 stratify=None):     \"\"\"     Train test split for multilabel classification. Uses the algorithm from:      'Sechidis K., Tsoumakas G., Vlahavas I. (2011) On the Stratification of Multi-Label Data'.     \"\"\"     if stratify is None:         return train_test_split(*arrays, test_size=test_size,train_size=train_size,                                 random_state=random_state, stratify=None, shuffle=shuffle)          assert shuffle, \"Stratified train\/test split is not implemented for shuffle=False\"          n_arrays = len(arrays)     arrays = indexable(*arrays)     n_samples = _num_samples(arrays[0])     n_train, n_test = _validate_shuffle_split(         n_samples, test_size, train_size, default_test_size=0.25     )     cv = MultilabelStratifiedShuffleSplit(test_size=n_test, train_size=n_train, random_state=random_state)     train, test = next(cv.split(X=arrays[0], y=stratify))      return list(         chain.from_iterable(             (_safe_indexing(a, train), _safe_indexing(a, test)) for a in arrays         )     )  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043e\u0442\u0447\u0435\u0442\u044b \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435, \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 20% \u043e\u0442 \u0432\u0441\u0435\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b<\/h3>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u043b\u0435\u043c\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u043e &#171;\u0444\u0438\u043b\u044c\u043c&#187;.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import nltk nltk.download('stopwords') stop_words = nltk.corpus.stopwords.words('russian') stop_words.append('\u0444\u0438\u043b\u044c\u043c') #word_tokenizer = nltk.WordPunctTokenizer()  import re regex = re.compile(r'[\u0410-\u042f\u0430-\u044fA-z\u0451\u0401-]+')  def words_only(text, regex=regex):     try:         return \" \".join(regex.findall(text)).lower()     except:         return \"\"  from pymystem3 import Mystem from string import punctuation  mystem = Mystem()   #Preprocess function def preprocess_text(text):     text = words_only(text)     tokens = mystem.lemmatize(text.lower())     tokens = [token for token in tokens if token not in stop_words\\               and token != \" \" \\               and token.strip() not in punctuation]          text = \"<\/code><\/pre>\n<\/div>\n<\/details>\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-373949","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373949","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=373949"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373949\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=373949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=373949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=373949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}