{"id":299735,"date":"2020-03-05T21:00:14","date_gmt":"2020-03-05T21:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=299735"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=299735","title":{"rendered":"\u041c\u0435\u0442\u043e\u0434\u044b \u041c\u043e\u043d\u0442\u0435-\u041a\u0430\u0440\u043b\u043e \u0434\u043b\u044f \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0438\u0445 \u0446\u0435\u043f\u0435\u0439 (MCMC). \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/491268\/\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u043d\u0435\u0435 \u043c\u044b \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043a\u043d\u0438\u0433\u0443 &quot;<a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/481332\/\">\u041c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u043b\u043e\u0432<\/a>&quot; \u2014 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0430 \u0443\u0436\u0435 <a href=\"https:\/\/www.piter.com\/collection\/new\/product\/mashinnoe-obuchenie-bez-lishnih-slov\">\u0432 \u043f\u0440\u043e\u0434\u0430\u0436\u0435<\/a>. \u041f\u0440\u0438\u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432 \u043f\u043e \u041c\u041e \u043a\u043d\u0438\u0433\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c <a href=\"https:\/\/storage.piter.com\/upload\/contents\/978544611560\/978544611560_X.pdf\">\u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u043e\u0439<\/a>, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u043c\u044b \u0432 \u043d\u0435\u0439 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b \u043d\u0435 \u0431\u044b\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435\u043c \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0421\u0430\u0439\u043c\u043e\u043d\u0430 \u041a\u0435\u0440\u0441\u0442\u0435\u043d\u0441\u0430 \u043e \u0441\u0443\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Markov_chain_Monte_Carlo\">MCMC<\/a> \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0442\u0430\u043a\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 Python.<br \/>  <a name=\"habracut\"><\/a> <br \/>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Markov_chain_Monte_Carlo\">\u041c\u0435\u0442\u043e\u0434\u044b \u041c\u043e\u043d\u0442\u0435-\u041a\u0430\u0440\u043b\u043e \u0434\u043b\u044f \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0438\u0445 \u0446\u0435\u043f\u0435\u0439<\/a> (MCMC) \u2013 \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043b\u0438\u0448\u044c \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 (\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439) \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. <br \/>  \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f \u0432 MCMC, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u0437\u0430\u0447\u0435\u043c \u0432\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443. \u041e\u0442\u0432\u0435\u0442 \u0442\u0430\u043a\u043e\u0432: \u0432\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043b\u0438\u0431\u043e \u0441\u0430\u043c\u0438 \u043e\u0431\u0440\u0430\u0437\u0446\u044b \u0438\u0437 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430), \u043b\u0438\u0431\u043e \u0434\u043b\u044f \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0442\u0435\u0440\u043c\u043e\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u043f\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0435). \u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0438\u0437 \u043b\u044e\u0431\u044b\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043a\u0440\u043e\u043c\u0435 \u0441\u0430\u043c\u044b\u0445 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u2013 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9C%D0%B5%D1%82%D0%BE%D0%B4_%D0%BE%D0%B1%D1%80%D0%B0%D1%82%D0%BD%D0%BE%D0%B3%D0%BE_%D0%BF%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F\">\u041c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/a> \u2013 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u043f\u0440\u0438\u0435\u043c \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043e\u0434\u043d\u0430\u043a\u043e, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0430 \u0434\u043b\u044f \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u043c\u044b\u043c \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439. <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D1%8B%D0%B1%D0%BE%D1%80%D0%BA%D0%B0_%D1%81_%D0%BE%D1%82%D0%BA%D0%BB%D0%BE%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5%D0%BC\">\u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u0441 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c<\/a> \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u043c \u043d\u0430\u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438. \u0412\u0434\u043e\u0431\u0430\u0432\u043e\u043a, \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442 \u043e\u0442 \u043f\u0440\u043e\u043a\u043b\u044f\u0442\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439 \u2013 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u043a\u043e\u0432\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u2013 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u0437\u043d\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443.<\/p>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b MCMC \u2013 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u041e\u043d\u0438 \u0432\u043e\u0441\u0445\u043e\u0434\u044f\u0442 \u043a <a href=\"https:\/\/pdfs.semanticscholar.org\/7b3d\/c9438227f747e770a6fb6d7d7c01d98725d6.pdf\">\u044d\u043f\u043e\u0445\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430 \u0438 \u0434\u0440.<\/a>; \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043f\u0435\u0440\u0432\u044b\u0439 MCMC-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u044b\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%D0%9C%D0%B5%D1%82%D1%80%D0%BE%D0%BF%D0%BE%D0%BB%D0%B8%D1%81%D0%B0_%E2%80%94_%D0%93%D0%B0%D1%81%D1%82%D0%B8%D0%BD%D0%B3%D1%81%D0%B0\">\u0432 \u0435\u0433\u043e \u0447\u0435\u0441\u0442\u044c<\/a> \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0432\u043d\u043e\u0432\u0435\u0441\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0436\u0435\u0441\u0442\u043a\u0438\u0445 \u0441\u0444\u0435\u0440. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0438\u0441\u043a\u0430\u043b\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0435.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u044b \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u043e MCMC.<\/p>\n<p>  <b>\u041c\u0410\u0420\u041a\u041e\u0412\u0421\u041a\u0418\u0415 \u0426\u0415\u041f\u0418<\/b><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u0437\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0435\u0440\u0434\u0446\u0443 MCMC: \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0438\u043c \u0446\u0435\u043f\u044f\u043c. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c? \u041d\u0435 \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u2013 \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439, \u0433\u0434\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0435\u043f\u0438, \u043d\u043e \u043d\u0435 \u043e\u0442 \u0435\u0435 \u043f\u0440\u0435\u0436\u043d\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438: \u044d\u0442\u0430 \u0446\u0435\u043f\u044c \u043b\u0438\u0448\u0435\u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u0438\u043c\u0435\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f, \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u041f\u043e\u0441\u043b\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0446\u0435\u043f\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wb\/sl\/yf\/wbslyf0r1hu5bjl1gbu7pyr3u48.png\"> \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c MCMC \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0443\u044e \u0446\u0435\u043f\u044c, \u0447\u044c\u0435 \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wb\/sl\/yf\/wbslyf0r1hu5bjl1gbu7pyr3u48.png\">; \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u00ab\u0437\u0430\u0442\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u0433\u043e\u00bb \u043f\u0435\u0440\u0438\u043e\u0434\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0446\u0435\u043f\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wb\/sl\/yf\/wbslyf0r1hu5bjl1gbu7pyr3u48.png\">. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0437\u0446\u044b \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wb\/sl\/yf\/wbslyf0r1hu5bjl1gbu7pyr3u48.png\">.<\/p>\n<p>  \u0412 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439, \u0442\u0430\u043a \u0438 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u00ab\u0432\u0440\u0435\u043c\u044f\u00bb. \u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u044e\u0449\u0430\u044f \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0443\u044e \u0446\u0435\u043f\u044c \u2013 \u044d\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5q\/fu\/fx\/5qfufxlugigeusphytdet38q580.png\">, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gs\/gz\/hz\/gsgzhzrwlbmvbexpmq21j8u1dbu.png\"> \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cj\/ut\/o7\/cjuto7hmum9a2ki6gyy23a86jb0.png\">, \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0446\u0435\u043f\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cj\/ut\/o7\/cjuto7hmum9a2ki6gyy23a86jb0.png\"> \u0432\u043e \u0432\u0440\u0435\u043c\u044f <code>i<\/code>.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 (\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438) \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e-\u0431\u044b\u0441\u0442\u0440\u043e\u043c\u0443 \u0441\u043f\u043b\u0435\u0442\u0435\u043c \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0443\u044e \u0446\u0435\u043f\u044c, \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u043b\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432:<\/p>\n<pre><code class=\"python\">%matplotlib notebook %matplotlib inline import numpy as np import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = [10, 6] np.random.seed(42)<\/code><\/pre>\n<p>  \u041c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439, \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c\u043e\u0435 \u0442\u0440\u0435\u043c\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438 \u043f\u043e\u0433\u043e\u0434\u044b: <\/p>\n<pre><code class=\"python\">state_space = (&quot;sunny&quot;, &quot;cloudy&quot;, &quot;rainy&quot;)<\/code><\/pre>\n<p>  \u0412 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u0439, \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0439 \u0438 \u0434\u043e\u0436\u0434\u043b\u0438\u0432\u043e\u0439 \u043f\u043e\u0433\u043e\u0434\u0435. \u0412\u044b\u0431\u0435\u0440\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u0441\u0435\u0445 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432:<\/p>\n<pre><code class=\"python\">transition_matrix = np.array(((0.6, 0.3, 0.1),                               (0.3, 0.4, 0.3),                               (0.2, 0.3, 0.5)))<\/code><\/pre>\n<p>  \u0412 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0446\u0435\u043f\u044c, \u0430 \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445 \u2013 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0446\u0435\u043f\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u00ab\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439\u00bb \u0448\u0430\u0433 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0446\u0435\u043f\u0438 \u0437\u0430 \u043e\u0434\u0438\u043d \u0447\u0430\u0441, \u0442\u043e, \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 60% \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0441\u043e\u043b\u043d\u0435\u0447\u043d\u0430\u044f \u043f\u043e\u0433\u043e\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u0447\u0430\u0441\u0430. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c 30% \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0447\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043b\u0430\u0447\u043d\u0430\u044f \u043f\u043e\u0433\u043e\u0434\u0430, \u0438 10%-\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e\u0439 \u043f\u043e\u0433\u043e\u0434\u044b \u043f\u043e\u0439\u0434\u0435\u0442 \u0434\u043e\u0436\u0434\u044c. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u044f\u0434\u0443 \u0432 \u0441\u0443\u043c\u043c\u0435 \u0434\u0430\u044e\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u0443.<br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043d\u0430\u0448\u0443 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0443\u044e \u0446\u0435\u043f\u044c:<\/p>\n<pre><code class=\"python\">n_steps = 20000 states = [0] for i in range(n_steps):     states.append(np.random.choice((0, 1, 2), p=transition_matrix[states[-1]])) states = np.array(states)<\/code><\/pre>\n<p>  \u041c\u043e\u0436\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u043c\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e, \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u044d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u0438\u043d\u044b \u0446\u0435\u043f\u0438:<\/p>\n<pre><code class=\"python\">def despine(ax, spines=('top', 'left', 'right')):     for spine in spines:         ax.spines[spine].set_visible(False)  fig, ax = plt.subplots() width = 1000 offsets = range(1, n_steps, 5) for i, label in enumerate(state_space):     ax.plot(offsets, [np.sum(states[:offset] == i) \/ offset              for offset in offsets], label=label) ax.set_xlabel(&quot;number of steps&quot;) ax.set_ylabel(&quot;likelihood&quot;) ax.legend(frameon=False) despine(ax, ('top', 'right')) plt.show()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vu\/tg\/xv\/vutgxvc3lq1-sang725fmek1ibm.png\"><\/p>\n<p>  <b>\u0420\u041e\u0414\u041e\u041d\u0410\u0427\u0410\u041b\u042c\u041d\u0418\u041a \u0412\u0421\u0415\u0425 MCMC: \u0410\u041b\u0413\u041e\u0420\u0418\u0422\u041c \u041c\u0415\u0422\u0420\u041e\u041f\u041e\u041b\u0418\u0421\u0410-\u0413\u0410\u0421\u0422\u0418\u041d\u0413\u0421\u0410<\/b> <\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0441\u0435 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043d\u043e \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r2\/lm\/5b\/r2lm5bcuhr-rdtxeg90gjnogcza.png\">. \u041e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u043c, \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0438 \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sz\/nh\/au\/sznhau4xxghwlc7ma-eixqb9jok.png\">, \u043b\u0438\u0431\u043e \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u043c, \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sz\/nh\/au\/sznhau4xxghwlc7ma-eixqb9jok.png\"> \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u044b\u043c \u044f\u0434\u0440\u043e\u043c. \u0417\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0445, \u043d\u043e \u0432\u0441\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0437\u0434\u0435\u0441\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0438 \u043a \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0441\u043b\u0443\u0447\u0430\u044f\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0435 \u044f\u0434\u0440\u043e \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r2\/lm\/5b\/r2lm5bcuhr-rdtxeg90gjnogcza.png\">, \u0442\u043e \u044d\u0442\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0448\u0430 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c\u2026 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0435\u043b\u0430\u043b\u0430 \u0431\u044b \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r2\/lm\/5b\/r2lm5bcuhr-rdtxeg90gjnogcza.png\">. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r2\/lm\/5b\/r2lm5bcuhr-rdtxeg90gjnogcza.png\">, \u0447\u0435\u0433\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u2013 \u0438\u043d\u0430\u0447\u0435 \u0432\u044b \u0431\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438, \u0432\u0435\u0440\u043d\u043e?<\/p>\n<p>  \u041e\u0431\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0443\u0442\u044c \u2013 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0435 \u044f\u0434\u0440\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7_\/os\/ja\/7_osja2wwom8x6f29sp5ecxnrwc.png\"> \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438: \u0448\u0430\u0433 \u043f\u0440\u043e\u0431 (proposal step) \u0438 \u0448\u0430\u0433 \u043f\u0440\u0438\u0435\u043c\u0430\/\u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044f (acceptance\/rejection step). \u041d\u0430 \u0448\u0430\u0433\u0435 \u043f\u0440\u043e\u0431 \u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qf\/bl\/m0\/qfblm0cpxxgzun1zq6i9qv_zmfq.png\">, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0438. \u041c\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043d\u043e \u0438 \u0432 \u0441\u0438\u043b\u0430\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u0439\u0442\u0438 \u043a \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u0440\u0430\u0437\u0446\u044b, \u0432\u0437\u044f\u0442\u044b\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0431\u044b \u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u043c\u0435\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0448\u0430\u043d\u0441\u044b \u043f\u0440\u043e\u0439\u0442\u0438 \u044d\u0442\u0430\u043f \u043f\u0440\u0438\u0435\u043c\u0430. \u0412\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u043f\u0440\u0438\u0435\u043c\u0430\/\u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u2013 \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u044f\u0434\u0440\u0430; \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0432 \u043f\u0440\u043e\u0431\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u0445, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dq\/wo\/ba\/dqwoba_pfa-ktifmo9zviggtesm.png\">. \u0417\u0434\u0435\u0441\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0435\u043c\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hz\/f4\/rv\/hzf4rviqapfrbg3mphv1na6kao0.png\"> \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gs\/gz\/hz\/gsgzhzrwlbmvbexpmq21j8u1dbu.png\"> \u0441 \u0442\u0430\u043a\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u0446\u0435\u043f\u0438. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gs\/gz\/hz\/gsgzhzrwlbmvbexpmq21j8u1dbu.png\"> \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5q\/fu\/fx\/5qfufxlugigeusphytdet38q580.png\"> \u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0431\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gs\/gz\/hz\/gsgzhzrwlbmvbexpmq21j8u1dbu.png\"> \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qf\/bl\/m0\/qfblm0cpxxgzun1zq6i9qv_zmfq.png\">. \u0417\u0430\u0442\u0435\u043c \u043e\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hz\/f4\/rv\/hzf4rviqapfrbg3mphv1na6kao0.png\"> \u0438\u043b\u0438 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cr\/_w\/sd\/cr_wsdxfgphyie2qbzl977pvfgq.png\">, \u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e.<br \/>  \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438\u043c\u0435\u0435\u043c <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ty\/vg\/w-\/tyvgw-g_ij7vgrpzoxtt7t3enmw.png\"><\/p>\n<p>  \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u0438\u043c\u0435\u043b\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r2\/lm\/5b\/r2lm5bcuhr-rdtxeg90gjnogcza.png\"> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0435 \u044f\u0434\u0440\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0442\u044c\u0441\u044f <i>\u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0430\u0432\u043d\u043e\u0432\u0435\u0441\u0438\u044e<\/i> \u0438\u043b\u0438, \u043a\u0430\u043a \u043f\u0438\u0448\u0443\u0442 \u0432 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0435, <i>\u043c\u0438\u043a\u0440\u043e\u0441\u043a\u043e\u043f\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u043e\u0441\u0442\u0438<\/i>: <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hf\/bg\/oy\/hfbgoyr944ikp5ce_menl-sg0da.png\">. <\/p>\n<p>  \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mt\/2y\/jr\/mt2yjrl958wkwmuhsrpm3h-4uko.png\"> \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043e\u0442\u0442\u0443\u0434\u0430 \u0432 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4t\/py\/hc\/4tpyhcj70euwoys5id2rrqxa_ac.png\"> \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0442\u043e \u0435\u0441\u0442\u044c, \u0431\u044b\u0442\u044c \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4t\/py\/hc\/4tpyhcj70euwoys5id2rrqxa_ac.png\"> \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mt\/2y\/jr\/mt2yjrl958wkwmuhsrpm3h-4uko.png\">. \u042f\u0434\u0440\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 MCMC-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u044d\u0442\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044e.<br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0432\u0443\u0445\u0447\u0430\u0441\u0442\u043d\u043e\u0435 \u044f\u0434\u0440\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u043b\u043e\u0441\u044c \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0430\u0432\u043d\u043e\u0432\u0435\u0441\u0438\u044e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oc\/hr\/x1\/ochrx15_pe9awrsow_fygffjego.png\">, \u0442\u043e \u0435\u0441\u0442\u044c, \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442 \/ \u0434\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4t\/py\/hc\/4tpyhcj70euwoys5id2rrqxa_ac.png\"> \u0438\u043b\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mt\/2y\/jr\/mt2yjrl958wkwmuhsrpm3h-4uko.png\">. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e\u0441\u0442\u0438 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mh\/dm\/z2\/mhdmz27voos90zkz5_-zexopsdc.png\">. <\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0433\u0438\u044f: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r2\/lm\/5b\/r2lm5bcuhr-rdtxeg90gjnogcza.png\"> \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043d\u0430\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0430\u043d\u043d\u0430\u044f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oc\/hr\/x1\/ochrx15_pe9awrsow_fygffjego.png\">! \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e paccpacc \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430, \u043d\u0430 \u043d\u0435\u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0445. \u0427\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b2\/ss\/pz\/b2sspzujgmdn_uwizxwjjokkg5w.png\">, \u0438 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430 \u0440\u0435\u0434\u0443\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e (\u043c\u0435\u043d\u0435\u0435 \u043e\u0431\u0449\u0435\u0433\u043e) \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u0432 1953 \u0433\u043e\u0434\u0443. \u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hd\/3k\/vq\/hd3kvqg9l2jqltan97_gfmzutsi.png\">. <\/p>\n<p>  \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0435 \u044f\u0434\u0440\u043e \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tl\/ic\/rd\/tlicrdfto9zvzlooid7cdt4ii-m.png\">.<\/p>\n<p>  <b>\u0420\u0415\u0410\u041b\u0418\u0417\u0423\u0415\u041c \u0410\u041b\u0413\u041e\u0420\u0418\u0422\u041c \u041c\u0415\u0422\u0420\u041e\u041f\u041e\u041b\u0418\u0421\u0410-\u0413\u0410\u0421\u0422\u0418\u041d\u0413\u0421\u0410 \u041d\u0410 PYTHON<\/b><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u2013 \u0431\u0435\u0437 \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442; \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u0438\u0445 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c. \u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"python\">def log_prob(x):      return -0.5 * np.sum(x ** 2)<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0412 \u0446\u0435\u043b\u043e\u043c, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e \u0432\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443. \u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0431\u0435\u0440\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>x<\/code> \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0431\u0443 \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tl\/ic\/rd\/tlicrdfto9zvzlooid7cdt4ii-m.png\">, \u0442\u043e \u0435\u0441\u0442\u044c, \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0448\u0430\u0433\u0430 <code>\u0394<\/code> \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043b\u0435\u0432\u043e \u0438\u043b\u0438 \u0432\u043f\u0440\u0430\u0432\u043e \u043e\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/q1\/n2\/d_\/q1n2d_lbzpbqtvbmbgiha503cmo.png\">:<\/p>\n<pre><code class=\"python\">def proposal(x, stepsize):     return np.random.uniform(low=x - 0.5 * stepsize,                               high=x + 0.5 * stepsize,                               size=x.shape)<\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u044f\u0442\u043e:<\/p>\n<pre><code class=\"python\">def p_acc_MH(x_new, x_old, log_prob):     return min(1, np.exp(log_prob(x_new) - log_prob(x_old)))<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043a\u0440\u0430\u0442\u043a\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u0430\u043f\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u043b\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430:<\/p>\n<pre><code class=\"python\">def sample_MH(x_old, log_prob, stepsize):     x_new = proposal(x_old, stepsize)     # \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442:     # \u043c\u044b \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0437 [0,1] \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c     # \u0435\u0433\u043e \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0435\u043c\u0430     accept = np.random.random() &lt; p_acc(x_new, x_old, log_prob)     if accept:         return accept, x_new     else:         return accept, x_old<\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0446\u0435\u043f\u0438, <code>x_new<\/code> \u0438\u043b\u0438 <code>x_old<\/code>, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u0431\u044b\u043b \u043b\u0438 \u043f\u0440\u0438\u043d\u044f\u0442 \u0448\u0430\u0433 MCMC. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443 \u043f\u0440\u0438\u0435\u043c\u0430 \u043f\u0440\u043e\u0431. \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>sample_MH<\/code> \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0443\u044e \u0446\u0435\u043f\u044c:<\/p>\n<pre><code class=\"python\">def build_MH_chain(init, stepsize, n_total, log_prob):      n_accepted = 0     chain = [init]      for _ in range(n_total):         accept, state = sample_MH(chain[-1], log_prob, stepsize)         chain.append(state)         n_accepted += accept          acceptance_rate = n_accepted \/ float(n_total)          return chain, acceptance_rate<\/code><\/pre>\n<p>  <b>\u0422\u0415\u0421\u0422\u0418\u0420\u0423\u0415\u041c \u041d\u0410\u0428 \u0410\u041b\u0413\u041e\u0420\u0418\u0422\u041c \u041c\u0415\u0422\u0420\u041e\u041f\u041e\u041b\u0418\u0421\u0410-\u0413\u0410\u0421\u0422\u0418\u041d\u0413\u0421\u0410 \u0418 \u0418\u0421\u0421\u041b\u0415\u0414\u0423\u0415\u041c \u0415\u0413\u041e \u041f\u041e\u0412\u0415\u0414\u0415\u041d\u0418\u0415<\/b> <\/p>\n<p>  \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043c \u043d\u0435 \u0442\u0435\u0440\u043f\u0438\u0442\u0441\u044f \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438. \u042d\u0442\u0438\u043c \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f, \u043f\u0440\u0438\u043c\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043e\u0431 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 <code>stepsize<\/code> \u0438 <code>n_total<\/code>:<\/p>\n<pre><code class=\"python\">chain, acceptance_rate = build_MH_chain(np.array([2.0]), 3.0, 10000, log_prob) chain = [state for state, in chain] print(&quot;Acceptance rate: {:.3f}&quot;.format(acceptance_rate)) last_states = &quot;, &quot;.join(&quot;{:.5f}&quot;.format(state)                          for state in chain[-10:]) print(&quot;Last ten states of chain: &quot; + last_states) Acceptance rate: 0.722 Last ten states of chain: -0.84962, -0.84962, -0.84962, -0.08692, 0.92728, -0.46215, 0.08655, -0.33841, -0.33841, -0.33841<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u0418\u0442\u0430\u043a, \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e? \u041c\u044b \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u043f\u0440\u043e\u0431 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 71% \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0446\u0435\u043f\u044c \u0435\u0449\u0435 \u043d\u0435 \u0441\u043e\u0448\u043b\u0430\u0441\u044c \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u043c\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u043b\u0438 \u0434\u0435\u043b\u0435 \u0443 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u2013 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"python\">def plot_samples(chain, log_prob, ax, orientation='vertical', normalize=True,                  xlims=(-5, 5), legend=True):     from scipy.integrate import quad          ax.hist(chain, bins=50, density=True, label=&quot;MCMC samples&quot;,            orientation=orientation)     # \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u043d\u0430\u0448\u0435\u0433\u043e PDF     if normalize:         Z, _ = quad(lambda x: np.exp(log_prob(x)), -np.inf, np.inf)     else:         Z = 1.0     xses = np.linspace(xlims[0], xlims[1], 1000)     yses = [np.exp(log_prob(x)) \/ Z for x in xses]     if orientation == 'horizontal':         (yses, xses) = (xses, yses)     ax.plot(xses, yses, label=&quot;true distribution&quot;)     if legend:         ax.legend(frameon=False)      fig, ax = plt.subplots() plot_samples(chain[500:], log_prob, ax) despine(ax) ax.set_yticks(()) plt.show()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yo\/rx\/59\/yorx59lirnkyju_dymptouaaokw.png\"><\/p>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e!<\/p>\n<p>  \u0427\u0442\u043e \u0436\u0435 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <code>stepsize<\/code> \u0438 <code>n_total<\/code>? \u041e\u0431\u0441\u0443\u0434\u0438\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430: \u043e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u043e \u043f\u0440\u043e\u0431\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0435\u043f\u0438. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u044d\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f <code>q<\/code>, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u043b\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0448\u0430\u0433\u0438, \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u043c\u044b\u0435 \u0446\u0435\u043f\u044c\u044e \u041c\u0430\u0440\u043a\u043e\u0432\u0430. \u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u0435\u043b\u0438\u043a, \u0442\u043e \u043f\u0440\u043e\u0431\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0445\u0432\u043e\u0441\u0442\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0433\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0438\u0437\u043a\u0438\u0435. \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0448\u0430\u0433\u043e\u0432, \u0432\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0447\u0435\u0433\u043e \u0442\u0435\u043c\u043f\u044b \u043f\u0440\u0438\u0435\u043c\u0430 \u0441\u043d\u0438\u0436\u0430\u044e\u0442\u0441\u044f, \u0438 \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442\u0441\u044f. \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c \u0441\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">def sample_and_display(init_state, stepsize, n_total, n_burnin, log_prob):     chain, acceptance_rate = build_MH_chain(init_state, stepsize, n_total, log_prob)     print(&quot;Acceptance rate: {:.3f}&quot;.format(acceptance_rate))     fig, ax = plt.subplots()     plot_samples([state for state, in chain[n_burnin:]], log_prob, ax)     despine(ax)     ax.set_yticks(())     plt.show()      sample_and_display(np.array([2.0]), 30, 10000, 500, log_prob) Acceptance rate: 0.116<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/0g\/4-\/-r\/0g4--rezypxzaqta-pkugq3gi3w.png\"><\/p>\n<p>  \u041d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e, \u043f\u0440\u0430\u0432\u0434\u0430? \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043a\u0440\u043e\u0448\u0435\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438 \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u043c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u0441\u0442\u0430\u043d\u0435\u0442 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e, \u043a\u0430\u043a \u0441 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0448\u0430\u0433\u0430:<\/p>\n<pre><code class=\"python\">sample_and_display(np.array([2.0]), 0.1, 10000, 500, log_prob) Acceptance rate: 0.992<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bf\/qh\/xi\/bfqhxistqravnn7xug43ubowgmu.png\"><\/p>\n<p>  \u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u0432\u044b\u0431\u0435\u0440\u0435\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0448\u0430\u0433\u0430, \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u0441\u043e\u0439\u0434\u0435\u0442\u0441\u044f \u043a \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u043c\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e. \u041d\u043e \u043d\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043d\u043e\u043e\u043e\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412\u0440\u0435\u043c\u044f, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0443\u044e \u0446\u0435\u043f\u044c, \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <code>n_total<\/code> \u2014 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0446\u0435\u043f\u0438 (\u0438, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u0446\u043e\u0432) \u0443 \u043d\u0430\u0441 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442. \u0415\u0441\u043b\u0438 \u0446\u0435\u043f\u044c \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c <code>n_total<\/code>, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0440\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0446\u0435\u043f\u044c \u0443\u0441\u043f\u0435\u043b\u0430 \u00ab\u0437\u0430\u0431\u044b\u0442\u044c\u00bb \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430 \u043a\u0440\u043e\u0448\u0435\u0447\u043d\u044b\u043c \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0440\u0430\u0437\u0446\u043e\u0432, \u043d\u0430\u0440\u0430\u0441\u0442\u0438\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>n_total<\/code>:<\/p>\n<pre><code class=\"python\">sample_and_display(np.array([2.0]), 0.1, 500000, 25000, log_prob) Acceptance rate: 0.990<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fs\/ba\/27\/fsba27vppyvfqnwdnnr0ifdp3w4.png\"><\/p>\n<p>  \u041c\u0435\u0435\u0435\u0435\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0438\u0434\u0435\u043c \u043a \u0446\u0435\u043b\u0438\u2026<\/p>\n<p>  <b>\u0412\u042b\u0412\u041e\u0414\u042b<\/b><\/p>\n<p>  \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u0443\u043b\u043e\u0432\u0438\u043b\u0438 \u0441\u0443\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u041c\u0435\u0442\u0440\u043e\u043f\u043e\u043b\u0438\u0441\u0430-\u0413\u0430\u0441\u0442\u0438\u043d\u0433\u0441\u0430, \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>  \u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0430\u043c \u0441\u0430\u043c\u0438\u043c \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043a\u043e\u0434\u043e\u043c, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c <a href=\"https:\/\/github.com\/tweag\/blog-resources\/blob\/master\/mcmc-intro\/mcmc_introduction.ipynb\">\u0437\u0434\u0435\u0441\u044c<\/a> \u2013 \u0442\u0430\u043a \u0432\u044b \u043e\u0441\u0432\u043e\u0438\u0442\u0435\u0441\u044c \u0441 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430\u0445 \u0438 \u0433\u043b\u0443\u0431\u0436\u0435 \u0435\u0433\u043e \u043f\u043e\u0439\u043c\u0435\u0442\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435! \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u043f\u0440\u0438\u0435\u043c\u0430 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442? \u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u0437 \u0431\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f? \u041c\u043e\u0436\u0435\u0442\u0435 \u043b\u0438 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0448\u0430\u0433\u0430? \u041a\u0430\u043a\u0438\u0435 \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438? \u041e\u0442\u0432\u0435\u0442\u044c\u0442\u0435 \u043d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e!<\/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=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/491268\/\"> https:\/\/habr.com\/ru\/company\/piter\/blog\/491268\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/491268\/\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u043d\u0435\u0435 \u043c\u044b \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043a\u043d\u0438\u0433\u0443 &quot;<a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/481332\/\">\u041c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u043b\u043e\u0432<\/a>&quot; \u2014 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0430 \u0443\u0436\u0435 <a href=\"https:\/\/www.piter.com\/collection\/new\/product\/mashinnoe-obuchenie-bez-lishnih-slov\">\u0432 \u043f\u0440\u043e\u0434\u0430\u0436\u0435<\/a>. \u041f\u0440\u0438\u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432 \u043f\u043e \u041c\u041e \u043a\u043d\u0438\u0433\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c <a href=\"https:\/\/storage.piter.com\/upload\/contents\/978544611560\/978544611560_X.pdf\">\u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u043e\u0439<\/a>, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u043c\u044b \u0432 \u043d\u0435\u0439 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b \u043d\u0435 \u0431\u044b\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435\u043c \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0421\u0430\u0439\u043c\u043e\u043d\u0430 \u041a\u0435\u0440\u0441\u0442\u0435\u043d\u0441\u0430 \u043e \u0441\u0443\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Markov_chain_Monte_Carlo\">MCMC<\/a> \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0442\u0430\u043a\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 Python.  <\/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-299735","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299735","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=299735"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299735\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}