{"id":344316,"date":"2023-01-22T21:01:35","date_gmt":"2023-01-22T21:01:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344316"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344316","title":{"rendered":"<span>\u041f\u0440\u0438\u043c\u0435\u0440 ML \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 Pipelines+Optuna+GBDT<\/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<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u0441 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c)<\/h2>\n<p>\u041d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u043e\u0442\u043a\u0440\u044b\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f Kaggle. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/www.kaggle.com\/competitions\/spaceship-titanic\" rel=\"noopener noreferrer nofollow\">Spaceship Titanic<\/a>. \u042d\u0442\u043e \u0431\u043e\u043b\u0435\u0435 &#171;\u043c\u043e\u043b\u043e\u0434\u0430\u044f&#187; \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/www.kaggle.com\/competitions\/titanic\/\" rel=\"noopener noreferrer nofollow\">\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430<\/a>. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 2737 \u0447\u0435\u043b\u043e\u0432\u0435\u043a (\u043a\u043e\u043c\u0430\u043d\u0434). <a href=\"https:\/\/github.com\/vgorbatikov\/ml-titanic.git\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0434<\/a>, \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u043c\u043d\u0435 \u0437\u0430\u043d\u044f\u0442\u044c 697-\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0435 \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0430\u0431\u043c\u0438\u0442\u0430. \u042f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u044d\u0442\u0438\u043c.<\/p>\n<h2>\u0414\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/www.kaggle.com\/competitions\/spaceship-titanic\/data\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0430\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u0440\u043e\u043c\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442. \u041f\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0432 \u043d\u0451\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u0441 \u0442\u0430\u0440\u0433\u0435\u0442\u043e\u043c. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u043b\u044f \u0441\u0430\u0431\u043c\u0438\u0442\u0430 (sample submission).<\/p>\n<h2>\u0410\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"https:\/\/pandas-profiling.ydata.ai\/docs\/master\/pages\/getting_started\/quickstart.html\" rel=\"noopener noreferrer nofollow\">Pandas Profiling<\/a> \u0438 <a href=\"https:\/\/pypi.org\/project\/sweetviz\/\" rel=\"noopener noreferrer nofollow\">SweetWiz<\/a>. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u043c\u0430\u0441\u0441\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Pandas Profiling<\/p>\n<pre><code class=\"python\">profile_train = ProfileReport(train_data, title=\"Train Data Profiling Report\") profile_train.to_file(\"train_profile.html\") profile_train.to_widgets()<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SweetWiz<\/p>\n<pre><code class=\"python\">train_report = sv.analyze(train_data)  train_report.show_html(filepath='TRAIN_REPORT.html',              open_browser=True,              layout='widescreen',              scale=None)  train_report.show_notebook( w=None,                  h=None,                  scale=None,                 layout='widescreen',                 filepath=None)<\/code><\/pre>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0442\u0430\u0440\u0433\u0435\u0442\u0443, \u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u044f \u0438\u0445 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044e), \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0435\u043b\u043b\u044f\u0446\u0438\u044f \u043f\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c.<\/p>\n<p>\u041f\u043e\u043b\u0435 \u0441 \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043a\u0430\u044e\u0442\u044b \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0435 \u043d\u0435\u0441\u0451\u0442. \u041d\u043e \u0435\u0441\u043b\u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043f\u0430\u043b\u0443\u0431\u044b \u0438 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u0434\u0432\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<pre><code class=\"python\"># \u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u044e \u043d\u043e\u043c\u0435\u0440 \u043f\u0430\u043b\u0443\u0431\u044b \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442\u044b def get_deck(cabin):     if cabin is None:         return None     if isinstance(cabin, float):         return None     return cabin.split(\"\/\")[0]  #print(get_deck('F\/1534\/S')) #print(get_deck(\"G\/1126\/P\"))  train_data['deck'] = train_data.apply(lambda x: get_deck(x.Cabin), axis=1) test_data['deck'] = test_data.apply(lambda x: get_deck(x.Cabin), axis=1)  # \u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 side \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u0431\u0438\u043d\u044b def get_side(cabin):     if cabin is None:         return None     if isinstance(cabin, float):         return None     return cabin.split(\"\/\")[2]  #print(get_side('F\/1534\/S')) #print(get_side('G\/1126\/P'))  train_data['side'] = train_data.apply(lambda x: get_side(x.Cabin), axis=1) test_data['side'] = test_data.apply(lambda x: get_side(x.Cabin), axis=1)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443\u0434\u0430\u043b\u044f\u044e \u0438\u0437 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438  <\/p>\n<pre><code class=\"python\">num_cols = ['Age','RoomService', 'FoodCourt','ShoppingMall', 'Spa', 'VRDeck'] cat_cols = ['HomePlanet', 'CryoSleep', 'Destination', 'VIP', 'deck', 'side']<\/code><\/pre>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 pipelines<\/h2>\n<p>Pipelines &#8212; \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043c\u043e\u0449\u043d\u044b\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u043d\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0414\u0430, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0443\u0441\u0438\u043b\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.pipeline.Pipeline.html\" rel=\"noopener noreferrer nofollow\">\u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>. \u041d\u043e \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u043f\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043d\u0435\u0441\u0451\u0442 \u043f\u0440\u043e\u0444\u0438\u0442. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 (\u043a\u0443\u043a\u0431\u0443\u043a\u043e\u0432) \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432. \u041c\u043d\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u0430 <a href=\"https:\/\/medium.com\/mlearning-ai\/neat-data-preprocessing-with-pipeline-and-columntransformer-2a0468865b6b\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a>. <\/p>\n<p>\u042f \u0441\u043e\u0437\u0434\u0430\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e Pipeline \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438 Pipeline \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/p>\n<pre><code class=\"python\">num_pipeline = Pipeline(steps=[     ('impute', SimpleImputer(strategy='median')),     ('scale',StandardScaler()) ]) cat_pipeline = Pipeline(steps=[     ('impute', SimpleImputer(strategy='most_frequent')),     ('one-hot',OneHotEncoder(handle_unknown='ignore', sparse=False)) ])<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.impute.SimpleImputer.html\" rel=\"noopener noreferrer nofollow\">SimpleImputer<\/a>, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.preprocessing.StandardScaler.html\" rel=\"noopener noreferrer nofollow\"><u>StandardScaler<\/u><\/a> \u0438 <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.preprocessing.OneHotEncoder.html\" rel=\"noopener noreferrer nofollow\">OneHotEncoder<\/a>. \u041a\u0441\u0442\u0430\u0442\u0438, \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 scikit-learn \u0435\u0441\u0442\u044c <a href=\"https:\/\/scikit-learn.org\/stable\/auto_examples\/preprocessing\/plot_all_scaling.html\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043a\u0435\u0439\u043b\u0435\u0440\u043e\u0432. <\/p>\n<p>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432 \u0441\u043e\u0431\u0438\u0440\u0430\u044e <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.compose.ColumnTransformer.html\" rel=\"noopener noreferrer nofollow\">ColumnTransformer<\/a>.<\/p>\n<pre><code class=\"python\">col_trans = ColumnTransformer(transformers=[     ('num_pipeline',num_pipeline,num_cols),     ('cat_pipeline',cat_pipeline,cat_cols)     ],     remainder='drop',     n_jobs=-1)<\/code><\/pre>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Pipelines \u0438 Optuna<\/h2>\n<p><a href=\"https:\/\/optuna.org\/\" rel=\"noopener noreferrer nofollow\">Optuna<\/a> &#8212; \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0411\u043b\u0430\u0433\u043e, \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0435\u0441\u0442\u044c \u043e\u0431\u0448\u0438\u0440\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u0432\u0438\u0434\u0435\u043e, \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041d\u0438\u0436\u0435 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<pre><code class=\"python\">def objective(trial):         # \u0421\u043f\u0438\u0441\u043e\u043a \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 (\u0434\u043b\u044f CatBoostClassifier)     param = {         \"objective\": trial.suggest_categorical(\"objective\", [\"Logloss\", \"CrossEntropy\"]),         \"colsample_bylevel\": trial.suggest_float(\"colsample_bylevel\", 0.01, 0.1),         \"depth\": trial.suggest_int(\"depth\", 1, 12),         \"boosting_type\": trial.suggest_categorical(\"boosting_type\", [\"Ordered\", \"Plain\"]),         \"bootstrap_type\": trial.suggest_categorical(             \"bootstrap_type\", [\"Bayesian\", \"Bernoulli\", \"MVS\"]         ),         \"used_ram_limit\": \"3gb\",     }      if param[\"bootstrap_type\"] == \"Bayesian\":         param[\"bagging_temperature\"] = trial.suggest_float(\"bagging_temperature\", 0, 10)     elif param[\"bootstrap_type\"] == \"Bernoulli\":         param[\"subsample\"] = trial.suggest_float(\"subsample\", 0.1, 1)          # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b     estimator = CatBoostClassifier(**param, verbose=False)      # \u041f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u044e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b     clf_pipeline = Pipeline(steps=[             ('col_trans', col_trans),             ('model', estimator)         ])     # \u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430.     # \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e Accuracy \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438     accuracy = cross_val_score(clf_pipeline, features_train, target_train, cv=3, scoring= 'accuracy').mean()     return accuracy  # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. # \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0411\u0414 SQLLite (\u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u044f \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b) #study = optuna.create_study(direction=\"maximize\", study_name=\"CBC-2023-01-14-14-30\", storage='sqlite:\/\/\/db\/CBC-2023-01-14-14-30.db') study = optuna.create_study(direction=\"maximize\", study_name=\"CBC-2023-01-14-14-30\") # \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 study.optimize(objective, n_trials=300) # \u0412\u044b\u0432\u043e\u0436\u0443 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 print(study.best_trial)<\/code><\/pre>\n<h2>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0432 \u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u043c \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0435<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>estimator<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043b\u044e\u0431\u0443\u044e ML \u043c\u043e\u0434\u0435\u043b\u044c. \u042f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0441 <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.tree.DecisionTreeClassifier.html\" rel=\"noopener noreferrer nofollow\">DecisionTreeClassifier<\/a>,  <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.ensemble.RandomForestClassifier.html\" rel=\"noopener noreferrer nofollow\">RandomForestClassifier<\/a>, <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.linear_model.LogisticRegression.html\" rel=\"noopener noreferrer nofollow\">LogisticRegression<\/a>, \u043d\u043e \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0441\u043c\u043e\u0433 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0430. \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u043c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043c\u043e\u0433\u043b\u0430 <a href=\"https:\/\/academy.yandex.ru\/handbook\/ml\/article\/gradientnyj-busting\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a>. \u042f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0441 <a href=\"https:\/\/lightgbm.readthedocs.io\/en\/latest\/pythonapi\/lightgbm.LGBMClassifier.html\" rel=\"noopener noreferrer nofollow\">LGBMClassifier<\/a>, <a href=\"https:\/\/xgboost.readthedocs.io\/en\/latest\/python\/python_api.html#xgboost.XGBClassifier\" rel=\"noopener noreferrer nofollow\">XGBClassifier<\/a>, <a href=\"https:\/\/catboost.ai\/en\/docs\/concepts\/python-reference_catboostclassifier\" rel=\"noopener noreferrer nofollow\">CatBoostClassifier<\/a>. \u0412 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d CatBoostClassifier.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/vgorbatikov\/ml-titanic.git\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. \u041e\u043d \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u0435\u043d. \u042f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0435\u0433\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c (\u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <\/p>\n<ul>\n<li>\n<p>\u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0434\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u0442 2 \u0434\u043e 5 \u0447\u0430\u0441\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0445\u043e\u0447\u0443 \u0435\u0449\u0451 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0434\u0435\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\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\/post\/712080\/\"> https:\/\/habr.com\/ru\/post\/712080\/<\/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<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u0441 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c)<\/h2>\n<p>\u041d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u043e\u0442\u043a\u0440\u044b\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f Kaggle. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/www.kaggle.com\/competitions\/spaceship-titanic\" rel=\"noopener noreferrer nofollow\">Spaceship Titanic<\/a>. \u042d\u0442\u043e \u0431\u043e\u043b\u0435\u0435 &#171;\u043c\u043e\u043b\u043e\u0434\u0430\u044f&#187; \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/www.kaggle.com\/competitions\/titanic\/\" rel=\"noopener noreferrer nofollow\">\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430<\/a>. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 2737 \u0447\u0435\u043b\u043e\u0432\u0435\u043a (\u043a\u043e\u043c\u0430\u043d\u0434). <a href=\"https:\/\/github.com\/vgorbatikov\/ml-titanic.git\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0434<\/a>, \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u043c\u043d\u0435 \u0437\u0430\u043d\u044f\u0442\u044c 697-\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0435 \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0430\u0431\u043c\u0438\u0442\u0430. \u042f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u044d\u0442\u0438\u043c.<\/p>\n<h2>\u0414\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/www.kaggle.com\/competitions\/spaceship-titanic\/data\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0430\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u0440\u043e\u043c\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442. \u041f\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0432 \u043d\u0451\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u0441 \u0442\u0430\u0440\u0433\u0435\u0442\u043e\u043c. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u043b\u044f \u0441\u0430\u0431\u043c\u0438\u0442\u0430 (sample submission).<\/p>\n<h2>\u0410\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"https:\/\/pandas-profiling.ydata.ai\/docs\/master\/pages\/getting_started\/quickstart.html\" rel=\"noopener noreferrer nofollow\">Pandas Profiling<\/a> \u0438 <a href=\"https:\/\/pypi.org\/project\/sweetviz\/\" rel=\"noopener noreferrer nofollow\">SweetWiz<\/a>. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u043c\u0430\u0441\u0441\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Pandas Profiling<\/p>\n<pre><code class=\"python\">profile_train = ProfileReport(train_data, title=\"Train Data Profiling Report\") profile_train.to_file(\"train_profile.html\") profile_train.to_widgets()<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SweetWiz<\/p>\n<pre><code class=\"python\">train_report = sv.analyze(train_data)  train_report.show_html(filepath='TRAIN_REPORT.html',              open_browser=True,              layout='widescreen',              scale=None)  train_report.show_notebook( w=None,                  h=None,                  scale=None,                 layout='widescreen',                 filepath=None)<\/code><\/pre>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0442\u0430\u0440\u0433\u0435\u0442\u0443, \u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u044f \u0438\u0445 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044e), \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0435\u043b\u043b\u044f\u0446\u0438\u044f \u043f\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c.<\/p>\n<p>\u041f\u043e\u043b\u0435 \u0441 \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043a\u0430\u044e\u0442\u044b \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0435 \u043d\u0435\u0441\u0451\u0442. \u041d\u043e \u0435\u0441\u043b\u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043f\u0430\u043b\u0443\u0431\u044b \u0438 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u0434\u0432\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<pre><code class=\"python\"># \u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u044e \u043d\u043e\u043c\u0435\u0440 \u043f\u0430\u043b\u0443\u0431\u044b \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442\u044b def get_deck(cabin):     if cabin is None:         return None     if isinstance(cabin, float):         return None     return cabin.split(\"\/\")[0]  #print(get_deck('F\/1534\/S')) #print(get_deck(\"G\/1126\/P\"))  train_data['deck'] = train_data.apply(lambda x: get_deck(x.Cabin), axis=1) test_data['deck'] = test_data.apply(lambda x: get_deck(x.Cabin), axis=1)  # \u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 side \u0438\u0437 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u0431\u0438\u043d\u044b def get_side(cabin):     if cabin is None:         return None     if isinstance(cabin, float):         return None     return cabin.split(\"\/\")[2]  #print(get_side('F\/1534\/S')) #print(get_side('G\/1126\/P'))  train_data['side'] = train_data.apply(lambda x: get_side(x.Cabin), axis=1) test_data['side'] = test_data.apply(lambda x: get_side(x.Cabin), axis=1)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443\u0434\u0430\u043b\u044f\u044e \u0438\u0437 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438  <\/p>\n<pre><code class=\"python\">num_cols = ['Age','RoomService', 'FoodCourt','ShoppingMall', 'Spa', 'VRDeck'] cat_cols = ['HomePlanet', 'CryoSleep', 'Destination', 'VIP', 'deck', 'side']<\/code><\/pre>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 pipelines<\/h2>\n<p>Pipelines &#8212; \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043c\u043e\u0449\u043d\u044b\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u043d\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0414\u0430, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0443\u0441\u0438\u043b\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.pipeline.Pipeline.html\" rel=\"noopener noreferrer nofollow\">\u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>. \u041d\u043e \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u043f\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043d\u0435\u0441\u0451\u0442 \u043f\u0440\u043e\u0444\u0438\u0442. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 (\u043a\u0443\u043a\u0431\u0443\u043a\u043e\u0432) \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432. \u041c\u043d\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u0430 <a href=\"https:\/\/medium.com\/mlearning-ai\/neat-data-preprocessing-with-pipeline-and-columntransformer-2a0468865b6b\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a>. <\/p>\n<p>\u042f \u0441\u043e\u0437\u0434\u0430\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e Pipeline \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438 Pipeline \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/p>\n<pre><code class=\"python\">num_pipeline = Pipeline(steps=[     ('impute', SimpleImputer(strategy='median')),     ('scale',StandardScaler()) ]) cat_pipeline = Pipeline(steps=[     ('impute', SimpleImputer(strategy='most_frequent')),     ('one-hot',OneHotEncoder(handle_unknown='ignore', sparse=False)) ])<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.impute.SimpleImputer.html\" rel=\"noopener noreferrer nofollow\">SimpleImputer<\/a>, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.preprocessing.StandardScaler.html\" rel=\"noopener noreferrer nofollow\"><u>StandardScaler<\/u><\/a> \u0438 <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.preprocessing.OneHotEncoder.html\" rel=\"noopener noreferrer nofollow\">OneHotEncoder<\/a>. \u041a\u0441\u0442\u0430\u0442\u0438, \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 scikit-learn \u0435\u0441\u0442\u044c <a href=\"https:\/\/scikit-learn.org\/stable\/auto_examples\/preprocessing\/plot_all_scaling.html\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043a\u0435\u0439\u043b\u0435\u0440\u043e\u0432. <\/p>\n<p>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432 \u0441\u043e\u0431\u0438\u0440\u0430\u044e <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.compose.ColumnTransformer.html\" rel=\"noopener noreferrer nofollow\">ColumnTransformer<\/a>.<\/p>\n<pre><code class=\"python\">col_trans = ColumnTransformer(transformers=[     ('num_pipeline',num_pipeline,num_cols),     ('cat_pipeline',cat_pipeline,cat_cols)     ],     remainder='drop',     n_jobs=-1)<\/code><\/pre>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Pipelines \u0438 Optuna<\/h2>\n<p><a href=\"https:\/\/optuna.org\/\" rel=\"noopener noreferrer nofollow\">Optuna<\/a> &#8212; \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0411\u043b\u0430\u0433\u043e, \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0435\u0441\u0442\u044c \u043e\u0431\u0448\u0438\u0440\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u0432\u0438\u0434\u0435\u043e, \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041d\u0438\u0436\u0435 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<pre><code class=\"python\">def objective(trial):         # \u0421\u043f\u0438\u0441\u043e\u043a \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 (\u0434\u043b\u044f CatBoostClassifier)     param = {         \"objective\": trial.suggest_categorical(\"objective\", [\"Logloss\", \"CrossEntropy\"]),         \"colsample_bylevel\": trial.suggest_float(\"colsample_bylevel\", 0.01, 0.1),         \"depth\": trial.suggest_int(\"depth\", 1, 12),         \"boosting_type\": trial.suggest_categorical(\"boosting_type\", [\"Ordered\", \"Plain\"]),         \"bootstrap_type\": trial.suggest_categorical(             \"bootstrap_type\", [\"Bayesian\", \"Bernoulli\", \"MVS\"]         ),         \"used_ram_limit\": \"3gb\",     }      if param[\"bootstrap_type\"] == \"Bayesian\":         param[\"bagging_temperature\"] = trial.suggest_float(\"bagging_temperature\", 0, 10)     elif param[\"bootstrap_type\"] == \"Bernoulli\":         param[\"subsample\"] = trial.suggest_float(\"subsample\", 0.1, 1)          # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b     estimator = CatBoostClassifier(**param, verbose=False)      # \u041f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u044e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b     clf_pipeline = Pipeline(steps=[             ('col_trans', col_trans),             ('model', estimator)         ])     # \u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430.     # \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e Accuracy \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438     accuracy = cross_val_score(clf_pipeline, features_train, target_train, cv=3, scoring= 'accuracy').mean()     return accuracy  # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. # \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0411\u0414 SQLLite (\u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u044f \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b) #study = optuna.create_study(direction=\"maximize\", study_name=\"CBC-2023-01-14-14-30\", storage='sqlite:\/\/\/db\/CBC-2023-01-14-14-30.db') study = optuna.create_study(direction=\"maximize\", study_name=\"CBC-2023-01-14-14-30\") # \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 study.optimize(objective, n_trials=300) # \u0412\u044b\u0432\u043e\u0436\u0443 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 print(study.best_trial)<\/code><\/pre>\n<h2>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0432 \u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u043c \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0435<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>estimator<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043b\u044e\u0431\u0443\u044e ML \u043c\u043e\u0434\u0435\u043b\u044c. \u042f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0441 <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.tree.DecisionTreeClassifier.html\" rel=\"noopener noreferrer nofollow\">DecisionTreeClassifier<\/a>,  <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.ensemble.RandomForestClassifier.html\" rel=\"noopener noreferrer nofollow\">RandomForestClassifier<\/a>, <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.linear_model.LogisticRegression.html\" rel=\"noopener noreferrer nofollow\">LogisticRegression<\/a>, \u043d\u043e \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0441\u043c\u043e\u0433 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0430. \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u043c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043c\u043e\u0433\u043b\u0430 <a href=\"https:\/\/academy.yandex.ru\/handbook\/ml\/article\/gradientnyj-busting\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a>. \u042f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0441 <a href=\"https:\/\/lightgbm.readthedocs.io\/en\/latest\/pythonapi\/lightgbm.LGBMClassifier.html\" rel=\"noopener noreferrer nofollow\">LGBMClassifier<\/a>, <a href=\"https:\/\/xgboost.readthedocs.io\/en\/latest\/python\/python_api.html#xgboost.XGBClassifier\" rel=\"noopener noreferrer nofollow\">XGBClassifier<\/a>, <a href=\"https:\/\/catboost.ai\/en\/docs\/concepts\/python-reference_catboostclassifier\" rel=\"noopener noreferrer nofollow\">CatBoostClassifier<\/a>. \u0412 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d CatBoostClassifier.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/vgorbatikov\/ml-titanic.git\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. \u041e\u043d \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u0435\u043d. \u042f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0435\u0433\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c (\u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <\/p>\n<ul>\n<li>\n<p>\u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0434\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u0442 2 \u0434\u043e 5 \u0447\u0430\u0441\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0445\u043e\u0447\u0443 \u0435\u0449\u0451 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0434\u0435\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\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\/post\/712080\/\"> https:\/\/habr.com\/ru\/post\/712080\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344316","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344316","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=344316"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344316\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}