{"id":2275,"date":"2025-04-22T08:17:07","date_gmt":"2025-04-22T05:17:07","guid":{"rendered":"http:\/\/csnotes.ru\/?p=2275"},"modified":"2025-04-24T08:31:25","modified_gmt":"2025-04-24T05:31:25","slug":"%d0%b4%d0%b5%d1%80%d0%b5%d0%b2%d0%be-%d1%80%d0%b5%d1%88%d0%b5%d0%bd%d0%b8%d0%b9-%d0%b7%d0%b0%d0%b4%d0%b0%d1%87%d0%b8-%d0%ba-%d1%81%d0%be%d0%b1%d0%b5%d1%81%d0%b5%d0%b4%d0%be%d0%b2%d0%b0%d0%bd%d0%b8","status":"publish","type":"post","link":"https:\/\/csnotes.ru\/?p=2275","title":{"rendered":"\u0414\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0417\u0430\u0434\u0430\u0447\u0438 \u043a \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e."},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u041e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u041a\u0430\u043a\u0438\u0435 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0443\u0437\u043b\u0430\u0445?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u043e\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0438. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u0414\u0436\u0438\u043d\u0438 \u0438\u043b\u0438 \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044f \u0428\u044d\u043d\u043d\u043e\u043d\u0430. \u0412 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 &#8211; MSE, MAE.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0432 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u043a\u0430\u043a \u0441 \u043d\u0438\u043c \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 &#8211; \u044d\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0434 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u0441\u043e\u043a\u0438\u0435, \u0430 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 &#8211; \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043d\u0438\u0436\u0435.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u0431\u043e\u0440\u044c\u0431\u044b \u0441 \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0442\u0430\u043a\u0438\u0445 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043a\u0430\u043a: max_depth, min_samples_split, min_samples_leaf. \u041e\u043d\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438\u0437 Sklearn \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0440\u043e\u0441\u0441\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u041f\u043e\u0434\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0440\u043e\u0441\u0441\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438\n\nfrom sklearn.datasets import load_iris\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.model_selection import train_test_split, GridSearchCV, StratifiedKFold\nfrom sklearn.metrics import accuracy_score\nimport pandas as pd\n\n\n# \u0417\u0430\u0434\u0430\u0435\u043c \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432\nparams = {\n    'max_depth': &#91;3, 5, 10],\n    'min_samples_split': &#91;3, 5, 10],\n    'min_samples_leaf': &#91;3, 5, 10],\n    'max_features': &#91;3, 5, 10],\n    'criterion': &#91;'gini', 'entropy']\n}\n\n# \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445\nX, y = load_iris(return_X_y=True)\n\n# \u0420\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0435 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\n\n# \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0435\u0451 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\nmodel = DecisionTreeClassifier(random_state=1)\n\n# \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0442\u0440\u0430\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043a\u0440\u043e\u0441\u0441\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0438\u0437 5 \u0444\u043e\u043b\u0434\u043e\u0432 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435\u043c\ncv = StratifiedKFold(n_splits=5, shuffle=True)\n\n# \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441 \u043e\u0446\u0435\u043d\u043a\u043e\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439\ngscv = GridSearchCV(model, params, cv=cv, scoring='accuracy')\ngscv.fit(X_train, y_train)\n\n# \u041f\u0440\u043e\u0433\u043d\u043e\u0437 \u043b\u0443\u0447\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438\nbest_model = gscv.best_estimator_\ny_pred = best_model.predict(X_test)\n\n# \u041e\u0446\u0435\u043d\u043a\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043b\u0443\u0447\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438\nacc = accuracy_score(y_test, y_pred)\nprint(f\"Accuracy: {acc:.2f}\")\n\n# \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u043b\u0443\u0447\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438\nprint(f\"Best params: {gscv.best_params_}\")\nprint(f\"Best estimator: {gscv.best_estimator_}\")\n\n# \u0412\u044b\u0432\u043e\u0434 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441 \u043e\u0446\u0435\u043d\u043a\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439\nresults = pd.DataFrame(gscv.cv_results_)\nprint(results&#91;&#91;'params', 'mean_test_score', 'rank_test_score']].sort_values(by='rank_test_score'))<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0432\u0430\u0436\u043d\u044b \u0432 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c .feature_importances_ \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0434\u0435\u0440\u0435\u0432\u0430 .plot_tree().<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u043e\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(f\"Feature importances: {best_model.feature_importances_}\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 matplotlib \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441. \u041f\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0443\u0434\u0438\u0442\u044c \u043e \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u0427\u0435\u043c \u0431\u043b\u0438\u0436\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043a \u043a\u043e\u0440\u043d\u044e \u0434\u0435\u0440\u0435\u0432\u0430, \u0442\u0435\u043c \u043e\u043d, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0432\u0430\u0436\u043d\u0435\u0435. \u041d\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.tree import plot_tree\n\n# \u0417\u0434\u0435\u0441\u044c \u043a\u043e\u0434 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438\n\nplot_tree(model)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u0430\u043a \u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Scikit Learn \u2013 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c (One Hot Encoding, Ordinal Encoding).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 Catboost \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0431\u0443\u0441\u0442\u0438\u043d\u0433\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0442\u0438\u0432\u043d\u043e.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043f\u043e\u043d\u044f\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"618\" height=\"467\" src=\"http:\/\/csnotes.ru\/wp-content\/uploads\/2025\/04\/tree_visualization.png\" alt=\"\" class=\"wp-image-2286\" srcset=\"https:\/\/csnotes.ru\/wp-content\/uploads\/2025\/04\/tree_visualization.png 618w, https:\/\/csnotes.ru\/wp-content\/uploads\/2025\/04\/tree_visualization-300x227.png 300w, https:\/\/csnotes.ru\/wp-content\/uploads\/2025\/04\/tree_visualization-74x55.png 74w, https:\/\/csnotes.ru\/wp-content\/uploads\/2025\/04\/tree_visualization-111x83.png 111w, https:\/\/csnotes.ru\/wp-content\/uploads\/2025\/04\/tree_visualization-215x161.png 215w\" sizes=\"auto, (max-width: 618px) 100vw, 618px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u041a\u0430\u0436\u0434\u044b\u0439 <strong>\u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u2014 \u044d\u0442\u043e \u0443\u0437\u0435\u043b \u0434\u0435\u0440\u0435\u0432\u0430<\/strong>. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>feature_name &lt;= threshold<\/code> \u2014 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u043b\u0438\u0441\u0442),<\/li>\n\n\n\n<li><code>gini<\/code> \u0438\u043b\u0438 <code>entropy<\/code> \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u0432 \u044d\u0442\u043e\u043c \u0443\u0437\u043b\u0435 (\u043e\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438),<\/li>\n\n\n\n<li><code>samples<\/code> \u2014 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043e\u0448\u043b\u043e \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0443\u0437\u043b\u0430,<\/li>\n\n\n\n<li><code>value = [n1, n2, n3]<\/code> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u044d\u0442\u043e\u043c \u0443\u0437\u043b\u0435,<\/li>\n\n\n\n<li><code>class = ...<\/code> \u2014 \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0443\u0437\u0435\u043b (\u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u044b\u0439 \u043a\u043b\u0430\u0441\u0441).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u0430\u043a \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043d\u0430 \u043d\u0435\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0438\u0441\u0431\u0430\u043b\u0430\u043d\u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 class_weight.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>model = DecisionTreeClassifier(class_weight=\"balanced\")    # \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SMOTE &#8211; \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u0438\u043d\u043e\u0440\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0446\u0435\u043b\u044c\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0441 \u043c\u0430\u0436\u043e\u0440\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c.<\/li>\n\n\n\n<li>undersampling &#8211; \u043e\u0431\u0440\u0435\u0437\u043a\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0436\u043e\u0440\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0446\u0435\u043b\u044c\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0441 \u043c\u0438\u043d\u043e\u0440\u043d\u044b\u043c.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u041a\u0430\u043a\u0438\u0435 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0443\u0437\u043b\u0430\u0445? \u0414\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u043e\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u0412 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u0414\u0436\u0438\u043d\u0438 \u0438\u043b\u0438 \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044f \u0428\u044d\u043d\u043d\u043e\u043d\u0430. \u0412 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 &#8211; MSE, MAE. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0432 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u043a\u0430\u043a \u0441 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[72,71,68],"class_list":["post-2275","post","type-post","status-publish","format-standard","hentry","category-ml","tag-72","tag-71","tag-68"],"views":72,"_links":{"self":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts\/2275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2275"}],"version-history":[{"count":7,"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts\/2275\/revisions"}],"predecessor-version":[{"id":2291,"href":"https:\/\/csnotes.ru\/index.php?rest_route=\/wp\/v2\/posts\/2275\/revisions\/2291"}],"wp:attachment":[{"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csnotes.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}