{"id":268290,"date":"2015-11-16T15:16:02","date_gmt":"2015-11-16T12:16:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=268290"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=268290","title":{"rendered":"\u0422\u0438\u0442\u0430\u043d\u0438\u043a \u043d\u0430 Kaggle: \u0432\u044b \u043d\u0435 \u0434\u043e\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430"},"content":{"rendered":"<p>       \u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440!<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c3e\/cde\/5b7\/c3ecde5b78cd41e89b09f79af46311bb.png\"\/><br \/>  <b>#{Data Science \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432}<\/b><\/p>\n<p>  \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0413\u043b\u0435\u0431 \u041c\u043e\u0440\u043e\u0437\u043e\u0432, \u043c\u044b \u0441 \u0412\u0430\u043c\u0438 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u043f\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0441\u0442\u0430\u0442\u044c\u044f\u043c. \u041f\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u044c\u0431\u0430\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u043f\u044b\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0432 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 <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 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e <a href=\"http:\/\/dscourse.mlclass.ru\/\">\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u043a\u0443\u0440\u0441\u043e\u0432<\/a> \u2014 \u044d\u0442\u043e, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u044b\u0439 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u044b\u0439 \u043a\u0443\u0440\u0441 \u043f\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0431\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c).<\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u043e\u044e \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432\u044b\u0436\u0438\u0432\u0448\u0438\u0445 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u00ab\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430\u00bb. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0432 Data Science \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, <b>\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043b\u0438\u043d\u043d\u043e\u0439<\/b>. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0443\u0434\u0435\u043b\u0435\u043d\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 (<b>exploratory research<\/b>) \u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u0432\u044b\u0431\u043e\u0440\u0443 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u043e\u0432 (<b>feature engineering<\/b>). \u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f <b>Titanic: Machine Learning from Disaster<\/b> \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 Kaggle. \u0412 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u00abR\u00bb.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438, \u0442\u043e \u0422\u0438\u0442\u0430\u043d\u0438\u043a \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0430\u0439\u0441\u0431\u0435\u0440\u0433\u043e\u043c \u0432 11:40 \u0432\u0435\u0447\u0435\u0440\u0430 \u043a\u043e\u0440\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0438 \u043a\u043e\u0440\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0432 \u0441\u0432\u043e\u0438\u0445 \u043a\u0430\u044e\u0442\u0430\u0445. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u044e\u0442, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438\u043c\u0435\u043b\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0436\u0438\u0442\u044c, \u0442.\u043a. \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u044b \u043d\u0438\u0436\u043d\u0438\u0445 \u043f\u0430\u043b\u0443\u0431, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u0443\u0437\u043d\u0430\u043b\u0438 \u043e \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u043c\u0435\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u043f\u0430\u043b\u0443\u0431\u044b. \u0418, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0438\u043c, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0431\u044b\u043b\u043e \u0434\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0439 \u043a\u043e\u0440\u0430\u0431\u043b\u044f. \u041d\u0438\u0436\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044b \u0441\u0445\u0435\u043c\u044b \u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u043b\u0443\u0431 \u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0439. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/530\/f91\/bf0\/530f91bf048d46b7ad9f53854d9af266.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ddf\/307\/0c6\/ddf3070c69e0450184e35790f72917d1.jpeg\"\/><\/p>\n<p>  \u0422\u0438\u0442\u0430\u043d\u0438\u043a \u044f\u0432\u043b\u044f\u043b\u0441\u044f \u0431\u0440\u0438\u0442\u0430\u043d\u0441\u043a\u0438\u043c \u043a\u043e\u0440\u0430\u0431\u043b\u0435\u043c, \u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0437\u0430\u043a\u043e\u043d\u0430\u043c \u0411\u0440\u0438\u0442\u0430\u043d\u0438\u0438 \u043d\u0430 \u043a\u043e\u0440\u0430\u0431\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0448\u043b\u044e\u043f\u043e\u043a, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u043e\u0434\u043e\u0438\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u0441\u0443\u0434\u043d\u0430, \u0430 \u043d\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438. \u0422\u0438\u0442\u0430\u043d\u0438\u043a \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u044d\u0442\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u0438 \u0438\u043c\u0435\u043b 20 \u0448\u043b\u044e\u043f\u043e\u043a (14 \u0441\u043e \u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c\u044e 65 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, 2 \u2014 40 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, 4 \u2014 47 \u0447\u0435\u043b\u043e\u0432\u0435\u043a), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u044b \u043d\u0430 \u043f\u043e\u0433\u0440\u0443\u0437\u043a\u0443 1178 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u0432\u0441\u0435\u0433\u043e \u0436\u0435 \u043d\u0430 \u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0435 \u0431\u044b\u043b\u043e 2208 \u0447\u0435\u043b\u043e\u0432\u0435\u043a. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u043d\u0430\u044f, \u0447\u0442\u043e \u0448\u043b\u044e\u043f\u043e\u043a \u043d\u0430 \u0432\u0441\u0435\u0445 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442, \u043a\u0430\u043f\u0438\u0442\u0430\u043d \u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430 \u0421\u043c\u0438\u0442 \u043e\u0442\u0434\u0430\u043b, \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u0430\u0439\u0441\u0431\u0435\u0440\u0433\u043e\u043c, \u043f\u0440\u0438\u043a\u0430\u0437 \u0431\u0440\u0430\u0442\u044c \u043d\u0430 \u0448\u043b\u044e\u043f\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435\u043d\u0449\u0438\u043d \u0438 \u0434\u0435\u0442\u0435\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0447\u043b\u0435\u043d\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0438 \u0435\u043c\u0443.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  Kaggle \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0434\u0432\u0443\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 csv:<\/p>\n<ul>\n<li>train.csv (\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0441 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043e\u043c, \u0442.\u0435. \u0432\u044b\u0436\u0438\u043b \u0438\u043b\u0438 \u043d\u0435\u0442)<\/li>\n<li>test.csv (\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0431\u0435\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439)<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 R \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e read_csv \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 readr. \u0412 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u044f\u0434 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438: \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<pre><code>require(readr) data_train &lt;- read_csv(&quot;train.csv&quot;) data_test &lt;- read_csv(&quot;test.csv&quot;) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<pre><code>str(data_train) ## Classes 'tbl_df', 'tbl' and 'data.frame':    891 obs. of  12 variables: ##  $ PassengerId: int  1 2 3 4 5 6 7 8 9 10 ... ##  $ Survived   : int  0 1 1 1 0 0 0 0 1 1 ... ##  $ Pclass     : int  3 1 3 1 3 3 1 3 3 2 ... ##  $ Name       : chr  &quot;Braund, Mr. Owen Harris&quot; &quot;Cumings, Mrs. John Bradley (Florence Briggs Thayer)&quot; &quot;Heikkinen, Miss. Laina&quot; &quot;Futrelle, Mrs. Jacques Heath (Lily May Peel)&quot; ... ##  $ Sex        : chr  &quot;male&quot; &quot;female&quot; &quot;female&quot; &quot;female&quot; ... ##  $ Age        : num  22 38 26 35 35 NA 54 2 27 14 ... ##  $ SibSp      : int  1 1 0 1 0 0 0 3 0 1 ... ##  $ Parch      : int  0 0 0 0 0 0 0 1 2 0 ... ##  $ Ticket     : chr  &quot;A\/5 21171&quot; &quot;PC 17599&quot; &quot;STON\/O2. 3101282&quot; &quot;113803&quot; ... ##  $ Fare       : num  7.25 71.28 7.92 53.1 8.05 ... ##  $ Cabin      : chr  &quot;&quot; &quot;C85&quot; &quot;&quot; &quot;C123&quot; ... ##  $ Embarked   : chr  &quot;S&quot; &quot;C&quot; &quot;S&quot; &quot;S&quot; ... <\/code><\/pre>\n<h3>\u0410\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u0430\u043a \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b Data Scientist&#8217;s, \u0442.\u043a., \u043a\u0440\u043e\u043c\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u00ab\u0441\u044b\u0440\u044b\u0445\u00bb \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u0447\u0430\u0441\u0442\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0431\u044b\u043b\u0430 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c NA \u0438 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0431\u044b\u043b\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043e\u0441\u043e\u0431\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b NA. \u041d\u043e \u0441\u0440\u0435\u0434\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u0433\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0441 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0438\u0445 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 magrittr \u0438 dplyr<\/p>\n<pre><code>require(magrittr) require(dplyr) data_train %&gt;% select(Name, Sex, Ticket, Cabin, Embarked) %&gt;% apply(., 2, function(column) sum(column == &quot;&quot;))  ##     Name      Sex   Ticket    Cabin Embarked  ##        0        0        0      687        2 <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043d\u0430 NA, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e recode \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 car<\/p>\n<pre><code>require(car) data_train$Cabin &lt;- recode(data_train$Cabin, &quot;'' = NA&quot;) data_train$Embarked &lt;- recode(data_train$Embarked, &quot;'' = NA&quot;) <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e missmap \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 Amelia.<\/p>\n<pre><code>require(colorspace) colors_A &lt;- sequential_hcl(2) require(Amelia) missmap(data_train, col = colors_A, legend=FALSE) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/720\/862\/637\/720862637b6f402aab7ce37f5fdce4b7.png\"\/><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u043e \u043e\u043a\u043e\u043b\u043e 20% \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 Age \u0438 \u043f\u043e\u0447\u0442\u0438 80% \u0432 Cabin. \u0418 \u0435\u0441\u043b\u0438 \u0441 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u043c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\u0445 \u0434\u043e\u043b\u0435\u0439, \u0442\u043e \u0441 \u043a\u0430\u044e\u0442\u0430\u043c\u0438 \u043c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0442.\u043a. \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0436\u0435\u043b\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445. \u041f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0435 Embarked<\/p>\n<p>  \u041a \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u043c\u044b \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043f\u043e\u0437\u0434\u043d\u0435\u0435, \u0430 \u043f\u043e\u043a\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u0442\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0432\u043b\u0438\u044f\u044e\u0449\u0438\u0435 \u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0436\u0438\u0442\u044c \u043f\u0440\u0438 \u043a\u0440\u0443\u0448\u0435\u043d\u0438\u0438 \u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431 \u044d\u0442\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432.<\/p>\n<pre><code>## \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u044f \u0431\u0443\u0434\u0443 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 'ggplot2' require(ggplot2) require(gridExtra) data_train %&lt;&gt;% transform(., Survived = as.factor(Survived),                           Pclass = as.factor(Pclass),                            Sex = as.factor(Sex),                           Embarked = as.factor(Embarked),                           SibSp = as.numeric(SibSp)) colours &lt;- rainbow_hcl(4, start = 30, end = 300)  ggbar &lt;- ggplot(data_train) + geom_bar(stat = &quot;bin&quot;, width=.6, fill= colours[3], colour=&quot;black&quot;) +         guides(fill=FALSE) + ylab(NULL) g1 &lt;- ggbar + aes(x = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;))) +          ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0433\u0438\u0431\u0448\u0438\u0445\\n \u0438 \u0441\u043f\u0430\u0441\u0448\u0438\u0445\u0441\u044f \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432&quot;) + xlab(NULL) g2 &lt;- ggbar + aes(x = factor(Pclass, labels = c(&quot;\u041f\u0435\u0440\u0432\u044b\u0439&quot;, &quot;\u0412\u0442\u043e\u0440\u043e\u0439&quot;, &quot;\u0422\u0440\u0435\u0442\u0438\u0439&quot;))) +          ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432\\n \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f&quot;) + xlab(NULL) g3 &lt;- ggbar + aes(x = factor(Sex, labels = c(&quot;\u0416\u0435\u043d\u0449\u0438\u043d\u0430&quot;, &quot;\u041c\u0443\u0436\u0447\u0438\u043d\u0430&quot;))) +          ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u0430\u043c\u0438&quot;) + xlab(NULL) g4 &lt;- ggbar + aes(x = as.factor(SibSp)) +          ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u043e \u0441\u0443\u043c\u043c\u0435\\n '\u0441\u0443\u043f\u0440\u0443\u0433 + \u0431\u0440\u0430\u0442\u044c\u044f \u0438 \u0441\u0451\u0441\u0442\u0440\u044b \u043d\u0430 \u0431\u043e\u0440\u0442\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u044f'&quot;) +          xlab(NULL) g5 &lt;- ggbar + aes(x = as.factor(Parch)) +          ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u043e \u0441\u0443\u043c\u043c\u0435\\n '\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0438 + \u0434\u0435\u0442\u0438 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443'&quot;) + xlab(NULL) g6 &lt;- ggbar + aes(x = factor(Embarked, labels = c(&quot;Cherbourg&quot;, &quot;Queenstown&quot;, &quot;Southampton&quot;))) +         ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432\\n \u043f\u043e \u043f\u0443\u043d\u043a\u0442\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f&quot;) +          xlab(NULL)  gghist &lt;- ggplot(data_train) + geom_histogram(fill= colours[4]) + guides(fill=FALSE) + ylab(NULL) g7 &lt;- gghist + aes(x = Age) + xlab(NULL) + ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043c&quot;) g8 &lt;- gghist + aes(x = Fare) + xlab(NULL) + ggtitle(&quot;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432\\n \u043f\u043e \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u0438\u043b\u0435\u0442\u043e\u0432&quot;)  grid.arrange(g1, g2, g3, g4, g5, g6, g7, g8, ncol = 2, nrow=4) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d1a\/3a1\/4a8\/d1a3a14a8e15477b8ec929ab8e11ac86.png\"\/><\/p>\n<p>  \u0423\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u043e\u0433\u0438\u0431\u043b\u043e \u0447\u0435\u043c \u0441\u043f\u0430\u0441\u043b\u043e\u0441\u044c<\/li>\n<li>\u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0432 \u043a\u0430\u044e\u0442\u0430\u0445 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430<\/li>\n<li>\u043c\u0443\u0436\u0447\u0438\u043d \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0436\u0435\u043d\u0449\u0438\u043d<\/li>\n<\/ul>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430 (\u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u0440\u0438\u043a\u0430\u0437 \u043a\u0430\u043f\u0438\u0442\u0430\u043d\u0430, \u043f\u0440\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043f\u0438\u0441\u0430\u043b \u0440\u0430\u043d\u0435\u0435) \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u044e\u0442\u044b.<\/p>\n<p>  \u041d\u0435\u043d\u0430\u0434\u043e\u043b\u0433\u043e \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c. \u0418\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u043e \u043f\u0443\u043d\u043a\u0442\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0438\u0437 Southampton, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c 2 NA \u044d\u0442\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c<\/p>\n<pre><code>data_train$Embarked[is.na(data_train$Embarked)] &lt;- &quot;S&quot; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0436\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u0430\u043c\u0438. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0442\u0435\u043e\u0440\u0438\u044e, \u0447\u0442\u043e \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u043a\u043b\u0430\u0441\u0441 \u043a\u0430\u044e\u0442\u044b \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430 \u2014 \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0448\u0430\u043d\u0441\u044b \u0432\u044b\u0436\u0438\u0442\u044c. (\u041f\u043e\u0434 \u00ab\u0432\u044b\u0448\u0435\u00bb&quot; \u044f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a, \u0442.\u043a. \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0432\u044b\u0448\u0435 \u0447\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0438, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0442\u0440\u0435\u0442\u0438\u0439.)<\/p>\n<pre><code>ggbar &lt;- ggplot(data_train) + geom_bar(stat = &quot;bin&quot;, width=.6) ggbar + aes(x = factor(Pclass, labels = c(&quot;\u041f\u0435\u0440\u0432\u044b\u0439&quot;, &quot;\u0412\u0442\u043e\u0440\u043e\u0439&quot;, &quot;\u0422\u0440\u0435\u0442\u0438\u0439&quot;)),             fill = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;))) +          scale_fill_manual (values=colours[]) +         guides(fill=guide_legend(title=NULL)) +          ylab(NULL) + xlab(&quot;\u041a\u043b\u0430\u0441\u0441 \u043a\u0430\u044e\u0442\u044b&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/aa4\/12f\/37e\/aa412f37ee2d47368093e4c7fd09ca0e.png\"\/><\/p>\n<p>  \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0448\u0430\u043d\u0441\u044b \u0432\u044b\u0436\u0438\u0442\u044c \u0443 \u043c\u0443\u0436\u0447\u0438\u043d \u0438 \u0436\u0435\u043d\u0449\u0438\u043d. \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442 \u0442\u0435\u043e\u0440\u0438\u044e, \u0432\u044b\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0440\u0430\u043d\u0435\u0435.<\/p>\n<pre><code>ggbar + aes(x = factor(Sex, labels = c(&quot;\u0416\u0435\u043d\u0449\u0438\u043d\u0430&quot;, &quot;\u041c\u0443\u0436\u0447\u0438\u043d\u0430&quot;)),             fill = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;))) +         scale_fill_manual (values=colours[]) +         guides(fill=guide_legend(title=NULL)) +          ylab(NULL) + xlab(&quot;\u041f\u043e\u043b \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b4e\/0d5\/6a4\/b4e0d56a43e54899bba76c54b04b7d3b.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0448\u0430\u043d\u0441\u044b \u0432\u044b\u0436\u0438\u0442\u044c \u0443 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0440\u0442\u043e\u0432 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code>ggbar + aes(x = factor(Embarked, labels = c(&quot;Cherbourg&quot;, &quot;Queenstown&quot;, &quot;Southampton&quot;)),             fill = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;))) +         scale_fill_manual (values=colours[]) +         guides(fill=guide_legend(title=NULL)) +          ylab(NULL) + xlab(&quot;\u041f\u043e\u0440\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2e8\/508\/23a\/2e850823a3274336b9b69ea471bba7dd.png\"\/><\/p>\n<p>  \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0441\u0432\u044f\u0437\u044c, \u043d\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043f\u043e\u0440\u0442\u0430\u043c\u0438, \u0447\u0442\u043e \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a.<\/p>\n<pre><code>ggbar + aes(x = factor(Embarked, labels = c(&quot;Cherbourg&quot;, &quot;Queenstown&quot;, &quot;Southampton&quot;)),             fill = factor(Pclass, labels = c(&quot;\u041f\u0435\u0440\u0432\u044b\u0439&quot;, &quot;\u0412\u0442\u043e\u0440\u043e\u0439&quot;, &quot;\u0422\u0440\u0435\u0442\u0438\u0439&quot;))) +         scale_fill_manual (values=colours[]) +         guides(fill=guide_legend(title=&quot;\u041a\u043b\u0430\u0441\u0441 \u043a\u0430\u044e\u0442\u044b&quot;)) +          ylab(NULL) + xlab(&quot;\u041f\u043e\u0440\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7cf\/6ca\/34f\/7cf6ca34f21342fc87e16be987b7a711.png\"\/><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0443, \u0447\u0442\u043e \u0432\u044b\u0436\u0438\u0432\u0430\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u043b\u043e\u0434\u044b\u0435, \u0442.\u043a. \u043e\u043d\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0434\u0432\u0438\u0433\u0430\u044e\u0442\u0441\u044f, \u043b\u0443\u0447\u0448\u0435 \u043f\u043b\u0430\u0432\u0430\u044e\u0442 \u0438 \u0442.\u0434.<\/p>\n<pre><code>ggplot(data_train, aes(x = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;)),                         y = Age, fill = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;)))) +         geom_boxplot() + scale_fill_manual (values=colours[]) +         guides(fill=guide_legend(title=NULL)) +          ylab(NULL) + xlab(NULL) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/0ca\/3c1\/cf3\/0ca3c1cf3c3048afa826d0c717c4c8d3.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u044f\u0432\u043d\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442 \u043c\u044b\u0441\u043b\u0438 \u0432\u044b\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u043d\u0435\u0435. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0448\u0430\u043d\u0441\u044b \u0432\u044b\u0436\u0438\u0442\u044c \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0432\u043e\u0437\u0440\u0430\u0441\u0442 \u2014 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u0430\u0431\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438. \u041c\u0435\u0436\u0434\u0443 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u043c \u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f, \u0447\u0442\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u044b \u0447\u0430\u0449\u0435 \u043c\u043e\u0433\u043b\u0438 \u0441\u0435\u0431\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0440\u043e\u0433\u0443\u044e \u043a\u0430\u044e\u0442\u0443. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0431\u0438\u043b\u0435\u0442\u0430 \u0438 \u043a\u043b\u0430\u0441\u0441 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b (\u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438), \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e.<\/p>\n<pre><code>source('my.plotcorr.R') corplot_data &lt;- data_train %&gt;%          select(Survived, Pclass, Sex, Age, SibSp, Parch, Fare, Embarked) %&gt;%         mutate(Survived = as.numeric(Survived), Pclass = as.numeric(Pclass),                Sex = as.numeric(Sex), Embarked = as.numeric(Embarked)) corr_train_data &lt;- cor(corplot_data, use = &quot;na.or.complete&quot;) colsc &lt;- c(rgb(241, 54, 23, maxColorValue=255), 'white', rgb(0, 61, 104, maxColorValue=255)) colramp &lt;- colorRampPalette(colsc, space='Lab') colorscor &lt;-  colramp(100) my.plotcorr(corr_train_data, col=colorscor[((corr_train_data + 1)\/2) * 100],             upper.panel=&quot;number&quot;, mar=c(1,2,1,1), main='\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438') <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/be8\/3fe\/6cb\/be83fe6cb5d84fa3b3377dc269d3508b.png\"\/><\/p>\n<p>  \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0434\u0438\u043d \u0438\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0431\u043e\u0440\u044c\u0431\u044b \u0441 \u043d\u0438\u043c\u0438 \u2014 \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0430 \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 177 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 Age \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 29.7<\/p>\n<pre><code>summary(data_train$Age) ##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's  ##    0.42   20.12   28.00   29.70   38.00   80.00     177 <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u044f \u0443\u0436\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b \u0440\u0430\u043d\u043d\u0435\u0435 \u0441 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c Embarked, \u043d\u043e \u0442\u0430\u043c \u0431\u044b\u043b\u043e \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u0437\u0430\u043c\u0435\u043d\u044b, \u0430 \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u2014 177, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 20% \u043e\u0442 \u0432\u0441\u0435\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043c\u0435\u043d\u044b.<\/p>\n<p>  \u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0435\u0435, \u043d\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u044e\u0442\u044b, \u0442.\u043a., \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435, \u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430. \u0418, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e: \u0447\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 \u0442\u0435\u043c \u0435\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u0431\u043b\u0430\u0433\u043e\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u044b\u0448\u0435 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u044b\u0448\u0435 \u0438 \u0442\u043e\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u0435\u0431\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0447\u0442\u043e \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u043e\u043c, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430\u043c.<\/p>\n<pre><code>ggplot(data_train, aes(x = factor(Pclass, labels = c(&quot;\u041f\u0435\u0440\u0432\u044b\u0439&quot;, &quot;\u0412\u0442\u043e\u0440\u043e\u0439&quot;, &quot;\u0422\u0440\u0435\u0442\u0438\u0439&quot;)),                         y = Age, fill = factor(Pclass))) +          geom_boxplot() + scale_fill_manual (values=colours) +          ylab(&quot;\u0412\u043e\u0437\u0440\u0430\u0441\u0442&quot;) + xlab(&quot;\u041a\u043b\u0430\u0441\u0441 \u043a\u0430\u044e\u0442\u044b&quot;) + guides(fill=FALSE) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d06\/376\/a9c\/d06376a9c7fc48a0936a42ce15c3535d.png\"\/><\/p>\n<p>  \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0437\u0430\u043c\u0435\u043d\u044b \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 Age. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 Name, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code>head(data_train$Name) ## [1] &quot;Braund, Mr. Owen Harris&quot;                             ## [2] &quot;Cumings, Mrs. John Bradley (Florence Briggs Thayer)&quot; ## [3] &quot;Heikkinen, Miss. Laina&quot;                              ## [4] &quot;Futrelle, Mrs. Jacques Heath (Lily May Peel)&quot;        ## [5] &quot;Allen, Mr. William Henry&quot;                            ## [6] &quot;Moran, Mr. James&quot; <\/code><\/pre>\n<p>  \u0418\u043c\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0443: \u00ab\u0424\u0430\u043c\u0438\u043b\u0438\u044f, \u0413\u043e\u043d\u043e\u0440\u0430\u0442\u0438\u0432. \u0418\u043c\u044f\u00bb. \u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 Master \u0432 19 \u0432\u0435\u043a\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0434\u0435\u0442\u044f\u043c \u043c\u0443\u0436\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0437\u043a\u0438\u0445 \u0438 \u0442\u043e\u0447\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0443. \u0410 Miss \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043d\u0435\u0437\u0430\u043c\u0443\u0436\u043d\u0438\u043c \u0436\u0435\u043d\u0449\u0438\u043d\u0430\u043c, \u043d\u043e \u0432 19 \u0432\u0435\u043a\u0435 \u043d\u0435\u0437\u0430\u043c\u0443\u0436\u043d\u0438\u043c\u0438 \u0431\u044b\u043b\u0438, \u0432 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u043b\u043e\u0434\u044b\u0435 \u0434\u0435\u0432\u0443\u0448\u043a\u0438 \u0438 \u0434\u0435\u0432\u043e\u0447\u043a\u0438. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a Title.<\/p>\n<pre><code>require(stringr) data_train$Title &lt;-  data_train$Name %&gt;% str_extract(., &quot;\\\\w+\\\\.&quot;) %&gt;% str_sub(.,1, -2) unique(data_train$Title) ##  [1] &quot;Mr&quot;       &quot;Mrs&quot;      &quot;Miss&quot;     &quot;Master&quot;   &quot;Don&quot;      &quot;Rev&quot;      ##  [7] &quot;Dr&quot;       &quot;Mme&quot;      &quot;Ms&quot;       &quot;Major&quot;    &quot;Lady&quot;     &quot;Sir&quot;      ## [13] &quot;Mlle&quot;     &quot;Col&quot;      &quot;Capt&quot;     &quot;Countess&quot; &quot;Jonkheer&quot; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0438\u0442\u0443\u043b\u044b, \u0441\u0440\u0435\u0434\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u043c.<\/p>\n<pre><code>mean_title &lt;- data_train %&gt;% group_by(Title) %&gt;%          summarise(count = n(), Missing = sum(is.na(Age)), Mean = round(mean(Age, na.rm = T), 2)) mean_title ## Source: local data frame [17 x 4] ##  ##       Title count Missing  Mean ## 1      Capt     1       0 70.00 ## 2       Col     2       0 58.00 ## 3  Countess     1       0 33.00 ## 4       Don     1       0 40.00 ## 5        Dr     7       1 42.00 ## 6  Jonkheer     1       0 38.00 ## 7      Lady     1       0 48.00 ## 8     Major     2       0 48.50 ## 9    Master    40       4  4.57 ## 10     Miss   182      36 21.77 ## 11     Mlle     2       0 24.00 ## 12      Mme     1       0 24.00 ## 13       Mr   517     119 32.37 ## 14      Mrs   125      17 35.90 ## 15       Ms     1       0 28.00 ## 16      Rev     6       0 43.17 ## 17      Sir     1       0 49.00 <\/code><\/pre>\n<p>  \u0418 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u0437\u0430\u043c\u0435\u043d\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0435\u0451 \u043a \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443 Age.<\/p>\n<pre><code>impute.mean &lt;- function (impute_col, filter_var, var_levels) {         for (lev in var_levels) {                  impute_col[(filter_var == lev) & is.na(impute_col)] &lt;-                         mean(impute_col[filter_var == lev], na.rm = T)         }         return (impute_col) } data_train$Age &lt;- impute.mean(data_train$Age, data_train$Title, c(&quot;Dr&quot;, &quot;Master&quot;, &quot;Mrs&quot;, &quot;Miss&quot;, &quot;Mr&quot;)) summary(data_train$Age)  ##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.  ##    0.42   21.77   30.00   29.75   35.90   80.00 <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a Fare(\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0431\u0438\u043b\u0435\u0442\u0430), \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0438\u043b\u0435\u0442\u044b \u0441 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c\u044e.<\/p>\n<pre><code>head(table(data_train$Fare)) ##  ##      0 4.0125      5 6.2375 6.4375   6.45  ##     15      1      1      1      1      1 <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u2014 \u044d\u0442\u043e \u0434\u0435\u0442\u0438, \u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u044d\u0442\u0438\u0445 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432, \u0442\u043e \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u043c.<\/p>\n<pre><code>data_train %&gt;% filter(Fare &lt; 6) %&gt;% select(Fare, Age, Pclass, Title) %&gt;% arrange(Fare)  ##      Fare      Age Pclass    Title ## 1  0.0000 36.00000      3       Mr ## 2  0.0000 40.00000      1       Mr ## 3  0.0000 25.00000      3       Mr ## 4  0.0000 32.36809      2       Mr ## 5  0.0000 19.00000      3       Mr ## 6  0.0000 32.36809      2       Mr ## 7  0.0000 32.36809      2       Mr ## 8  0.0000 32.36809      2       Mr ## 9  0.0000 49.00000      3       Mr ## 10 0.0000 32.36809      1       Mr ## 11 0.0000 32.36809      2       Mr ## 12 0.0000 32.36809      2       Mr ## 13 0.0000 39.00000      1       Mr ## 14 0.0000 32.36809      1       Mr ## 15 0.0000 38.00000      1 Jonkheer ## 16 4.0125 20.00000      3       Mr ## 17 5.0000 33.00000      1       Mr <\/code><\/pre>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0443\u044e\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e impute.mean.<\/p>\n<pre><code>data_train$Fare[data_train$Fare == 0] &lt;- NA data_train$Fare &lt;- impute.mean(data_train$Fare, data_train$Pclass, as.numeric(levels(data_train$Pclass))) <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0437\u043d\u0430\u043a Title \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0435 Age \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u0435 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430, \u0435\u0433\u043e \u0437\u043d\u0430\u0442\u043d\u043e\u0441\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Don \u0438 Sir) \u0438 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0435 \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u0448\u043b\u044e\u043f\u043a\u0430\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412\u0441\u0435\u0433\u043e \u0443 \u043d\u0430\u0441 17 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u0441 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u043c.<\/p>\n<pre><code>ggplot(data_train, aes(x = factor(Title,                                    c(&quot;Capt&quot;,&quot;Col&quot;,&quot;Major&quot;,&quot;Sir&quot;,&quot;Lady&quot;,&quot;Rev&quot;,                                    &quot;Dr&quot;,&quot;Don&quot;,&quot;Jonkheer&quot;,&quot;Countess&quot;,&quot;Mrs&quot;,                                      &quot;Ms&quot;,&quot;Mr&quot;,&quot;Mme&quot;,&quot;Mlle&quot;,&quot;Miss&quot;,&quot;Master&quot;)),                         y = Age)) + geom_boxplot(fill= colours[3]) + guides(fill=FALSE) +         guides(fill=guide_legend(title=NULL)) + ylab(&quot;\u0412\u043e\u0437\u0440\u0430\u0441\u0442&quot;) + xlab(NULL) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1fb\/a9e\/656\/1fba9e6561124cb99a18089cfac9edc8.png\"\/><\/p>\n<p>  \u041d\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043a\u0430\u043a \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0432 5 \u0433\u0440\u0443\u043f\u043f: Aristocratic, Mr, Mrs, Miss \u0438 Master, \u0442.\u043a. \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c\u044b\u0435 \u0442\u0438\u0442\u0443\u043b\u044b \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u043b\u0438 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0433\u0440\u0443\u043f\u043f\u0430\u043c.<\/p>\n<pre><code>change.titles &lt;- function(data, old_title, new_title) {   for (title in old_title) {     data$Title[data$Title == title] &lt;- new_title   }   return (data$Title) } data_train$Title &lt;- change.titles(data_train,                                 c(&quot;Capt&quot;, &quot;Col&quot;, &quot;Don&quot;, &quot;Dr&quot;,                                 &quot;Jonkheer&quot;, &quot;Lady&quot;, &quot;Major&quot;,                                 &quot;Rev&quot;, &quot;Sir&quot;, &quot;Countess&quot;),                                &quot;Aristocratic&quot;) data_train$Title &lt;- change.titles(data_train, c(&quot;Ms&quot;),                                 &quot;Mrs&quot;) data_train$Title &lt;- change.titles(data_train, c(&quot;Mlle&quot;, &quot;Mme&quot;), &quot;Miss&quot;) data_train$Title &lt;- as.factor(data_train$Title) ggplot(data_train, aes(x = factor(Title,                                    c(&quot;Aristocratic&quot;, &quot;Mrs&quot;, &quot;Mr&quot;, &quot;Miss&quot;, &quot;Master&quot;)),                         y = Age)) + geom_boxplot(fill= colours[3]) + guides(fill=FALSE) +         guides(fill=guide_legend(title=NULL)) + ylab(&quot;\u0412\u043e\u0437\u0440\u0430\u0441\u0442&quot;) + xlab(NULL) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4fc\/11b\/2ef\/4fc11b2efee248a0b4294ac658c6a355.png\"\/><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0432\u0435\u0434\u0451\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043a\u0430\u043a \u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0433\u0440\u0443\u043f\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435.<\/p>\n<pre><code>Surv_rate_title &lt;- data_train %&gt;% group_by(Title) %&gt;%          summarise(Rate = mean(as.numeric(as.character(Survived)))) ggplot(Surv_rate_title, aes(x = Title, y = Rate)) +          geom_bar(stat = &quot;identity&quot;, width=.6, fill= colours[3]) +         xlab(NULL) + ylab(&quot;\u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f9b\/7aa\/301\/f9b7aa301c0d4e31ab87cb091de8d8e6.png\"\/><\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u043b\u0443\u0447\u0448\u0435 \u0447\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0430, \u043a\u0430\u043a \u044f \u0434\u0443\u043c\u0430\u044e \u043d\u0438\u0447\u0435\u0433\u043e \u0435\u0449\u0451 \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0432\u044b\u0436\u0438\u0432\u0448\u0438\u0445 \u2014 \u044d\u0442\u043e \u0436\u0435\u043d\u0449\u0438\u043d\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u043e\u0432. \u0410 \u0441\u0440\u0435\u0434\u0438 \u043c\u0443\u0436\u0447\u0438\u043d \u0432\u044b\u0436\u0438\u043b\u0438 \u0432\u0441\u0435 \u043c\u0430\u043b\u044c\u0447\u0438\u043a\u0438 \u043c\u043e\u043b\u043e\u0436\u0435 15 \u043b\u0435\u0442 \u043a\u0440\u043e\u043c\u0435 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043e\u043b\u044f \u043c\u0443\u0436\u0447\u0438\u043d \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430 \u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<pre><code>ggplot(data = data_train,         aes(x = Age, y = Pclass, color = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;)))) +         geom_point(shape = 1, size = 4, position=position_jitter(width=0.1,height=.1)) +         facet_grid(Sex ~ .) + guides(color=guide_legend(title=NULL)) +         xlab(&quot;\u0412\u043e\u0437\u0440\u0430\u0441\u0442&quot;) + ylab(&quot;\u041a\u043b\u0430\u0441\u0441 \u043a\u0430\u044e\u0442\u044b&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/9ed\/057\/3eb\/9ed0573eb46d4f729f0b7f58118e6d4d.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u043a\u043e\u0440\u0430\u0431\u043b\u0435.<\/p>\n<pre><code>ggplot(data_train, aes(x = SibSp, y = Parch,                         color = factor(Survived, labels = c(&quot;\u041f\u043e\u0433\u0438\u0431&quot;, &quot;\u0412\u044b\u0436\u0438\u043b&quot;)))) +          geom_point(shape = 1, size = 4,                     position=position_jitter(width=0.3,height=.3)) +         guides(color=guide_legend(title=NULL)) +          xlab(&quot;\u041a\u043e\u043b-\u0432\u043e \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432\\n \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438,\\n \u0442.\u0435. \u0431\u0440\u0430\u0442\u044c\u044f, \u0441\u0451\u0441\u0442\u0440\u044b&quot;) +          ylab(&quot;\u041a\u043e\u043b-\u0432\u043e \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432\\n \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438,\\n \u0442.\u0435. \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0438, \u0434\u0435\u0442\u0438 \u0438 \u0442.\u0434.&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e5d\/acb\/3fb\/e5dacb3fb5734a3e8517a4ee7e42c8ec.png\"\/><\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u043d\u0430 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043a\u0430\u043a \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u0437 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e.<\/p>\n<p>  \u0412\u0432\u0435\u0434\u0451\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043a\u0430\u043a Family, \u0442.\u0435. \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u044f \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c.<\/p>\n<pre><code>Surv_rate_family &lt;- data_train %&gt;% group_by(Family = SibSp + Parch) %&gt;%          summarise(Rate = mean(as.numeric(as.character(Survived)))) ggplot(Surv_rate_family, aes(x = as.factor(Family), y = Rate)) +          geom_bar(stat = &quot;identity&quot;, width=.6, fill= colours[3]) +         xlab(&quot;\u041a\u043e\u043b-\u0432\u043e \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u044f&quot;) + ylab(&quot;\u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/cff\/871\/625\/cff8716257cc4658a90daf3247db66d1.png\"\/><\/p>\n<p>  \u0418 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043f\u043e \u043f\u043e\u043b\u0430\u043c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432.<\/p>\n<pre><code>data_train$Family &lt;- data_train$SibSp + data_train$Parch ggplot(data_train, aes(x = factor(Family), y = as.numeric(as.character(Survived)))) +          stat_summary( fun.y = mean, ymin=0, ymax=1, geom=&quot;bar&quot;, size=4, fill= colours[2]) +         xlab(&quot;\u041a\u043e\u043b-\u0432\u043e \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u044f&quot;) + ylab(&quot;\u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438&quot;) + facet_grid(Sex ~ .) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b08\/53c\/21a\/b0853c21a46647aeb81fb5861847e50e.png\"\/><\/p>\n<p>  \u041d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0436\u0435\u043d\u0449\u0438\u043d\u044b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0436\u0438\u0442\u044c. \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043d\u043e, \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043d\u0430\u0434\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0435\u0433\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438. \u0422\u0430\u043a \u0436\u0435, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0442\u0430\u043a\u043e\u0439 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043a\u0430\u043a \u00ab\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443\u00bb.<\/p>\n<pre><code>data_train$isFamily &lt;- as.factor(as.numeric(data_train$Family &gt; 0)) ggplot( data_train, aes(x=factor(isFamily, labels =c(&quot;\u041d\u0435\u0442&quot;, &quot;\u0415\u0441\u0442\u044c&quot;)),y=as.numeric(as.character(Survived))) ) +         stat_summary( fun.y = mean, ymin=0, ymax=1, geom=&quot;bar&quot;, size=4, fill= colours[2]) +          ylab(&quot;\u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438&quot;) + xlab(&quot;\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u044f&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d46\/2f5\/7ef\/d462f57ef5324bc6b3bc49653677b87b.png\"\/><\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0436\u0438\u0442\u044c, \u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0432\u044f\u0437\u044c \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0438 \u043f\u043e\u043b\u0443, \u0442\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<pre><code>ggplot(data_train, aes(x = factor(isFamily, labels =c(&quot;\u041d\u0435\u0442&quot;, &quot;\u0415\u0441\u0442\u044c&quot;)), y = as.numeric(as.character(Survived)))) +         stat_summary( fun.y = &quot;mean&quot;, geom=&quot;bar&quot;, ymin=0, ymax=1, fill= colours[2]) +          facet_grid(Pclass ~ Sex) + ylab(&quot;\u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438&quot;) + xlab(&quot;\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u044f&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d01\/7bc\/eb3\/d017bceb370a43dbb71fe24e44723fc9.png\"\/><\/p>\n<p>  \u0414\u043b\u044f \u043c\u0443\u0436\u0447\u0438\u043d\u044b \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u0438 \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c, \u043d\u043e \u0434\u043b\u044f \u0436\u0435\u043d\u0449\u0438\u043d\u044b \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u2014 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f.<\/p>\n<p>  \u0418\u0437 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 Cabin, \u0442.\u0435. \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043d\u043e\u043c\u0435\u0440 \u043f\u0430\u043b\u0443\u0431\u044b (\u044d\u0442\u043e \u0431\u0443\u043a\u0432\u0430 \u0432 \u043d\u043e\u043c\u0435\u0440\u0435) \u0438 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u0431\u043e\u0440\u0442\u0443 \u0431\u044b\u043b\u0430 \u043a\u0430\u044e\u0442\u0430 (\u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0446\u0438\u0444\u0440\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0435\u0447\u0451\u0442\u043d\u0430\u044f, \u0442\u043e \u044d\u0442\u043e \u043b\u0435\u0432\u044b\u0439 \u0431\u043e\u0440\u0442, \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442), \u043d\u043e, \u0442.\u043a. \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442 \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0443 20% \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432, \u0442\u043e \u044f \u043d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u043f\u043e \u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430. \u041d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u0442\u0430\u043b\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u043d\u0430 \u0442\u0435\u043b\u0435 \u0441\u0442\u044e\u0430\u0440\u0442\u0430 Herbert Cave, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u043d\u043e\u043c\u0435\u0440 \u043a\u0430\u044e\u0442\u044b \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u043b\u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0442\u043e \u043e\u043d \u0432\u044b\u0436\u0438\u043b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u0438 \u0441 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u0430\u043c\u0438, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442\u044b \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430\u043c \u0438 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0438 \u043f\u043e\u043b\u0443.<\/p>\n<pre><code>data_train$isCabin &lt;- factor(ifelse(is.na(data_train$Cabin),0,1)) ggplot( data_train, aes(x=factor(isCabin, labels =c(&quot;\u041d\u0435\u0442&quot;, &quot;\u0415\u0441\u0442\u044c&quot;)),y=as.numeric(as.character(Survived))) ) +         stat_summary( fun.y = mean, ymin=0, ymax=1, geom=&quot;bar&quot;, size=4, fill= colours[3]) +          ylab(&quot;\u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438&quot;) + xlab(&quot;\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442\u044b&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7a3\/2ff\/307\/7a32ff307bab485bab327122642692d2.png\"\/><\/p>\n<pre><code>ggplot(data_train, aes(x = factor(isCabin, labels =c(&quot;\u041d\u0435\u0442&quot;, &quot;\u0415\u0441\u0442\u044c&quot;)), y = as.numeric(as.character(Survived)))) +         stat_summary( fun.y = &quot;mean&quot;, geom=&quot;bar&quot;, ymin=0, ymax=1, fill= colours[3]) +          facet_grid(Pclass ~ Sex) + ylab(&quot;\u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438&quot;) + xlab(&quot;\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u044e\u0442\u044b&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/247\/673\/31f\/24767331f3674aa698966775179aa4ab.png\"\/><\/p>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b\u043e\u0441\u044c, \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043c\u0443\u0436\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u0430.<\/p>\n<p>  \u041f\u043e\u0434\u0432\u0435\u0434\u0451\u043c \u0438\u0442\u043e\u0433 \u0432\u0441\u0435\u0439 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u0430:<\/p>\n<ul>\n<li>\u0411\u044b\u043b\u0438 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437.<\/li>\n<li>\u0411\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 Title, Family, isFamily, isCabin, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043e \u043f\u043e\u043b\u044c\u0437\u0435 \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<pre><code>data_train %&lt;&gt;% select(Survived, Pclass, Sex, Age, Fare, Embarked, Title, Family, isFamily, isCabin) <\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<pre><code>corplot_data &lt;- data_train %&gt;%          select(Survived, Pclass, Sex, Age, Fare, Embarked, Family, isFamily, isCabin) %&gt;%         mutate(Survived = as.numeric(Survived), Pclass = as.numeric(Pclass),                Sex = as.numeric(Sex), Embarked = as.numeric(Embarked),                isFamily = as.numeric(isFamily), isCabin = as.numeric(isCabin)) corr_train_data &lt;- cor(corplot_data, use = &quot;na.or.complete&quot;) colsc &lt;- c(rgb(241, 54, 23, maxColorValue=255), 'white', rgb(0, 61, 104, maxColorValue=255)) colramp &lt;- colorRampPalette(colsc, space='Lab') colorscor &lt;-  colramp(100) my.plotcorr(corr_train_data, col=colorscor[((corr_train_data + 1)\/2) * 100],             upper.panel=&quot;number&quot;, mar=c(1,2,1,1), main='\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438') <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/5aa\/199\/2ab\/5aa1992ab9424e378a6e6064c7340c4a.png\"\/><\/p>\n<p>  \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<pre><code>require(plyr) require(dplyr) data_train$Survived %&lt;&gt;% revalue(., c(&quot;0&quot;=&quot;Died&quot;, &quot;1&quot; = &quot;Survived&quot;)) data_train$Pclass %&lt;&gt;% revalue(., c(&quot;1&quot;=&quot;First&quot;, &quot;2&quot;=&quot;Second&quot;, &quot;3&quot;=&quot;Third&quot;)) data_train$Sex %&lt;&gt;% revalue(., c(&quot;female&quot;=&quot;Female&quot;, &quot;male&quot;=&quot;Male&quot;)) data_train$isFamily %&lt;&gt;% revalue(., c(&quot;0&quot;=&quot;No&quot;, &quot;1&quot;=&quot;Yes&quot;)) data_train$isCabin %&lt;&gt;% revalue(., c(&quot;0&quot;=&quot;No&quot;, &quot;1&quot;=&quot;Yes&quot;)) <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/h3>\n<p>  \u0412 \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 caret, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0431\u0440\u0430\u043b \u0432 \u0441\u0435\u0431\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0445 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0430\u044f \u0441\u0430\u0439\u0442\u043e\u043c Kaggle, \u043d\u0430\u043c \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438. \u041d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u0435\u0451 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043a \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 80\/20.<\/p>\n<pre><code>require(caret) set.seed(111) split &lt;- createDataPartition(data_train$Survived, p = 0.8, list = FALSE) train &lt;- slice(data_train, split) test &lt;- slice(data_train, -split) <\/code><\/pre>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438. \u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 residual deviance \u0438\u043b\u0438 \u0434\u0435\u0432\u0438\u0430\u043d\u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u043d\u0435\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438. Null deviance \u0438\u043b\u0438 \u043d\u0443\u043b\u044c-\u0434\u0435\u0432\u0438\u0430\u043d\u0441 \u2014 \u044d\u0442\u043e \u0434\u0435\u0432\u0438\u0430\u043d\u0441 \u00ab\u043f\u0443\u0441\u0442\u043e\u0439\u00bb \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0435\u0439 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043a\u0440\u043e\u043c\u0435 beta0. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0435\u0432\u0438\u0430\u043d\u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043d\u0443\u043b\u044c-\u0434\u0435\u0432\u0438\u0430\u043d\u0441 \u2014 \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435 \u043c\u043e\u0434\u0435\u043b\u044c. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c, \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 AUC \u0438\u043b\u0438 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u043e\u0439 ROC. \u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0435\u0441\u044f\u0442\u0438\u043a\u0440\u0430\u0442\u043d\u043e\u0439 \u043a\u0440\u043e\u0441\u0441-\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (10-fold cross-validation (CV)) \u0441 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043d\u0430 10 \u0447\u0430\u0441\u0442\u0435\u0439.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u2014 \u044d\u0442\u043e \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u044b.<\/p>\n<pre><code>cv_ctrl &lt;- trainControl(method = &quot;repeatedcv&quot;, repeats = 10,                         summaryFunction = twoClassSummary,                         classProbs = TRUE) set.seed(111) glm.tune.1 &lt;- train(Survived ~ Pclass + Sex + Age + Fare + Embarked + Family,                     data = train,                     method = &quot;glm&quot;,                     metric = &quot;ROC&quot;,                     trControl = cv_ctrl) glm.tune.1 ## Generalized Linear Model  ##  ## 714 samples ##   9 predictor ##   2 classes: 'Died', 'Survived'  ##  ## No pre-processing ## Resampling: Cross-Validated (10 fold, repeated 10 times)  ## Summary of sample sizes: 643, 643, 643, 642, 643, 642, ...  ## Resampling results ##  ##   ROC        Sens       Spec       ROC SD     Sens SD     Spec SD    ##   0.8607813  0.8509091  0.7037963  0.0379468  0.05211929  0.08238326 ##  ##  summary(glm.tune.1) ##  ## Call: ## NULL ##  ## Deviance Residuals:  ##     Min       1Q   Median       3Q      Max   ## -2.2611  -0.5641  -0.3831   0.5944   2.5244   ##  ## Coefficients: ##                Estimate Std. Error z value Pr(&gt;|z|)     ## (Intercept)   4.5920291  0.5510121   8.334  &lt; 2e-16 *** ## PclassSecond -1.0846865  0.3449892  -3.144  0.00167 **  ## PclassThird  -2.5390919  0.3469115  -7.319 2.50e-13 *** ## SexMale      -2.7351467  0.2277348 -12.010  &lt; 2e-16 *** ## Age          -0.0450577  0.0088554  -5.088 3.62e-07 *** ## Fare          0.0002526  0.0028934   0.087  0.93042     ## EmbarkedQ    -0.1806726  0.4285553  -0.422  0.67333     ## EmbarkedS    -0.4364064  0.2711112  -1.610  0.10746     ## Family       -0.1973088  0.0805129  -2.451  0.01426 *   ## --- ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ##  ## (Dispersion parameter for binomial family taken to be 1) ##  ##     Null deviance: 950.86  on 713  degrees of freedom ## Residual deviance: 613.96  on 705  degrees of freedom ## AIC: 631.96 ##  ## Number of Fisher Scoring iterations: 5 <\/code><\/pre>\n<p>  \u041c\u043e\u0434\u0435\u043b\u044c \u0443\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0438 \u0434\u0435\u0432\u0438\u0430\u043d\u0441\u0430 \u043d\u0430 950-613=337 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u00ab\u043f\u0443\u0441\u0442\u043e\u0439\u00bb \u043c\u043e\u0434\u0435\u043b\u044c\u044e. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u0443\u0442\u0451\u043c \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u0445 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0440\u0430\u043d\u0435\u0435.<\/p>\n<pre><code>set.seed(111) glm.tune.2 &lt;- train(Survived ~ Pclass + Sex + Age + Fare + Embarked + Title + Family + isFamily + isCabin,                     data = train,                     method = &quot;glm&quot;,                     metric = &quot;ROC&quot;,                     trControl = cv_ctrl) glm.tune.2  ## Generalized Linear Model  ##  ## 714 samples ##   9 predictor ##   2 classes: 'Died', 'Survived'  ##  ## No pre-processing ## Resampling: Cross-Validated (10 fold, repeated 10 times)  ## Summary of sample sizes: 643, 643, 643, 642, 643, 642, ...  ## Resampling results ##  ##   ROC        Sens       Spec       ROC SD      Sens SD     Spec SD    ##   0.8755115  0.8693182  0.7661772  0.03599347  0.04526764  0.07882857 ##  ##  summary(glm.tune.2) ##  ## Call: ## NULL ##  ## Deviance Residuals:  ##     Min       1Q   Median       3Q      Max   ## -2.4368  -0.5285  -0.3532   0.5087   2.5409   ##  ## Coefficients: ##                Estimate Std. Error z value Pr(&gt;|z|)     ## (Intercept)   1.467e+01  5.354e+02   0.027 0.978145     ## PclassSecond -4.626e-01  4.765e-01  -0.971 0.331618     ## PclassThird  -1.784e+00  4.790e-01  -3.725 0.000195 *** ## SexMale      -1.429e+01  5.354e+02  -0.027 0.978701     ## Age          -3.519e-02  1.093e-02  -3.221 0.001279 **  ## Fare          2.175e-04  2.828e-03   0.077 0.938704     ## EmbarkedQ    -1.405e-01  4.397e-01  -0.320 0.749313     ## EmbarkedS    -4.426e-01  2.887e-01  -1.533 0.125224     ## TitleMaster   3.278e+00  8.805e-01   3.722 0.000197 *** ## TitleMiss    -1.120e+01  5.354e+02  -0.021 0.983313     ## TitleMr       2.480e-01  6.356e-01   0.390 0.696350     ## TitleMrs     -1.029e+01  5.354e+02  -0.019 0.984660     ## Family       -4.841e-01  1.240e-01  -3.903 9.49e-05 *** ## isFamilyYes   2.248e-01  3.513e-01   0.640 0.522266     ## isCabinYes    1.060e+00  4.122e-01   2.572 0.010109 *   ## --- ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ##  ## (Dispersion parameter for binomial family taken to be 1) ##  ##     Null deviance: 950.86  on 713  degrees of freedom ## Residual deviance: 566.46  on 699  degrees of freedom ## AIC: 596.46 ##  ## Number of Fisher Scoring iterations: 12 &lt;source&gt;  \u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442! \u0415\u0449\u0451 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 613-566=47 \u043f\u0443\u043d\u043a\u0442\u043e\u0432. \u041d\u043e, \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0443\u0431\u0440\u0430\u0432 \u043f\u0440\u0438\u0437\u043d\u0430\u043a Sex, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043b \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u043c, \u0442.\u043a. \u043f\u0440\u0438\u0437\u043d\u0430\u043a Title \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0435\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438 \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435. \u0422\u0430\u043a\u0436\u0435 \u0443\u0431\u0435\u0440\u0451\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a Fare, \u0442.\u043a. \u043e\u043d \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u043c \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c. \u041f\u043b\u044e\u0441 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a Embarked, \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0432 \u0435\u0433\u043e \u043a \u0434\u0432\u0443\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043d\u0435\u0432\u043e\u043c\u0443.  &lt;source code=&quot;R&quot;&gt; set.seed(111) glm.tune.3 &lt;- train(Survived ~ Pclass + Age + I(Embarked==&quot;S&quot;) + Title + Family + isFamily + isCabin,                     data = train,                     method = &quot;glm&quot;,                     metric = &quot;ROC&quot;,                     trControl = cv_ctrl) glm.tune.3 ## Generalized Linear Model  ##  ## 714 samples ##   9 predictor ##   2 classes: 'Died', 'Survived'  ##  ## No pre-processing ## Resampling: Cross-Validated (10 fold, repeated 10 times)  ## Summary of sample sizes: 643, 643, 643, 642, 643, 642, ...  ## Resampling results ##  ##   ROC        Sens       Spec       ROC SD      Sens SD     Spec SD    ##   0.8780578  0.8702273  0.7705423  0.03553343  0.04502726  0.07757737 ##  ##  summary(glm.tune.3) ##  ## Call: ## NULL ##  ## Deviance Residuals:  ##     Min       1Q   Median       3Q      Max   ## -2.4508  -0.5286  -0.3522   0.5120   2.5449   ##  ## Coefficients: ##                          Estimate Std. Error z value Pr(&gt;|z|)     ## (Intercept)               0.55401    0.80063   0.692  0.48896     ## PclassSecond             -0.49217    0.44618  -1.103  0.26999     ## PclassThird              -1.81552    0.42912  -4.231 2.33e-05 *** ## Age                      -0.03554    0.01083  -3.281  0.00103 **  ## `I(Embarked == &quot;S&quot;)TRUE` -0.37801    0.24222  -1.561  0.11862     ## TitleMaster               3.06205    0.84703   3.615  0.00030 *** ## TitleMiss                 2.88073    0.64386   4.474 7.67e-06 *** ## TitleMr                   0.04083    0.58762   0.069  0.94460     ## TitleMrs                  3.80377    0.67946   5.598 2.17e-08 *** ## Family                   -0.48442    0.12274  -3.947 7.93e-05 *** ## isFamilyYes               0.22652    0.34724   0.652  0.51418     ## isCabinYes                1.08796    0.40990   2.654  0.00795 **  ## --- ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ##  ## (Dispersion parameter for binomial family taken to be 1) ##  ##     Null deviance: 950.86  on 713  degrees of freedom ## Residual deviance: 568.64  on 702  degrees of freedom ## AIC: 592.64 ##  ## Number of Fisher Scoring iterations: 5 <\/code><\/pre>\n<p>  \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u0434\u0430\u0436\u0435, \u0441\u043a\u043e\u0440\u0435\u0435, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0425\u043e\u0442\u044f, \u0435\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c ROC, \u0442\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u043d \u0440\u0430\u0441\u0442\u0451\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043a\u0430\u043a \u043c\u044b \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0441 \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c p-value \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e, \u0447\u0442\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0435 \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e. \u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u044b. \u0423\u0434\u0430\u043b\u0438\u043c isFamily, \u0442.\u043a. Family \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u044e \u0435\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u0418 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0442\u0438\u0439, \u043a\u0430\u043a \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043c \u0441 Title.<\/p>\n<pre><code>set.seed(111) glm.tune.4 &lt;- train(Survived ~ I(Pclass==&quot;Third&quot;) +                                          Age +                                          I(Embarked==&quot;S&quot;) +                                           I(Title==&quot;Master&quot;) +                                           I(Title==&quot;Miss&quot;) +                                           I(Title==&quot;Mrs&quot;)  +                                           Family +                                           isCabin,                      data = train,                     method = &quot;glm&quot;,                     metric = &quot;ROC&quot;,                     trControl = cv_ctrl) glm.tune.4 ## Generalized Linear Model  ##  ## 714 samples ##   9 predictor ##   2 classes: 'Died', 'Survived'  ##  ## No pre-processing ## Resampling: Cross-Validated (10 fold, repeated 10 times)  ## Summary of sample sizes: 643, 643, 643, 642, 643, 642, ...  ## Resampling results ##  ##   ROC        Sens       Spec       ROC SD      Sens SD     Spec SD   ##   0.8797817  0.8738636  0.7719841  0.03535413  0.04374363  0.0775346 ##  ##  summary(glm.tune.4) ##  ## Call: ## NULL ##  ## Deviance Residuals:  ##     Min       1Q   Median       3Q      Max   ## -2.4369  -0.5471  -0.3533   0.5098   2.5384   ##  ## Coefficients: ##                            Estimate Std. Error z value Pr(&gt;|z|)     ## (Intercept)                 0.29594    0.46085   0.642 0.520765     ## `I(Pclass == &quot;Third&quot;)TRUE` -1.46194    0.26518  -5.513 3.53e-08 *** ## Age                        -0.03469    0.01049  -3.306 0.000946 *** ## `I(Embarked == &quot;S&quot;)TRUE`   -0.45389    0.23350  -1.944 0.051910 .   ## `I(Title == &quot;Master&quot;)TRUE`  3.01939    0.59974   5.035 4.79e-07 *** ## `I(Title == &quot;Miss&quot;)TRUE`    2.83185    0.29232   9.687  &lt; 2e-16 *** ## `I(Title == &quot;Mrs&quot;)TRUE`     3.80006    0.36823  10.320  &lt; 2e-16 *** ## Family                     -0.42962    0.09269  -4.635 3.57e-06 *** ## isCabinYes                  1.43072    0.30402   4.706 2.53e-06 *** ## --- ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ##  ## (Dispersion parameter for binomial family taken to be 1) ##  ##     Null deviance: 950.86  on 713  degrees of freedom ## Residual deviance: 570.25  on 705  degrees of freedom ## AIC: 588.25 ##  ## Number of Fisher Scoring iterations: 5 <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043c\u0443\u0436\u0447\u0438\u043d \u0438\u0437 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0442.\u043a., \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043f\u043e\u043c\u043d\u044e \u0438\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0434\u043e\u043b\u044e \u043f\u043e\u0433\u0438\u0431\u0448\u0438\u0445.<\/p>\n<pre><code>set.seed(111) glm.tune.5 &lt;- train(Survived ~ Pclass +                             Age +                              I(Embarked==&quot;S&quot;) +                              I(Title==&quot;Master&quot;) +                              I(Title==&quot;Miss&quot;) +                              I(Title==&quot;Mrs&quot;)  +                              Family +                             isCabin +                             I(Title==&quot;Mr&quot;& Pclass==&quot;Third&quot;),                      data = train,                     method = &quot;glm&quot;,                     metric = &quot;ROC&quot;,                     trControl = cv_ctrl) glm.tune.5 ## Generalized Linear Model  ##  ## 714 samples ##   9 predictor ##   2 classes: 'Died', 'Survived'  ##  ## No pre-processing ## Resampling: Cross-Validated (10 fold, repeated 10 times)  ## Summary of sample sizes: 643, 643, 643, 642, 643, 642, ...  ## Resampling results ##  ##   ROC        Sens       Spec       ROC SD      Sens SD     Spec SD    ##   0.8814059  0.8981818  0.7201455  0.03712511  0.04155444  0.08581645 ##  ##  summary(glm.tune.5) ##  ## Call: ## NULL ##  ## Deviance Residuals:  ##     Min       1Q   Median       3Q      Max   ## -2.9364  -0.5340  -0.4037   0.3271   2.5123   ##  ## Coefficients: ##                                            Estimate Std. Error z value ## (Intercept)                                 0.52451    0.60337   0.869 ## PclassSecond                               -0.95649    0.52602  -1.818 ## PclassThird                                -3.54288    0.66944  -5.292 ## Age                                        -0.03581    0.01126  -3.179 ## `I(Embarked == &quot;S&quot;)TRUE`                   -0.46028    0.23707  -1.942 ## `I(Title == &quot;Master&quot;)TRUE`                  4.72492    0.80338   5.881 ## `I(Title == &quot;Miss&quot;)TRUE`                    4.43875    0.56446   7.864 ## `I(Title == &quot;Mrs&quot;)TRUE`                     5.24324    0.58650   8.940 ## Family                                     -0.41607    0.09926  -4.192 ## isCabinYes                                  1.12486    0.42860   2.625 ## `I(Title == &quot;Mr&quot; & Pclass == &quot;Third&quot;)TRUE`  2.30163    0.59547   3.865 ##                                            Pr(&gt;|z|)     ## (Intercept)                                0.384683     ## PclassSecond                               0.069012 .   ## PclassThird                                1.21e-07 *** ## Age                                        0.001477 **  ## `I(Embarked == &quot;S&quot;)TRUE`                   0.052195 .   ## `I(Title == &quot;Master&quot;)TRUE`                 4.07e-09 *** ## `I(Title == &quot;Miss&quot;)TRUE`                   3.73e-15 *** ## `I(Title == &quot;Mrs&quot;)TRUE`                     &lt; 2e-16 *** ## Family                                     2.77e-05 *** ## isCabinYes                                 0.008677 **  ## `I(Title == &quot;Mr&quot; & Pclass == &quot;Third&quot;)TRUE` 0.000111 *** ## --- ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ##  ## (Dispersion parameter for binomial family taken to be 1) ##  ##     Null deviance: 950.86  on 713  degrees of freedom ## Residual deviance: 550.82  on 703  degrees of freedom ## AIC: 572.82 ##  ## Number of Fisher Scoring iterations: 6 <\/code><\/pre>\n<p>  \u0418 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043a\u0430\u0447\u043e\u043a \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u0441 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0435\u0439 \u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044f\u043c.<\/p>\n<p>  \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043a \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u043c\u0443 Random Forest. \u041f\u0440\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0445, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432, \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u2014 mtry.<\/p>\n<pre><code>rf.grid &lt;- data.frame(.mtry = c(2, 3, 4)) set.seed(111) rf.tune &lt;- train(Survived ~ Pclass + Sex + Age + Fare + Embarked + Title + Family + isFamily + isCabin,                   data = train,                  method = &quot;rf&quot;,                  metric = &quot;ROC&quot;,                  tuneGrid = rf.grid,                  trControl = cv_ctrl) rf.tune  ## Random Forest  ##  ## 714 samples ##   9 predictor ##   2 classes: 'Died', 'Survived'  ##  ## No pre-processing ## Resampling: Cross-Validated (10 fold, repeated 10 times)  ## Summary of sample sizes: 643, 643, 643, 642, 643, 642, ...  ## Resampling results across tuning parameters: ##  ##   mtry  ROC        Sens       Spec       ROC SD      Sens SD    ##   2     0.8710121  0.8861364  0.7230423  0.03912907  0.04551133 ##   3     0.8723865  0.8929545  0.7021825  0.04049427  0.04467829 ##   4     0.8719942  0.8893182  0.7079630  0.04063512  0.04632489 ##   Spec SD    ##   0.08343852 ##   0.08960364 ##   0.08350602 ##  ## ROC was used to select the optimal model using  the largest value. ## The final value used for the model was mtry = 3. <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0438\u043c\u0435\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u0441 mtry \u0440\u0430\u0432\u043d\u044b\u043c 3.<\/p>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u2014 \u044d\u0442\u043e support vector machine (SVM). SVM \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u043d\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 preProcess, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f. \u0423 SVM \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Cost. \u041c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0430 \u0435\u0433\u043e 9 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0441 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 AUC.<\/p>\n<pre><code>set.seed(111) svm.tune &lt;- train(Survived ~ Pclass + Sex + Age + Fare + Embarked + Title + Family + isFamily + isCabin,                    data = train,                   method = &quot;svmRadial&quot;,                   tuneLength = 9,                   preProcess = c(&quot;center&quot;, &quot;scale&quot;),                   metric = &quot;ROC&quot;,                   trControl = cv_ctrl) svm.tune  ## Support Vector Machines with Radial Basis Function Kernel  ##  ## 714 samples ##   9 predictor ##   2 classes: 'Died', 'Survived'  ##  ## Pre-processing: centered, scaled  ## Resampling: Cross-Validated (10 fold, repeated 10 times)  ## Summary of sample sizes: 643, 643, 643, 642, 643, 642, ...  ## Resampling results across tuning parameters: ##  ##   C      ROC        Sens       Spec       ROC SD      Sens SD    ##    0.25  0.8578892  0.8893182  0.7026455  0.04086454  0.04863259 ##    0.50  0.8599136  0.8956818  0.6862831  0.04005935  0.04952978 ##    1.00  0.8544741  0.8945455  0.6877646  0.04193910  0.04470456 ##    2.00  0.8469004  0.8943182  0.6814815  0.04342792  0.04595398 ##    4.00  0.8379595  0.8925000  0.6781746  0.04709993  0.04450981 ##    8.00  0.8299511  0.8877273  0.6769974  0.04692596  0.04403429 ##   16.00  0.8273934  0.8818182  0.6758862  0.04636108  0.04499307 ##   32.00  0.8206023  0.8756818  0.6769709  0.04665624  0.04339395 ##   64.00  0.8121454  0.8704545  0.6710714  0.04718058  0.04664421 ##   Spec SD    ##   0.08976378 ##   0.08597689 ##   0.08439794 ##   0.08532505 ##   0.08531935 ##   0.08434585 ##   0.07958467 ##   0.07687452 ##   0.07680478 ##  ## Tuning parameter 'sigma' was held constant at a value of 0.1001103 ## ROC was used to select the optimal model using  the largest value. ## The final values used for the model were sigma = 0.1001103 and C = 0.5. plot(svm.tune) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d2d\/78d\/965\/d2d78d9659864586bb7009da6f9cd6eb.png\"\/><\/p>\n<h3>\u041e\u0446\u0435\u043d\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/h3>\n<p>  \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u043e\u0446\u0435\u043d\u043a\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u044f confusionMatrix \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 Caret \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<pre><code>glm.pred &lt;- predict(glm.tune.4, test) confusionMatrix(glm.pred, test$Survived) ## Confusion Matrix and Statistics ##  ##           Reference ## Prediction Died Survived ##   Died       92       15 ##   Survived   17       53 ##                                            ##                Accuracy : 0.8192           ##                  95% CI : (0.7545, 0.8729) ##     No Information Rate : 0.6158           ##     P-Value [Acc &gt; NIR] : 3.784e-09        ##                                            ##                   Kappa : 0.62             ##  Mcnemar's Test P-Value : 0.8597           ##                                            ##             Sensitivity : 0.8440           ##             Specificity : 0.7794           ##          Pos Pred Value : 0.8598           ##          Neg Pred Value : 0.7571           ##              Prevalence : 0.6158           ##          Detection Rate : 0.5198           ##    Detection Prevalence : 0.6045           ##       Balanced Accuracy : 0.8117           ##                                            ##        'Positive' Class : Died             ##  rf.pred &lt;- predict(rf.tune, test) confusionMatrix(rf.pred, test$Survived) ## Confusion Matrix and Statistics ##  ##           Reference ## Prediction Died Survived ##   Died      103       18 ##   Survived    6       50 ##                                           ##                Accuracy : 0.8644          ##                  95% CI : (0.805, 0.9112) ##     No Information Rate : 0.6158          ##     P-Value [Acc &gt; NIR] : 2.439e-13       ##                                           ##                   Kappa : 0.7036          ##  Mcnemar's Test P-Value : 0.02474         ##                                           ##             Sensitivity : 0.9450          ##             Specificity : 0.7353          ##          Pos Pred Value : 0.8512          ##          Neg Pred Value : 0.8929          ##              Prevalence : 0.6158          ##          Detection Rate : 0.5819          ##    Detection Prevalence : 0.6836          ##       Balanced Accuracy : 0.8401          ##                                           ##        'Positive' Class : Died            ##  svm.pred &lt;- predict(svm.tune, test) confusionMatrix(svm.pred, test$Survived) ## Confusion Matrix and Statistics ##  ##           Reference ## Prediction Died Survived ##   Died      101       17 ##   Survived    8       51 ##                                            ##                Accuracy : 0.8588           ##                  95% CI : (0.7986, 0.9065) ##     No Information Rate : 0.6158           ##     P-Value [Acc &gt; NIR] : 9.459e-13        ##                                            ##                   Kappa : 0.6939           ##  Mcnemar's Test P-Value : 0.1096           ##                                            ##             Sensitivity : 0.9266           ##             Specificity : 0.7500           ##          Pos Pred Value : 0.8559           ##          Neg Pred Value : 0.8644           ##              Prevalence : 0.6158           ##          Detection Rate : 0.5706           ##    Detection Prevalence : 0.6667           ##       Balanced Accuracy : 0.8383           ##                                            ##        'Positive' Class : Died             ##  <\/code><\/pre>\n<p>  Random Forest \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u043f\u043e\u0433\u0438\u0431\u0448\u0438\u0445 \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c Sensitivity. \u0410 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0432 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0432\u044b\u0436\u0438\u0432\u0448\u0438\u0445 \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c Specificity.<\/p>\n<p>  \u0418\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043a\u0440\u0438\u0432\u044b\u0435 ROC \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<pre><code>require(pROC) glm.probs &lt;- predict(glm.tune.5, test, type = &quot;prob&quot;) glm.ROC &lt;- roc(response = test$Survived,                 predictor = glm.probs$Survived,                 levels = levels(test$Survived)) glm.ROC$auc ## Area under the curve: 0.8546 plot(glm.ROC, type=&quot;S&quot;) ##  ## Call: ## roc.default(response = test$Survived, predictor = glm.probs$Survived,     levels = levels(test$Survived)) ##  ## Data: glm.probs$Survived in 109 controls (test$Survived Died) &lt; 68 cases (test$Survived Survived). ## Area under the curve: 0.8546  rf.probs &lt;- predict(rf.tune, test, type = &quot;prob&quot;) rf.ROC &lt;- roc(response = test$Survived,            predictor = rf.probs$Survived,            levels = levels(test$Survived)) rf.ROC$auc ## Area under the curve: 0.8854 plot(rf.ROC, add=TRUE, col=&quot;red&quot;) ##  ## Call: ## roc.default(response = test$Survived, predictor = rf.probs$Survived,     levels = levels(test$Survived)) ##  ## Data: rf.probs$Survived in 109 controls (test$Survived Died) &lt; 68 cases (test$Survived Survived). ## Area under the curve: 0.8854  svm.probs &lt;- predict(svm.tune, test, type = &quot;prob&quot;) svm.ROC &lt;- roc(response = test$Survived,             predictor = svm.probs$Survived,             levels = levels(test$Survived)) svm.ROC$auc ## Area under the curve: 0.8714 plot(svm.ROC, add=TRUE, col=&quot;blue&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8c8\/5a5\/0f4\/8c85a50f4b2a40949ce530cda8989778.png\"\/><\/p>\n<pre><code>##  ## Call: ## roc.default(response = test$Survived, predictor = svm.probs$Survived,     levels = levels(test$Survived)) ##  ## Data: svm.probs$Survived in 109 controls (test$Survived Died) &lt; 68 cases (test$Survived Survived). ## Area under the curve: 0.8714 <\/code><\/pre>\n<p>  \u041f\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 AUC \u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 Random Forest, \u043d\u043e \u044d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043f\u0443\u0442\u0451\u043c resampling, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c, \u0447\u0442\u043e \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0435.<\/p>\n<pre><code>resamps &lt;- resamples(list(Logit = glm.tune.5, RF = rf.tune, SVM = svm.tune)) summary(resamps) ##  ## Call: ## summary.resamples(object = resamps) ##  ## Models: Logit, RF, SVM  ## Number of resamples: 100  ##  ## ROC  ##         Min. 1st Qu. Median   Mean 3rd Qu.   Max. NA's ## Logit 0.7816  0.8608 0.8845 0.8814  0.9064 0.9558    0 ## RF    0.7715  0.8454 0.8732 0.8724  0.9048 0.9474    0 ## SVM   0.7593  0.8364 0.8620 0.8599  0.8845 0.9381    0 ##  ## Sens  ##         Min. 1st Qu. Median   Mean 3rd Qu.   Max. NA's ## Logit 0.7955  0.8636 0.8864 0.8982  0.9318 1.0000    0 ## RF    0.7955  0.8636 0.9091 0.8930  0.9318 0.9773    0 ## SVM   0.7727  0.8636 0.9091 0.8957  0.9318 1.0000    0 ##  ## Spec  ##         Min. 1st Qu. Median   Mean 3rd Qu.   Max. NA's ## Logit 0.4286  0.6667 0.7275 0.7201  0.7857 0.8889    0 ## RF    0.4815  0.6296 0.7037 0.7022  0.7778 0.8889    0 ## SVM   0.5000  0.6296 0.6786 0.6863  0.7500 0.8889    0 dotplot(resamps, metric = &quot;ROC&quot;) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/876\/258\/8cf\/8762588cffe24d2bbf4e401238eb9f6d.png\"\/><\/p>\n<p>  \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u042d\u0442\u043e \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u043c\u043e\u0434\u0435\u043b\u044f\u043c \u043f\u043e \u0442\u0440\u0451\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430\u043c:ROC,Sensitivity \u0438 Specificity.<\/p>\n<pre><code>bwplot(resamps, layout = c(3, 1)) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7b5\/b44\/36d\/7b5b4436d79f4ac0a0159f9ece655e4a.png\"\/><\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0432\u0441\u0435 \u0442\u0440\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0433\u0438\u0431\u0448\u0438\u0445 \u0447\u0435\u043c \u0432\u044b\u0436\u0438\u0432\u0448\u0438\u0445 (\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 Sensitivity \u0438 Specificity). \u041d\u043e, \u0432 \u0446\u0435\u043b\u043e\u043c, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u041d\u043e, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043e\u0431\u043e\u0431\u0449\u0430\u044e\u0449\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 \u043d\u043e\u0432\u043e\u0439 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0434\u043b\u044f Kaggle<\/h3>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043e\u0446\u0435\u043d\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442.<\/p>\n<pre><code>data_test$Cabin &lt;- recode(data_test$Cabin, &quot;'' = NA&quot;) data_test$Embarked &lt;- recode(data_test$Embarked, &quot;'' = NA&quot;) data_test %&lt;&gt;% transform(.,Pclass = as.factor(Pclass),                            Sex = as.factor(Sex),                           Embarked = as.factor(Embarked),                           SibSp = as.numeric(SibSp)) data_test$Embarked[is.na(data_test$Embarked)] &lt;- &quot;S&quot; data_test$Title &lt;-  data_test$Name %&gt;% str_extract(., &quot;\\\\w+\\\\.&quot;) %&gt;% str_sub(.,1, -2)   data_test %&gt;% group_by(Title) %&gt;%          summarise(count = n(), Missing = sum(is.na(Age)), Mean = round(mean(Age, na.rm = T), 2)) impute.mean.test &lt;- function (impute_col, filter_var, var_levels) {         for (lev in var_levels) {                  impute_col[(filter_var == lev) & is.na(impute_col)] &lt;-                         mean_title$Mean[mean_title$Title == lev]                         #mean(impute_col[filter_var == lev], na.rm = T)         }         return (impute_col) } data_test$Age &lt;- impute.mean.test(data_test$Age, data_test$Title, c(&quot;Ms&quot;, &quot;Master&quot;, &quot;Mrs&quot;, &quot;Miss&quot;, &quot;Mr&quot;))  data_test$Fare[data_test$Fare == 0] &lt;- NA data_test$Fare &lt;- impute.mean(data_test$Fare, data_test$Pclass, as.numeric(levels(data_test$Pclass))) data_test$Title &lt;- change.titles(data_test,                                    c(&quot;Capt&quot;, &quot;Col&quot;, &quot;Don&quot;, &quot;Dr&quot;,                                     &quot;Jonkheer&quot;, &quot;Lady&quot;, &quot;Major&quot;,                                      &quot;Rev&quot;, &quot;Sir&quot;, &quot;Countess&quot;, &quot;Dona&quot;),                                   &quot;Aristocratic&quot;) data_test$Title &lt;- change.titles(data_test, c(&quot;Ms&quot;),                                    &quot;Mrs&quot;) data_test$Title &lt;- change.titles(data_test, c(&quot;Mlle&quot;, &quot;Mme&quot;), &quot;Miss&quot;) data_test$Title &lt;- as.factor(data_test$Title)  data_test$Family &lt;- data_test$SibSp + data_test$Parch data_test$isFamily &lt;- as.factor(as.numeric(data_test$Family &gt; 0)) data_test$isCabin &lt;- factor(ifelse(is.na(data_test$Cabin),0,1)) data_test %&lt;&gt;% select(PassengerId, Pclass, Sex, Age, Fare, Embarked, Title, Family, isFamily, isCabin) data_test$Pclass %&lt;&gt;% revalue(., c(&quot;1&quot;=&quot;First&quot;, &quot;2&quot;=&quot;Second&quot;, &quot;3&quot;=&quot;Third&quot;)) data_test$Sex %&lt;&gt;% revalue(., c(&quot;female&quot;=&quot;Female&quot;, &quot;male&quot;=&quot;Male&quot;)) data_test$isFamily %&lt;&gt;% revalue(., c(&quot;0&quot;=&quot;No&quot;, &quot;1&quot;=&quot;Yes&quot;)) data_test$isCabin %&lt;&gt;% revalue(., c(&quot;0&quot;=&quot;No&quot;, &quot;1&quot;=&quot;Yes&quot;))  Survived &lt;- predict(svm.tune, newdata = data_test) Survived &lt;- revalue(Survived, c(&quot;Survived&quot; = 1, &quot;Died&quot; = 0)) predictions &lt;- as.data.frame(Survived) predictions$PassengerId &lt;- data_test$PassengerId write.csv(predictions[,c(&quot;PassengerId&quot;, &quot;Survived&quot;)],            file=&quot;Titanic_predictions.csv&quot;, row.names=FALSE, quote=FALSE) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 Kaggle \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043c\u043e\u0434\u0435\u043b\u044c SVM. \u0412\u0445\u043e\u0434\u044f \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043b\u0443\u0447\u0448\u0438\u0435 10% \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u043d\u043e, \u0442.\u043a. \u0434\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0447\u0430\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u043f\u0440\u0438\u0447\u0451\u043c \u043a\u0430\u043a \u0432 \u043b\u0443\u0447\u0448\u0443\u044e, \u0442\u0430\u043a \u0438 \u0432 \u0445\u0443\u0434\u0448\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 Public data.<\/p>\n<table>\n<tr>\n<td><b>Model<\/b><\/td>\n<td><b>Public Score<\/b><\/td>\n<\/tr>\n<tr>\n<td>SVM<\/td>\n<td>0.81340<\/td>\n<\/tr>\n<tr>\n<td>Random Forest<\/td>\n<td>0.78947<\/td>\n<\/tr>\n<tr>\n<td>Logit<\/td>\n<td>0.77512<\/td>\n<\/tr>\n<\/table>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0441\u043c\u043e\u0433 \u0434\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430!) \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0434\u043e 30 \u043d\u043e\u044f\u0431\u0440\u044f <a href=\"http:\/\/dscourse.mlclass.ru\">\u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043a\u0443\u0440\u0441\u043e\u0432<\/a> \u043f\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"http:\/\/mlclass.ru\">MLClass<\/a>               <\/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\/270973\/\"> http:\/\/habrahabr.ru\/post\/270973\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440!<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c3e\/cde\/5b7\/c3ecde5b78cd41e89b09f79af46311bb.png\"\/><br \/>  <b>#{Data Science \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432}<\/b><\/p>\n<p>  \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0413\u043b\u0435\u0431 \u041c\u043e\u0440\u043e\u0437\u043e\u0432, \u043c\u044b \u0441 \u0412\u0430\u043c\u0438 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u043f\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0441\u0442\u0430\u0442\u044c\u044f\u043c. \u041f\u043e \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u044c\u0431\u0430\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u043f\u044b\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0432 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 <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 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e <a href=\"http:\/\/dscourse.mlclass.ru\/\">\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u043a\u0443\u0440\u0441\u043e\u0432<\/a> \u2014 \u044d\u0442\u043e, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u044b\u0439 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u044b\u0439 \u043a\u0443\u0440\u0441 \u043f\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0431\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c).<\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u043e\u044e \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432\u044b\u0436\u0438\u0432\u0448\u0438\u0445 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u00ab\u0422\u0438\u0442\u0430\u043d\u0438\u043a\u0430\u00bb. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0432 Data Science \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, <b>\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043b\u0438\u043d\u043d\u043e\u0439<\/b>. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0443\u0434\u0435\u043b\u0435\u043d\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 (<b>exploratory research<\/b>) \u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u0432\u044b\u0431\u043e\u0440\u0443 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u043e\u0440\u043e\u0432 (<b>feature engineering<\/b>). \u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f <b>Titanic: Machine Learning from Disaster<\/b> \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 Kaggle. \u0412 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u00abR\u00bb.  <\/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-268290","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268290","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=268290"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268290\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}