{"id":184574,"date":"2013-06-25T17:41:02","date_gmt":"2013-06-25T13:41:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=184574"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=184574","title":{"rendered":"<span class=\"post_title\">\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u043c\u0441 \u0441\u043f\u0430\u043c\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 (\u043a\u043e\u0434 \u043d\u0430 R)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/adf\/b34\/133\/adfb34133e0ac6a80ead91ed2d2c834e.jpg\" align=\"right\"\/> \u041f\u0440\u0438\u0432\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u043f\u0430\u043c\u0430 \u0441 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Naive_Bayes_classifier\">\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430<\/a> \u0441 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Additive_smoothing\">\u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435\u043c \u043f\u043e \u041b\u0430\u043f\u043b\u0430\u0441\u0443<\/a>, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 <a href=\"http:\/\/www.r-project.org\/\">\u043d\u0430 R<\/a>, \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 <a href=\"http:\/\/www.dt.fee.unicamp.br\/~tiago\/smsspamcollection\/\">\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043c\u0441 \u0441\u043f\u0430\u043c\u0430<\/a>. \u0412\u043e\u043e\u0431\u0449\u0435, \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u044f \u043d\u0430\u0448\u0435\u043b \u0434\u0432\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435, \u043d\u043e \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u0434 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043f\u0440\u043e \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438, \u0431\u0435\u0437 \u043e\u0441\u043e\u0431\u044b\u0445 \u0437\u0430\u0442\u0440\u0430\u0442 \u0443\u0441\u0438\u043b\u0438\u0439, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u0441\u043a\u0430\u0436\u0435\u043c, \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430. \u041d\u043e \u0432\u043e\u043e\u0431\u0449\u0435, \u0437\u0430\u043f\u0438\u043b\u0438\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0435\u0441\u0430 \u043c\u0435\u043d\u044f \u043f\u043e\u0431\u0443\u0434\u0438\u043b\u043e \u0442\u043e, \u0447\u0442\u043e \u044f \u043f\u0438\u0448\u0443 \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0443 \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 R, \u0432\u043e\u0442 \u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043d\u0444\u043e\u0439.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/h4>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <i>D = {dq, d2, &#8230;, dm}<\/i>, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 <i>F = {f1, f2, &#8230;, fq}<\/i>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0434\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u043e\u0439 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043c\u0435\u0442\u043e\u043a <i>C = {c1, c2, &#8230;, cr}<\/i>. \u041d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430\/\u043c\u0435\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 d, \u043e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043d\u0430 \u043d\u0430\u0431\u043e\u0440 \u0435\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 <i>Fd = {fd1, fd2, &#8230;, fdn}<\/i>. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>C<\/i>, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u044b\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c (<a href=\"http:\/\/en.wikipedia.org\/wiki\/Maximum_a_posteriori_estimation\">maximum a posteriori probability<\/a>, MAP).<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/1c3\/833\/d73\/1c3833d737bea12e0f5cc92a64f7494e.png\"\/><\/p>\n<ul>\n<li> 2.1 \u2014 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u043d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c <\/li>\n<li> 2.2 \u2014 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043f\u043e <a href=\"http:\/\/en.wikipedia.org\/wiki\/Bayes%27_theorem\">\u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0411\u0430\u0439\u0435\u0441\u0430<\/a><\/li>\n<li> 2.3 \u2014 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043c\u044b \u0438\u0449\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u0438\u044f, \u0438 \u0442\u043e, \u0447\u0442\u043e \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043c\u0435\u043b\u043e \u0432\u044b\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 <i>P(d)<\/i><\/li>\n<li> 2.4 \u2014 \u0442\u0430\u043a \u043a\u0430\u043a \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e <i>x &gt; 0<\/i>, \u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043b\u044e\u0431\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>f(x)<\/i> \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0443 <i>ln(f(x))<\/i>; \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435 \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u0431\u043b\u0438\u0437\u043a\u0438\u043c\u0438 \u043a \u043d\u0443\u043b\u044e <\/li>\n<\/ul>\n<p>  \u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u044f, \u043e\u0442 \u0442\u043e\u0433\u043e \u043e\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u0438 \u043d\u0430\u0438\u0432\u043d\u0430\u044f:  <\/p>\n<ol>\n<li> \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f; <\/li>\n<li> \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043f\u0440\u0438 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435: <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/a4e\/ea1\/0c3\/a4eea10c344e99a0a46660717c43a8b9.png\"\/>.<\/li>\n<\/ol>\n<p>  \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0432\u044b\u0432\u043e\u0434 \u0444\u043e\u0440\u043c\u0443\u043b.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/8f6\/071\/8ef\/8f60718ef65e625404a1ce76a79dfe5c.png\"\/><\/p>\n<ul>\n<li> 2.6-2.7 \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0439<\/li>\n<li> 2.8 \u2014 \u0437\u0434\u0435\u0441\u044c, \u043a\u0430\u043a \u0440\u0430\u0437, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438<\/li>\n<\/ul>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c <a href=\"http:\/\/en.wikipedia.org\/wiki\/Graphical_model\">\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c<\/a> \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/05f\/a2e\/78b\/05fa2e78bde5f3f44bbffb85cba087b7.png\"\/><\/p>\n<h4>\u0421\u043f\u0430\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043f\u0430\u043c\u0430. \u0418\u0442\u0430\u043a, \u043c\u043d\u0436\u0435\u0441\u0442\u0432\u043e <i>D<\/i> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043c\u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u041a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043e \u043c\u0435\u0442\u043a\u043e\u0439 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 <i>C = {ham, spam}<\/i>. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"http:\/\/en.wikipedia.org\/wiki\/Bag-of-words_model\">bag of words<\/a>, \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 ham \u0441\u043c\u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0435<\/p>\n<p>  <code>hi how are you<\/code><br \/>  <code>how old are you<\/code><\/p>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443<\/p>\n<table>\n<tr>\n<th>\u0421\u043b\u043e\u0432\u043e<\/th>\n<th>\u0427\u0430\u0441\u0442\u043e\u0442\u0430<\/th>\n<\/tr>\n<tr>\n<td>hi<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>how<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>are<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>you<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>old<\/td>\n<td>1<\/td>\n<\/tr>\n<\/table>\n<p>  \u0412\u0441\u0435\u0433\u043e 8 \u0441\u043b\u043e\u0432 \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435 \u043d\u0435-\u0441\u043f\u0430\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0442\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u043e\u0432\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Maximum_likelihood#Discrete_distribution.2C_finite_parameter_space\">maximum likelihood estimation<\/a>. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u043e\u0432\u0430 \u00abhow\u00bb \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0430\u043c\u043e\u043c, \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0430\u044f:<\/p>\n<p>  <i>P(fi = \u00abhow\u00bb | C = ham) = 2\/8 = 1\/4<\/i><\/p>\n<p>  \u0418\u043b\u0438 \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/2f4\/da1\/b6f\/2f4da1b6f675045e9634a659808230a0.gif\"\/>, \u0433\u0434\u0435 q \u2014 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435.<\/p>\n<h4>\u0420\u0430\u0437\u043c\u044b\u0442\u0438\u0435 \u043f\u043e \u041b\u0430\u043f\u043b\u0430\u0441\u0443<\/h4>\n<p>  \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043d\u0430\u0448\u0443 \u0431\u0430\u0437\u0443 \u0438\u0437 \u0434\u0432\u0443\u0445 ham \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043a \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: &quot;<i>hi bro<\/i>&quot;, \u0438, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0435-\u0441\u043f\u0430\u043c\u0430 <i>P(ham) = 1\/2<\/i>. \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043b\u043e\u0432: <\/p>\n<ol>\n<li><i>P(\u00abhi\u00bb | ham) = 1\/8 <\/i><\/li>\n<li><i>P(\u00abbro\u00bb | ham) = 0\/8 = 0<\/i><\/li>\n<\/ol>\n<p>  \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 2.8 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0435\u0435\u0441\u044f \u043f\u043e\u0434 <b>argmax<\/b> \u043f\u0440\u0438 <i>c = ham<\/i>:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/49f\/ee3\/e2f\/49fee3e2fcccfee4647d389c99ed2838.gif\"\/><\/p>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043b\u0438\u0431\u043e \u043e\u0448\u0438\u0431\u043a\u0443 \u043b\u0438\u0431\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u044c, \u0442.\u043a. \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u0432 \u043d\u0443\u043b\u0435 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u043e \u043c\u044b \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e 0, \u0442.\u0435. \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0430 \u0431\u044b \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e, \u0447\u0442\u043e \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u044b \u043d\u0430\u043c \u0434\u0430\u0435\u0442.<\/p>\n<p>  \u0418\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Additive_smoothing\">\u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435 \u043f\u043e \u041b\u0430\u043f\u043b\u0430\u0441\u0443 \u0438\u043b\u0438 k-additive smoothing<\/a> \u2014 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435 \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/406\/f6e\/b4f\/406f6eb4feb0b5e5ec169083d4e4d689.gif\"\/>, \u0433\u0434\u0435 z &gt;= 0 \u2014 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u044f, \u0430 q \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435; \u0430 q \u2014 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0438 ham \u0438 spam \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043c\u044b \u043d\u0430\u0448\u043b\u0438 10 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 <i>P(\u00abhi\u00bb | ham) = ( 1 + 1 ) \/ (8 + 1*10 ) = 2\/18 = 1\/9<\/i> \u043f\u0440\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0435 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u044f z = 1. \u0410 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0432\u043e\u0439: <i>P(\u00abbro\u00bb | ham) = ( 0 + 1) \/ (8 + 1*10) = 1\/18<\/i>.<\/p>\n<p>  \u0421 \u0411\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044e \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u2014 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Dirichlet_distribution\">\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0414\u0438\u0440\u0438\u0445\u043b\u0435<\/a>, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c z.<\/p>\n<h4>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0438 \u043a\u043e\u0434<\/h4>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u0443\u044e \u0441 \u0441\u0430\u0439\u0442\u0430 <a href=\"http:\/\/www.dt.fee.unicamp.br\/~tiago\/smsspamcollection\/\">\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442\u0430 \u0433\u043e\u0440\u043e\u0434\u0430 \u041a\u0430\u043c\u043f\u0438\u043d\u0430\u0441<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 4827 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043c\u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (ham) \u0438 747 spam \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u042f \u043d\u0435 \u0434\u0435\u043b\u0430\u043b \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u0442\u0438\u043f\u0430 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Stemming\">\u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433\u0430<\/a>, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439:  <\/p>\n<ul>\n<li> \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b \u0442\u0435\u043a\u0441\u0442 \u0434\u043e \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0431\u0443\u043a\u0432<\/li>\n<li> \u0443\u0431\u0440\u0430\u043b \u0432\u0441\u0435 \u0437\u043d\u0430\u043a\u0438 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u0438<\/li>\n<li> \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u0435\u0434\u0438\u043d\u0438\u0446\u0435\u0439<\/li>\n<\/ul>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">PreprocessSentence &lt;- function(s) {   # Cut and make some preprocessing with input sentence   words &lt;- strsplit(gsub(pattern=&quot;[[:digit:]]+&quot;, replacement=&quot;1&quot;, x=tolower(s)), '[[:punct:][:blank:]]+')   return(words) }   LoadData &lt;- function(fileName = &quot;.\/Data\/Spam\/SMSSpamCollection&quot;)  {   # Read data from text file and makes simple preprocessing:    #   to lower case -&gt; replace all digit strings with 1 -&gt; split with punctuation and blank characters   con &lt;- file(fileName,&quot;rt&quot;)   lines &lt;- readLines(con)   close(con)   df &lt;- data.frame(lab = rep(NA, length(lines)), data = rep(NA, length(lines)))   for(i in 1:length(lines))   {     tmp &lt;- unlist(strsplit(lines[i], '\\t', fixed = T))     df$lab[i] &lt;- tmp[1]     df$data[i] &lt;- PreprocessSentence(tmp[2])   }      return(df) } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u044f\u0445, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044f \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e, \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0435\u043f\u0430\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u0442\u0430 \u0441\u0435\u0442\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">CreateDataSet &lt;- function(dataSet, proportions = c(0.6, 0.2, 0.2)) {   # Creates a list with indices of train, validation and test sets     proportions &lt;- proportions\/sum(proportions)   hamIdx &lt;- which(df$lab == &quot;ham&quot;)       nham &lt;- length(hamIdx)     spamIdx &lt;- which(df$lab == &quot;spam&quot;)   nspam &lt;- length(spamIdx)   hamTrainIdx &lt;- sample(hamIdx, floor(proportions[1]*nham))   hamIdx &lt;- setdiff(hamIdx, hamTrainIdx)   spamTrainIdx &lt;- sample(spamIdx, floor(proportions[1]*nspam))   spamIdx &lt;- setdiff(spamIdx, spamTrainIdx)   hamValidationIdx &lt;- sample(hamIdx, floor(proportions[2]*nham))   hamIdx &lt;- setdiff(hamIdx, hamValidationIdx)   spamValidationIdx &lt;- sample(spamIdx, floor(proportions[2]*nspam))   spamIdx &lt;- setdiff(spamIdx, spamValidationIdx)     ds &lt;- list(     train = sample(union(hamTrainIdx, spamTrainIdx)),      validation = sample(union(hamValidationIdx, spamValidationIdx)),      test = sample(union(hamIdx, spamIdx))     )     return(ds) } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">CreateModel &lt;- function(data, laplaceFactor = 0) {   # creates naive bayes spam classifier based on data   m &lt;- list(laplaceFactor = laplaceFactor)   m[[&quot;total&quot;]] &lt;- length(data$lab)   m[[&quot;ham&quot;]] &lt;- list()     m[[&quot;spam&quot;]] &lt;- list()   m[[&quot;hamLabelCount&quot;]] &lt;- sum(data$lab == &quot;ham&quot;)   m[[&quot;spamLabelCount&quot;]] &lt;- sum(data$lab == &quot;spam&quot;)   m[[&quot;hamWordCount&quot;]] &lt;- 0   m[[&quot;spamWordCount&quot;]] &lt;- 0   uniqueWordSet &lt;- c()   for(i in 1:length(data$lab))   {     sentence &lt;- unlist(data$data[i])     uniqueWordSet &lt;- union(uniqueWordSet, sentence)     for(j in 1:length(sentence))     {       if(data$lab[i] == &quot;ham&quot;)       {         if(is.null(m$ham[[sentence[j]]]))         {           m$ham[[sentence[j]]] &lt;- 1         }         else         {           m$ham[[sentence[j]]] &lt;- m$ham[[sentence[j]]] + 1         }         m[[&quot;hamWordCount&quot;]] &lt;- m[[&quot;hamWordCount&quot;]] + 1       }       else if(data$lab[i] == &quot;spam&quot;)       {         if(is.null(m$spam[[sentence[j]]]))         {           m$spam[[sentence[j]]] &lt;- 1         }         else         {           m$spam[[sentence[j]]] &lt;- m$spam[[sentence[j]]] + 1         }         m[[&quot;spamWordCount&quot;]] &lt;- m[[&quot;spamWordCount&quot;]] + 1       }     }   }   m[[&quot;uniqueWordCount&quot;]] &lt;- length(uniqueWordSet)   return(m)  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u0430\u0441\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">ClassifySentense &lt;- function(s, model, preprocess = T) {   # calculate class of the input sentence based on the model   GetCount &lt;- function(w, ls)   {     if(is.null(ls[[w]]))     {       return(0)     }     return(ls[[w]])   }   words &lt;- unlist(s)   if(preprocess)   {     words &lt;- unlist(PreprocessSentence(s))   }   ham &lt;- log(model$hamWordCount)   spam &lt;- log(model$spamWordCount)   for(i in 1:length(words))   {     ham &lt;- ham + log((GetCount(words[i], model$ham) + model$laplaceFactor)                      \/(model$hamWordCount + model$laplaceFactor*model$uniqueWordCount))     spam &lt;- spam + log((GetCount(words[i], model$spam) + model$laplaceFactor)                        \/(model$spamWordCount + model$laplaceFactor*model$uniqueWordCount))   }   if(ham &gt;= spam)   {     return(&quot;ham&quot;)   }   return(&quot;spam&quot;) } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">TestModel &lt;- function(data, model) {   # calculate percentage of errors   errors &lt;- 0   for(i in 1:length(data$lab))   {     predictedLabel &lt;- ClassifySentense(data$data[i], model, preprocess = F)     if(predictedLabel != data$lab[i])     {       errors &lt;- errors + 1     }   }   return(errors\/length(data$lab)) } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"http:\/\/en.wikipedia.org\/wiki\/Cross-validation_(statistics)\">\u043a\u0440\u043e\u0441\u0441\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f <\/a>\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0440\u043e\u0441\u0441\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">CrossValidation &lt;- function(trainData, validationData, laplaceFactorValues, showLog = F) {   cvErrors &lt;- rep(NA, length(laplaceFactorValues))   for(i in 1:length(laplaceFactorValues))   {     model &lt;- CreateModel(trainData, laplaceFactorValues[i])     cvErrors[i] &lt;- TestModel(validationData, model)     if(showLog)     {       print(paste(laplaceFactorValues[i], &quot;: error is &quot;, cvErrors[i], sep=&quot;&quot;))     }   }   return(cvErrors) } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u044f \u043e\u0442 0 \u0434\u043e 10, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0440\u0430\u043d\u043d\u0435\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0438 \u0437\u0430\u0442\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442 \u0433\u0440\u0430\u0444\u0438\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u043a\u0440\u043e\u0441\u0441\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u044f \u0438 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435:<\/p>\n<pre><code class=\"java\">rm(list = ls()) source(&quot;.\/Spam\/spam.R&quot;) set.seed(14880) fileName &lt;- &quot;.\/Data\/Spam\/SMSSpamCollection&quot; df &lt;- LoadData() ds &lt;- CreateDataSet(df, proportions = c(0.7, 0.2, 0.1)) laplaceFactorValues &lt;- 1:10 cvErrors &lt;- CrossValidation(df[ds$train, ], df[ds$validation, ], 0:10, showLog = T) bestLaplaceFactor &lt;- laplaceFactorValues[which(cvErrors == min(cvErrors))] model &lt;- CreateModel(data=df[ds$train, ], laplaceFactor=bestLaplaceFactor) testResult &lt;- TestModel(df[ds$test, ], model) plot(cvErrors, type=&quot;l&quot;, col=&quot;blue&quot;, xlab=&quot;Laplace Factor&quot;, ylab=&quot;Error Value&quot;, ylim=c(0, max(cvErrors))) title(&quot;Cross validation and test error value&quot;) abline(h=testResult, col=&quot;red&quot;) legend(bestLaplaceFactor, max(cvErrors), c(&quot;cross validation values&quot;, &quot;test value level&quot;), cex=0.8, col=c(&quot;blue&quot;, &quot;red&quot;), lty=1) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/a06\/cf2\/5b1\/a06cf25b175bc868f2af2fbddf6a665e.png\"\/><\/p>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/mephistopheies\/ml-r\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441 \u0433\u0438\u0442\u0445\u0430\u0431\u0430<\/a>.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u0435\u043d \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 (\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439) \u0432\u0441\u0435\u0433\u043e <b>2.32%<\/b>. \u0413\u0434\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432, \u0432\u044b \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u0432\u0435\u043b\u0438 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043e\u0442 1 \u0434\u043e 5, \u0438 \u0443 \u0432\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0441 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043b\u044e\u0434\u044c\u043c\u0438; \u0442\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0435 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0438 \u043d\u0430 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/184574\/\"> http:\/\/habrahabr.ru\/post\/184574\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/adf\/b34\/133\/adfb34133e0ac6a80ead91ed2d2c834e.jpg\" align=\"right\"\/> \u041f\u0440\u0438\u0432\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u043f\u0430\u043c\u0430 \u0441 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Naive_Bayes_classifier\">\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430<\/a> \u0441 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Additive_smoothing\">\u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435\u043c \u043f\u043e \u041b\u0430\u043f\u043b\u0430\u0441\u0443<\/a>, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 <a href=\"http:\/\/www.r-project.org\/\">\u043d\u0430 R<\/a>, \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 <a href=\"http:\/\/www.dt.fee.unicamp.br\/~tiago\/smsspamcollection\/\">\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043c\u0441 \u0441\u043f\u0430\u043c\u0430<\/a>. \u0412\u043e\u043e\u0431\u0449\u0435, \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u044f \u043d\u0430\u0448\u0435\u043b \u0434\u0432\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435, \u043d\u043e \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u0434 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043f\u0440\u043e \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0438, \u0431\u0435\u0437 \u043e\u0441\u043e\u0431\u044b\u0445 \u0437\u0430\u0442\u0440\u0430\u0442 \u0443\u0441\u0438\u043b\u0438\u0439, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u0441\u043a\u0430\u0436\u0435\u043c, \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430. \u041d\u043e \u0432\u043e\u043e\u0431\u0449\u0435, \u0437\u0430\u043f\u0438\u043b\u0438\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0435\u0441\u0430 \u043c\u0435\u043d\u044f \u043f\u043e\u0431\u0443\u0434\u0438\u043b\u043e \u0442\u043e, \u0447\u0442\u043e \u044f \u043f\u0438\u0448\u0443 \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0443 \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 R, \u0432\u043e\u0442 \u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043d\u0444\u043e\u0439.<\/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-184574","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/184574","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=184574"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/184574\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}