{"id":265488,"date":"2015-09-12T13:09:02","date_gmt":"2015-09-12T09:09:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265488"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265488","title":{"rendered":"\u041e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 Data Science"},"content":{"rendered":"<p>       \u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/60f\/d96\/61c\/60fd9661cf9944bf890193af5e035a5e.jpg\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0438 \u043e\u0431\u0435\u0449\u0430\u043b, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e Data Science \u043e\u0442 \u0440\u0435\u0431\u044f\u0442 \u0438\u0437 <a href=\"http:\/\/dscourse.mlclass.ru\">MLClass.ru<\/a> (\u043a\u0441\u0442\u0430\u0442\u0438, \u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0443\u0441\u043f\u0435\u043b \u2014 <a href=\"http:\/\/dscourse.mlclass.ru\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/a>). \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 <a href=\"https:\/\/www.kaggle.com\/c\/digit-recognizer\">Digit Recognizer<\/a> \u0438\u0437\u0443\u0447\u0438\u043c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043d\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u0435\u0440\u0432\u044b\u0445 \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435\u043c. \u0421 \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u044f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0441\u044f \u043f\u0440\u0438 \u0443\u0447\u0430\u0441\u0442\u0438\u0438 \u0432 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0438 <b>Digit Recognizer<\/b> \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/www.kaggle.com\">Kaggle<\/a>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0431\u0430\u0437\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0446\u0438\u0444\u0440 \u2014 <b>The MNIST database of handwritten digits<\/b>. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043e\u0442\u0446\u0435\u043d\u0442\u0440\u043e\u0432\u0430\u043d\u044b \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043a \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u043c\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u0443. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 42000 \u0442\u0430\u043a\u0438\u0445 \u0446\u0438\u0444\u0440. \u041a\u0430\u0436\u0434\u0430\u044f \u0446\u0438\u0444\u0440\u0430 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 784 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u044f\u0440\u043a\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043f\u043e\u043b\u043d\u0443\u044e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0432 <b>R<\/b><\/p>\n<pre><code>library(readr) require(magrittr) require(dplyr) require(caret) data_train &lt;- read_csv(&quot;train.csv&quot;) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0446\u0438\u0444\u0440\u044b \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430 \u0432\u0438\u0434\u0435.<\/p>\n<pre><code>colors&lt;-c('white','black') cus_col&lt;-colorRampPalette(colors=colors)  default_par &lt;- par() par(mfrow=c(6,6),pty='s',mar=c(1,1,1,1),xaxt='n',yaxt='n')  for(i in 1:36) {         z&lt;-array(as.matrix(data_train)[i,-1],dim=c(28,28))         z&lt;-z[,28:1]          image(1:28,1:28,z,main=data_train[i,1],col=cus_col(256)) }  par(default_par) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/3c1\/7e4\/bff\/3c17e4bffb29429683a4d962b35c5d99.png\"\/><\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0432\u044b\u0431\u043e\u0440\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0442.\u0434. \u041d\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435. <b>42000<\/b> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 <b>784<\/b> \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430. \u041f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <b>Random Forest<\/b> \u0438\u043b\u0438 <b>Support Vector Machine<\/b> \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0448\u0438\u0431\u043a\u0443 \u043e \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u0436\u0435 \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u043b\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0443\u0436\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043c\u0438\u043d\u0443\u0442\u044b. \u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0431\u043e\u0440\u044c\u0431\u044b \u0441 \u044d\u0442\u0438\u043c \u2014 \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043b\u0438\u0431\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u044c\u0442\u0435\u0440\u043e\u0432. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043e\u0442 \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u0422\u0435\u043e\u0440\u0438\u044f \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u043a\u0440\u0438\u0432\u043e\u0439<\/h3>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <b>Learning Curve<\/b> \u0438\u043b\u0438 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u043a\u0440\u0438\u0432\u0443\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/716\/197\/cf9\/716197cf97534e8b8d55c2767f95c62c.png\"\/><\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435\u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u0438\u043b\u0438 \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 (<b>High bias<\/b>). \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u2014 \u044d\u0442\u043e \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u0430\u043a \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438. \u0412\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u0438\u043b\u0438 \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c (<b>High variance<\/b>). \u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u043a\u0440\u0438\u0432\u044b\u043c\u0438 \u0438 \u043d\u0438\u0437\u043a\u043e\u0439 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439. \u0422\u0443\u0442 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<h3>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  \u0420\u0430\u0437\u043e\u0431\u044a\u0451\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 <b>60\/40<\/b><\/p>\n<pre><code>data_train$label &lt;- as.factor(data_train$label) set.seed(111) split &lt;- createDataPartition(data_train$label, p = 0.6, list = FALSE) train &lt;- slice(data_train, split) test &lt;- slice(data_train, -split) <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0446\u0438\u0444\u0440, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e, \u0442.\u043a. \u043e\u043d\u0438 \u043e\u0442\u0446\u0435\u043d\u0442\u0440\u043e\u0432\u0430\u043d\u044b, \u0442\u043e \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 \u0441\u0430\u043c\u043e\u0439 \u0446\u0438\u0444\u0440\u044b. \u0422\u043e \u0435\u0441\u0442\u044c, \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0430 \u0432 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043d\u0435 \u043d\u0435\u0441\u0443\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445, \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code>zero_var_col &lt;- nearZeroVar(train, saveMetrics = T) sum(zero_var_col$nzv)  ## [1] 532  train_nzv &lt;- train[, !zero_var_col$nzv] test_nzv &lt;- test[, !zero_var_col$nzv] <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c <b>532<\/b> \u0438\u0437 <b>784<\/b>. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u0432\u043b\u0438\u044f\u043b\u043e \u044d\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <b>CART<\/b> \u043c\u043e\u0434\u0435\u043b\u0438 (\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432) \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u043b\u0435. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code>library(rpart) model_tree &lt;- rpart(label ~ ., data = train, method=&quot;class&quot; ) predict_data_test &lt;- predict(model_tree, newdata = test, type = &quot;class&quot;) sum(test$label != predict_data_test)\/nrow(test)  ## [1] 0.383507  model_tree_nzv &lt;- rpart(label ~ ., data = train_nzv, method=&quot;class&quot; ) predict_data_test_nzv &lt;- predict(model_tree_nzv, newdata = test_nzv, type = &quot;class&quot;) sum(test_nzv$label != predict_data_test_nzv)\/nrow(test_nzv)  ## [1] 0.3838642 <\/code><\/pre>\n<p>  \u0422.\u043a. \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b\u0438 \u0441\u043e\u0442\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438<\/p>\n<pre><code>train &lt;- train[, !zero_var_col$nzv] test &lt;- test[, !zero_var_col$nzv] <\/code><\/pre>\n<p>  <\/p>\n<h3>CART<\/h3>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0430\u043c\u0443 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u043a\u0440\u0438\u0432\u0443\u044e. \u0411\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f <b>CART<\/b> \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u044f\u0442\u044c \u0440\u0430\u0437.<\/p>\n<pre><code>learn_curve_data &lt;- data.frame(integer(),                                double(),                                double()) for (n in 1:5 ) {         for (i in seq(1, 2000, by = 200))         {                 train_learn &lt;- train[sample(nrow(train), size = i),]                 test_learn &lt;- test[sample(nrow(test), size = i),]                 model_tree_learn &lt;- rpart(label ~ ., data = train_learn, method=&quot;class&quot; )                 predict_train_learn &lt;- predict(model_tree_learn, type = &quot;class&quot;)                 error_rate_train_rpart &lt;- sum(train_learn$label != predict_train_learn)\/i                 predict_test_learn &lt;- predict(model_tree_learn, newdata = test_learn, type = &quot;class&quot;)                 error_rate_test_rpart &lt;- sum(test_learn$label != predict_test_learn)\/i                 learn_curve_data &lt;- rbind(learn_curve_data, c(i, error_rate_train_rpart, error_rate_test_rpart))         } } <\/code><\/pre>\n<p>  \u0423\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 <b>GAM<\/b><\/p>\n<pre><code>colnames(learn_curve_data) &lt;- c(&quot;Size&quot;, &quot;Train_Error_Rate&quot;, &quot;Test_Error_Rate&quot;) library(reshape2) library(ggplot2) learn_curve_data_long &lt;- melt(learn_curve_data, id = &quot;Size&quot;) ggplot(data=learn_curve_data_long, aes(x=Size, y=value, colour=variable)) +          geom_point() + stat_smooth(method = &quot;gam&quot;, formula = y ~ s(x), size = 1) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f31\/9e4\/ddc\/f319e4ddc2c44407940daf555d0d9e3b.png\"\/><\/p>\n<p>  \u0427\u0442\u043e \u0436\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c?<\/p>\n<ul>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 500 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435.<\/li>\n<li>\u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u0430\u043a \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0430.<\/li>\n<li>\u0420\u0430\u0437\u0440\u044b\u0432 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0430\u043b.<\/li>\n<li>\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f.<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u2014 \u0442\u043e <b>CART<\/b> \u043c\u043e\u0434\u0435\u043b\u044c \u044f\u0432\u043d\u043e \u043d\u0435\u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0430, \u0442.\u0435. \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435. \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u0443 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u0441\u0430\u043c\u0443 \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0432\u043e\u0434\u043e\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432.<\/p>\n<h3>Random Forest<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u043e\u0446\u0435\u043d\u043a\u0443 Random Forest \u043c\u043e\u0434\u0435\u043b\u0438. \u041e\u043f\u044f\u0442\u044c \u0436\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb, \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c. \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0451\u043d \u043d\u0430 100, \u0442.\u043a. \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<pre><code>library(randomForest) learn_curve_data &lt;- data.frame(integer(),                                double(),                                double()) for (n in 1:5 ) {         for (i in seq(100, 5100, by = 1000))         {                 train_learn &lt;- train[sample(nrow(train), size = i),]                 test_learn &lt;- test[sample(nrow(test), size = i),]                 model_learn &lt;- randomForest(label ~ ., data = train_learn)                 predict_train_learn &lt;- predict(model_learn)                 error_rate_train &lt;- sum(train_learn$label != predict_train_learn)\/i                 predict_test_learn &lt;- predict(model_learn, newdata = test_learn)                 error_rate_test &lt;- sum(test_learn$label != predict_test_learn)\/i                 learn_curve_data &lt;- rbind(learn_curve_data, c(i, error_rate_train, error_rate_test))         } }  colnames(learn_curve_data) &lt;- c(&quot;Size&quot;, &quot;Train_Error_Rate&quot;, &quot;Test_Error_Rate&quot;) learn_curve_data_long &lt;- melt(learn_curve_data, id = &quot;Size&quot;) ggplot(data=learn_curve_data_long, aes(x=Size, y=value, colour=variable)) +          geom_point() + stat_smooth() <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d54\/121\/57a\/d5412157a4274e60989d821ae0d05f42.png\"\/><\/p>\n<p>  \u0422\u0443\u0442 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/p>\n<ul>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e.<\/li>\n<li>\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043c\u0430\u043b\u044b \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c\u0441\u044f.<\/li>\n<li>\u0420\u0430\u0437\u0440\u044b\u0432 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0430\u043b.<\/li>\n<\/ul>\n<p>  \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u0442\u0440\u0435\u0442\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0442.\u0435. \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0442.\u043a. \u043d\u0435\u0442 \u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u043c\u0435\u0436\u0434\u0443 \u043a\u0440\u0438\u0432\u044b\u043c\u0438, \u043d\u043e \u0438 \u043d\u0435\u0442 \u044f\u0432\u043d\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u042f \u0431\u044b \u0441\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043d\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u0441\u044f. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0433\u0440\u0430\u0444\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043d\u0435\u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438, \u043f\u0443\u0441\u0442\u044c \u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443, \u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b.<\/p>\n<h3>Support Vector Machine<\/h3>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 <b>Support Vector Machine<\/b>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0449\u0451 \u0440\u0430\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u0438\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u0442.\u043a. \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u00ab\u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438\u00bb \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<pre><code>library(&quot;e1071&quot;) scale_model &lt;- preProcess(train[, -1], method = c(&quot;center&quot;, &quot;scale&quot;)) train_scale &lt;- predict(scale_model, train[, -1]) train_scale &lt;- cbind(train[, 1], train_scale) test_scale &lt;- predict(scale_model, test[, -1]) test_scale &lt;- cbind(test[, 1], test_scale) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a.<\/p>\n<pre><code>learn_curve_data &lt;- data.frame(integer(),                                double(),                                double()) for (n in 1:5 ) {         for (i in seq(10, 2010, by = 100))         {                 train_learn &lt;- train_scale[sample(nrow(train_scale), size = i),]                 test_learn &lt;- test_scale[sample(nrow(test_scale), size = i),]                 model_learn &lt;- svm(label ~ ., data = train_learn, kernel = &quot;radial&quot;, scale = F)                 predict_train_learn &lt;- predict(model_learn)                 error_rate_train &lt;- sum(train_learn$label != predict_train_learn)\/i                 predict_test_learn &lt;- predict(model_learn, newdata = test_learn)                 error_rate_test &lt;- sum(test_learn$label != predict_test_learn)\/i                 learn_curve_data &lt;- rbind(learn_curve_data, c(i, error_rate_train, error_rate_test))         } } colnames(learn_curve_data) &lt;- c(&quot;Size&quot;, &quot;Train_Error_Rate&quot;, &quot;Test_Error_Rate&quot;) learn_curve_data_long &lt;- melt(learn_curve_data, id = &quot;Size&quot;) ggplot(data=learn_curve_data_long, aes(x=Size, y=value, colour=variable)) +          geom_point() + stat_smooth(method = &quot;gam&quot;, formula = y ~ s(x), size = 1) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/614\/5b0\/96e\/6145b096e9cd4dbea9019991d37210ae.png\"\/><\/p>\n<ul>\n<li>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u0430.<\/li>\n<li>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u044b\u0432 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u043a\u0440\u0438\u0432\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f.<\/li>\n<li>\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u0430 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c\u0441\u044f.<\/li>\n<\/ul>\n<p>  \u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438, \u043a\u0430\u043a \u0440\u0430\u0437, \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438, \u0442.\u0435. \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u0438\u043b\u0438 \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0445 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f (<b>Learning Curve<\/b>) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0430\u0440\u0441\u0435\u043d\u0430\u043b\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0437 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 (PCA) \u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435. <br \/>  \u041e\u0441\u0442\u0430\u0432\u0430\u0442\u0435\u0441\u044c \u043d\u0430 \u0441\u0432\u044f\u0437\u0438!)               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/266727\/\"> http:\/\/habrahabr.ru\/post\/266727\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/60f\/d96\/61c\/60fd9661cf9944bf890193af5e035a5e.jpg\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0438 \u043e\u0431\u0435\u0449\u0430\u043b, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e Data Science \u043e\u0442 \u0440\u0435\u0431\u044f\u0442 \u0438\u0437 <a href=\"http:\/\/dscourse.mlclass.ru\">MLClass.ru<\/a> (\u043a\u0441\u0442\u0430\u0442\u0438, \u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0443\u0441\u043f\u0435\u043b \u2014 <a href=\"http:\/\/dscourse.mlclass.ru\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/a>). \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 <a href=\"https:\/\/www.kaggle.com\/c\/digit-recognizer\">Digit Recognizer<\/a> \u0438\u0437\u0443\u0447\u0438\u043c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043d\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u0435\u0440\u0432\u044b\u0445 \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438  <\/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-265488","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265488","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=265488"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265488\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}