{"id":290435,"date":"2018-10-07T19:55:02","date_gmt":"2018-10-07T15:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=290435"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=290435","title":{"rendered":"\u0417\u0430\u0434\u0430\u0447\u0430 \u043e \u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u043e\u043c \u0431\u0430\u043d\u0434\u0438\u0442\u0435 \u2014 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u0438 \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><i>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/towardsdatascience.com\/solving-multiarmed-bandits-a-comparison-of-epsilon-greedy-and-thompson-sampling-d97167ca9a50\">Solving multiarmed bandits: A comparison of epsilon-greedy and Thompson sampling<\/a>.<\/i><\/p>\n<h1>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e \u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u043e\u043c \u0431\u0430\u043d\u0434\u0438\u0442\u0435<\/h1>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e \u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u043e\u043c \u0431\u0430\u043d\u0434\u0438\u0442\u0435 \u2013 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0443\u043a\u0435 \u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u0443c\u043b\u043e\u0432\u0438\u044f\u0445 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0421\u0430\u043c\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u00ab\u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u0438\u0439 \u0431\u0430\u043d\u0434\u0438\u0442\u00bb \u043f\u043e\u0448\u043b\u043e \u043e\u0442 \u0441\u0442\u0430\u0440\u044b\u0445 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0440\u0443\u0447\u0435\u043a. \u042d\u0442\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u043e\u0437\u0432\u0438\u0449\u0435 \u00ab\u0431\u0430\u043d\u0434\u0438\u0442\u044b\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043d\u0438\u043c\u0438 \u043b\u044e\u0434\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043e\u0433\u0440\u0430\u0431\u043b\u0435\u043d\u043d\u044b\u043c\u0438. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0445 \u043c\u0430\u0448\u0438\u043d \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u0448\u0430\u043d\u0441 \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0440\u0430\u0437\u043d\u044b\u0439. \u0420\u0430\u0437 \u0443\u0436 \u043c\u044b \u0432\u0437\u044f\u043b\u0438\u0441\u044c \u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0443 \u043a\u0430\u043a\u043e\u0439 \u044d\u0442\u043e\u0442 \u0448\u0430\u043d\u0441 \u0432\u044b\u0448\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (exploit) \u044d\u0442\u0443 \u043c\u0430\u0448\u0438\u043d\u0443 \u0447\u0430\u0449\u0435, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u043a\u0430\u043a \u043d\u0430\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438? \u042d\u0442\u043e \u043d\u0435 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u044d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c (\u0432 \u0447\u0438\u0441\u043b\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0445\u043e\u0434\u044f\u0442 \u0438 \u0440\u0435\u043a\u043b\u0430\u043c\u0430, \u0441\u0430\u0439\u0442\u044b, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f) \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0435\u043a\u043e\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u0437\u0430\u0434\u0430\u043d\u0438\u0435 (\u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044e, \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440.)<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u2013 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/A\/B-%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\"> A\/B \u0442\u0435\u0441\u0442\u044b<\/a>. \u0422.\u0435 \u0441\u043a\u043e\u043b\u044c\u043a\u043e-\u0442\u043e \u043d\u0435\u0434\u0435\u043b\u044c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0447\u0430\u0441\u0442\u043e, \u0430 \u043f\u043e\u0442\u043e\u043c, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043b\u0443\u0447\u0448\u0435. \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0441\u043a\u0430\u0436\u0435\u043c, 2 \u0438\u043b\u0438 4. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0433\u043e, \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u2013 \u0438 \u043f\u043e \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438 \u043f\u043e \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0433\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0443\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u2013 \u043d\u0430\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 A\/B \u0442\u0435\u0441\u0442\u043e\u0432 \u2013 \u043d\u0430\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0433\u043e\u0434\u044b \u043d\u0435 \u0442\u0430\u043a \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e. \u0423\u043f\u0443\u0449\u0435\u043d\u043d\u0430\u044f \u0432\u044b\u0433\u043e\u0434\u0430 (opportunity cost) \u2013 \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0435, \u0442\u043e \u0435\u0441\u0442\u044c, \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438, \u0432\u043b\u043e\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0432 A \u0432\u043c\u0435\u0441\u0442\u043e B. \u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 B \u2013 \u0438 \u0435\u0441\u0442\u044c \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u0430\u044f \u0432\u044b\u0433\u043e\u0434\u0430 \u043e\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 A. \u0422\u043e \u0436\u0435 \u0438 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. A\/B \u0442\u0435\u0441\u0442\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u0442\u043e\u0440 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043b\u0443\u0447\u0448\u0435, \u043f\u043e\u043a\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u043e\u0441\u044c. \u041e\u0434\u043d\u0430\u043a\u043e, \u0432\u0441\u0435 \u0436\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e, \u043f\u0440\u043e\u0434\u043b\u0435\u0432\u0430\u044f A\/B \u0442\u0435\u0441\u0442\u044b, \u043c\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0435 \u0441\u0430\u043c\u044b\u0435 \u043b\u0443\u0447\u0448\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 (\u0445\u043e\u0442\u044c \u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0435 \u0441\u0430\u043c\u044b\u0435 \u043b\u0443\u0447\u0448\u0438\u0435), \u0443\u043f\u0443\u0441\u043a\u0430\u044f \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0441\u0432\u043e\u044e \u043f\u0440\u0438\u0431\u044b\u043b\u044c. \u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u0430\u044f \u0432\u044b\u0433\u043e\u0434\u0430 \u043e\u0442 A\/B \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 A\/B \u0442\u0435\u0441\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d, \u0442\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u0430\u044f \u0432\u044b\u0433\u043e\u0434\u0430 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432\u0435\u043b\u0438\u043a\u0430. \u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0410\/\u0412 \u0442\u0435\u0441\u0442\u043e\u0432 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435 \u0441\u0430\u043c\u044b\u0445 \u043b\u0443\u0447\u0448\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. \u0411\u044b\u043b\u043e \u0431\u044b \u043b\u0443\u0447\u0448\u0435, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442\u043a\u0438\u043d\u0443\u0442\u044c \u043f\u043b\u043e\u0445\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0430 \u0443\u0436\u0435 \u043f\u043e\u0442\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043c\u0430\u043b\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 A\/B \u0442\u0435\u0441\u0442\u044b. <\/p>\n<p>  <\/p>\n<p>\u0421\u044d\u043c\u043f\u043b\u0435\u0440\u044b \u0438\u043b\u0438 \u0430\u0433\u0435\u043d\u0442\u044b \u2013 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u044e \u0432\u0430\u0441 \u0441 \u0422\u043e\u043f\u043c\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u043c \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c (<i>Thompson sampling<\/i>) \u0438 \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u0440\u0430\u0432\u043d\u044e \u0442\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u2014 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043e \u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u043e\u043c \u0431\u0430\u043d\u0434\u0438\u0442\u0435. \u0412\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0430 Python \u0441 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u043b\u0438\u0441\u0442\u0430 \u2013 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/conormm\/bandit_algorithms\/blob\/master\/bandits_post_code.py\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u043e\u043d\u044f\u0442\u0438\u0439<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0410\u0433\u0435\u043d\u0442, \u0441\u044d\u043f\u043c\u043b\u0435\u0440, \u0431\u0430\u043d\u0434\u0438\u0442 (<i>agent,sampler, bandit<\/i>) \u2013 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c.<\/li>\n<li>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 (<i>variant<\/i>) \u2013 \u0440\u0430\u0437\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0438\u0434\u0438\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c.<\/li>\n<li>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (<i>action<\/i>) \u2013 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0431\u0440\u0430\u043b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (\u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c).<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (<i>exploit<\/i>) \u2013 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u0441 \u0446\u0435\u043b\u044c\u044e \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0430\u0434\u0443 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c (<i>explore<\/i>) \u2013 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u0441 \u0446\u0435\u043b\u044c\u044e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430.<\/li>\n<li>\u041d\u0430\u0433\u0440\u0430\u0434\u0430, \u043e\u0447\u043a\u0438 (<i>score,reward<\/i>) \u2013 \u0431\u0438\u0437\u043d\u0435\u0441-\u0437\u0430\u0434\u0430\u043d\u0438\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u0438\u043b\u0438 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0431\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e \u0438 \u0440\u0430\u0432\u043d\u0430 \u043b\u0438\u0431\u043e 1, \u043b\u0438\u0431\u043e 0 \u2014 \u043a\u043b\u0438\u043a\u043d\u0443\u043b\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/li>\n<li>\u041e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u2013 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0430\u0433\u0435\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438 \u0438\u0445 \u0441\u043a\u0440\u044b\u0442\u0430\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u201c\u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c\u201d.<\/li>\n<li>\u041e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u043f\u0435\u0445\u0430 (<i>payout rate<\/i>) \u2013 \u0441\u043a\u0440\u044b\u0442\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0440\u0430\u0432\u043d\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c score=1, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u043d\u0430 \u0441\u0432\u043e\u044f. \u041d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0442\u0430\u0435\u043b\u044c \u0435\u0435 \u043d\u0435 \u0432\u0438\u0434\u0438\u0442.<\/li>\n<li>\u041f\u043e\u043f\u044b\u0442\u043a\u0430 (<i>trial<\/i>) \u2013 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<\/li>\n<li>\u0421\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u0435 (regret) \u2013 \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043c, \u043a\u0430\u043a\u043e\u0439 \u0431\u044b\u043b \u0431\u044b \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437 \u0432\u0441\u0435\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u043a\u0430\u043a\u043e\u0439 \u0431\u044b\u043b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435. \u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435.<\/li>\n<li>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (<i>message<\/i>) \u2013 \u0431\u0430\u043d\u043d\u0435\u0440, \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u043f\u0440\u043e\u0447\u0435\u0435, \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c.<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (Explore and exploit)<\/h2>\n<p>  <\/p>\n<p>\u0410\u0433\u0435\u043d\u0442\u044b \u2013 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0449\u0443\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u043e\u0433\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. \u042d\u0442\u043e\u0442 \u0431\u0430\u043b\u0430\u043d\u0441 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u0435\u043d. \u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0430\u0434\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439. \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u044d\u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u2013 \u043c\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0430\u0434\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0438\u0437 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u044b. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u2013 \u0432\u0434\u0440\u0443\u0433 \u043e\u043d\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435, \u0430 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c? \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0442\u0438\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0443\u0431\u044b\u0442\u043a\u043e\u0432, \u043f\u0440\u043e\u0431\u0443\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u0443\u0431\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0438\u0445 \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0438\u0445 \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0430\u044f, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0447\u0430\u0449\u0435. \u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u043b\u044e\u0441 \u043e\u0442 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c, \u043d\u043e \u0438 \u0442\u043e, \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f, \u0442.\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0443\u0447\u0448\u0435 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c. <br \/>  \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u044d\u0442\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u2013 \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u0434\u0438\u043b\u0435\u043c\u043c\u044b \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c (exploration-exploitation tradeoff).<\/p>\n<p>  <\/p>\n<h2>\u042d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (epsilon-greedy algorithm)<\/h2>\n<p>  <\/p>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0434\u0438\u043b\u0435\u043c\u043c\u044b\u2013 \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u00ab\u0416\u0430\u0434\u043d\u044b\u0439\u00bb \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u043e \u0447\u0435\u043c \u0432\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u043b\u0438. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u2013 \u0441\u043a\u0430\u0436\u0435\u043c, 1000 \u0440\u0430\u0437, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0436\u0430\u0434\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 k \u0432 <i>e<\/i> \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 <i>e<\/i>=0.05, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c 95% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0430 \u0432 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f 5% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439, \u0437\u0430\u0441\u0442\u0440\u044f\u0442\u044c \u043d\u0430 \u0441\u0443\u0431\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u0432 \u043a\u043e\u0434\u0435, \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0443\u044e \u0441\u0440\u0435\u0434\u0443 Environment. \u042d\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u041e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u0433\u0435\u043d\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0430\u0433\u0435\u043d\u0442 \u0440\u0435\u0448\u0438\u043b, \u043a\u0430\u043a\u043e\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u0434\u0430\u043b\u044c\u0448\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0430 \u043d\u0435\u0433\u043e \u043e\u0447\u043a\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0430\u0433\u0435\u043d\u0442\u0443 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u043a-\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435).<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class Environment: \t    def __init__(self, variants, payouts, n_trials, variance=False): \t        self.variants = variants \t        if variance: \t            self.payouts = np.clip(payouts + np.random.normal(0, 0.04, size=len(variants)), 0, .2) \t        else: \t            self.payouts = payouts \t        #self.payouts[5] = self.payouts[5] if i &lt; n_trials\/2 else 0.1 \t        self.n_trials = n_trials \t        self.total_reward = 0 \t        self.n_k = len(variants) \t        self.shape = (self.n_k, n_trials) \t         \t    def run(self, agent): \t        &quot;&quot;&quot;Run the simulation with the agent.  \t        agent must be a class with choose_k and update methods.&quot;&quot;&quot; \t         \t        for i in range(self.n_trials): \t            # agent makes a choice \t            x_chosen = agent.choose_k() \t            # Environment returns reward \t            reward = np.random.binomial(1, p=self.payouts[x_chosen]) \t            # agent learns of reward \t            agent.reward = reward \t            # agent updates parameters based on the data \t            agent.update() \t            self.total_reward += reward \t         \t        agent.collect_data() \t         \t        return self.total_reward<\/code><\/pre>\n<p>  \u041e\u0447\u043a\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0431\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e p, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0435\u0439 \u043e\u0442 \u043d\u043e\u043c\u0435\u0440\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (\u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u043d\u0438 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0438 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e, \u0441\u0443\u0442\u044c \u0431\u044b \u043d\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c). \u0422\u0430\u043a\u0436\u0435 \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044e \u043a\u043b\u0430\u0441\u0441 BaseSampler \u2013 \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043b\u043e\u0433\u0438 \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b. <\/p>\n<pre><code class=\"python\">class BaseSampler:\t     \t    def __init__(self, env, n_samples=None, n_learning=None, e=0.05): \t        self.env = env \t        self.shape = (env.n_k, n_samples) \t        self.variants = env.variants \t        self.n_trials = env.n_trials \t        self.payouts = env.payouts \t        self.ad_i = np.zeros(env.n_trials) \t        self.r_i = np.zeros(env.n_trials) \t        self.thetas = np.zeros(self.n_trials) \t        self.regret_i = np.zeros(env.n_trials) \t        self.thetaregret = np.zeros(self.n_trials) \t         \t        self.a = np.ones(env.n_k)  \t        self.b = np.ones(env.n_k)  \t        self.theta = np.zeros(env.n_k) \t        self.data = None \t        self.reward = 0 \t        self.total_reward = 0 \t        self.k = 0 \t        self.i = 0 \t         \t        self.n_samples = n_samples \t        self.n_learning = n_learning \t        self.e = e \t        self.ep = np.random.uniform(0, 1, size=env.n_trials) \t        self.exploit = (1 - e) \t         \t    def collect_data(self): \t         \t        self.data = pd.DataFrame(dict(ad=self.ad_i, reward=self.r_i, regret=self.regret_i))<\/code><\/pre>\n<p>  \u041d\u0438\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c 10 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e. \u0421\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 9 \u0441 \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c\u044e 0.11%.<\/p>\n<pre><code class=\"python\">variants = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] payouts = [0.023, 0.03, 0.029, 0.001, 0.05, 0.06, 0.0234, 0.035, 0.01, 0.11]<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043e\u0442 \u0447\u0435\u0433\u043e \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u043b\u0430\u0441\u0441 RandomSampler. \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043d\u0443\u0436\u0435\u043d \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 baseline \u043c\u043e\u0434\u0435\u043b\u0438. \u041e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0438\u0441\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0438 \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<pre><code class=\"python\">class RandomSampler(BaseSampler): \t    def __init__(self, env): \t        super().__init__(env) \t         \t    def choose_k(self): \t         \t        self.k = np.random.choice(self.variants) \t         \t        return self.k \t     \t    def update(self): \t        # nothing to update \t        #self.thetaregret[self.i] = self.thetaregret[self.i] \t        #self.regret_i[self.i] = np.max(self.thetaregret) - self.theta[self.k] \t        #self.thetas[self.i] = self.theta[self.k] \t        self.thetaregret[self.i] = np.max(self.theta) - self.theta[self.k] \t         \t        self.a[self.k] += self.reward \t        self.b[self.k] += 1 \t        self.theta = self.a\/self.b \t \t        self.ad_i[self.i] = self.k \t        self.r_i[self.i] = self.reward \t        self.i += 1<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f. \u0423 \u0432\u0441\u0435\u0445 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b choose_k \u0438 update. choose_k \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. update \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0433\u0435\u043d\u0442\u0430 \u2013 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442, \u043a\u0430\u043a \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0433\u0435\u043d\u0442\u0430 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u0443 RandomSampler \u044d\u0442\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f). \u041c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0430\u0433\u0435\u043d\u0442\u0430 \u0432 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">en0 = Environment(machines, payouts, n_trials=10000) rs = RandomSampler(env=en0) en0.run(agent=rs)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0443\u0442\u044c \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0442\u0430\u043a\u043e\u0432\u0430.<\/p>\n<ol>\n<li>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c k \u0434\u043b\u044f n \u043f\u043e\u043f\u044b\u0442\u043e\u043a.<\/li>\n<li>\u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0438\u0433\u0440\u044b\u0448.<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 n \u043f\u043e\u043f\u044b\u0442\u043e\u043a:<\/li>\n<li>\u0421 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e 1-<i>e<\/i> \u0432\u044b\u0431\u0440\u0430\u0442\u044c k \u0441 \u0441\u0430\u043c\u044b\u043c \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0435\u043c;<\/li>\n<li>\u0421 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e <i>e<\/i> \u0432\u044b\u0431\u0440\u0430\u0442\u044c K \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e.<\/li>\n<\/ol>\n<p>  \u041a\u043e\u0434 \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class eGreedy(BaseSampler): \t \t    def __init__(self, env, n_learning, e): \t        super().__init__(env, n_learning, e) \t         \t    def choose_k(self): \t \t        # e% of the time take a random draw from machines \t        # random k for n learning trials, then the machine with highest theta \t        self.k = np.random.choice(self.variants) if self.i &lt; self.n_learning else np.argmax(self.theta) \t        # with 1 - e probability take a random sample (explore) otherwise exploit \t        self.k = np.random.choice(self.variants) if self.ep[self.i] &gt; self.exploit else self.k \t        return self.k \t        # every 100 trials update the successes \t \t        # update the count of successes for the chosen machine \t    def update(self): \t         \t        # update the probability of payout for each machine \t        self.a[self.k] += self.reward \t        self.b[self.k] += 1 \t        self.theta = self.a\/self.b \t \t        #self.total_reward += self.reward \t        #self.regret_i[self.i] = np.max(self.theta) - self.theta[self.k] \t        #self.thetaregret[self.i] = self.thetaregret[self.i] \t        self.thetas[self.i] = self.theta[self.k] \t        self.thetaregret[self.i] = np.max(self.thetas) - self.theta[self.k] \t  \t        self.ad_i[self.i] = self.k \t        self.r_i[self.i] = self.reward \t        self.i += 1<\/code><\/pre>\n<p>\u041d\u0438\u0436\u0435 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0447\u0438\u0441\u0442\u043e \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e\u0433\u043e \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c, \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a\u043e\u0439 \u0432\u044b\u0431\u043e\u0440 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u0435\u043b\u0430\u043b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0431\u044b\u043b\u043e 10 \u0442\u044b\u0441\u044f\u0447. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u0443\u0435\u0442, \u043d\u043e \u043d\u0435 \u0443\u0447\u0438\u0442\u0441\u044f. \u0412\u0441\u0435\u0433\u043e \u043e\u043d \u043d\u0430\u0431\u0440\u0430\u043b 418 \u043e\u0447\u043a\u043e\u0432.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sn\/ql\/2r\/snql2roqbdiruuskxsathithz8i.jpeg\"\/><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430 10 \u0442\u044b\u0441\u044f\u0447 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0441 <i>e<\/i>=0.1 \u0438 n_learning=500 (\u043f\u0435\u0440\u0432\u044b\u0435 500 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0430\u0433\u0435\u043d\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0431\u0443\u0435\u0442, \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e <i>e<\/i>=0.1). \u041e\u0446\u0435\u043d\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u043e\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043d \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0432 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">en1 = Environment(machines, payouts, n_trials) \teg = eGreedy(env=en1, n_learning=500, e=0.1) \ten1.run(agent=eg)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-f\/zf\/14\/-fzf14djbqtdl5-0vyrapuhcp5c.jpeg\"\/>  <\/p>\n<p>\u042d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0431\u0440\u0430\u043b 788 \u043e\u0447\u043a\u043e\u0432, \u043f\u043e\u0447\u0442\u0438 \u0432 2 \u0440\u0430\u0437\u0430 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u2013 \u0441\u0443\u043f\u0435\u0440! \u0412\u0442\u043e\u0440\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u044b\u0445 500 \u0448\u0430\u0433\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0438 K \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043e\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 5 \u2013 \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0446\u0438\u044f, \u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u043b\u0443\u0447\u0448\u0430\u044f. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e 10% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0430\u0433\u0435\u043d\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0443\u0442\u043e \u2014 \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430, \u0438 \u0432\u043e\u0442 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043d\u0435\u043c \u0431\u043b\u0438\u0437\u043a\u0438\u0435 \u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. \u0414\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0448\u0430\u0433\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u0442\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u0435\u0449\u0435 \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u0443\u0445\u0443\u0434\u0448\u0430\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0422\u0430\u043a\u0436\u0435, \u0432 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0448\u0438\u0442\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c \u2013 \u043b\u0443\u0447\u0448\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u0435\u0442 \u0442\u0430\u043a \u0438 \u043d\u0435 \u043e\u0442\u044b\u0441\u043a\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0437\u0436\u0435 \u044f \u0437\u0430\u043f\u0443\u0449\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0438\u0445 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430. \u041d\u043e \u043f\u043e\u043a\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u043c \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0435\u0433\u043e \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>  <\/p>\n<h2>\u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (Thompson sampling)<\/h2>\n<p>  <\/p>\n<p>\u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0442\u0440\u0435\u043c\u044f \u0433\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438:<\/p>\n<ol>\n<li>\u041e\u043d\u043e \u043d\u0435 \u0436\u0430\u0434\u043d\u043e\u0435.<\/li>\n<li>\u041e\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u044b\u043c \u043f\u0443\u0442\u0435\u043c.<\/li>\n<li>\u041e\u043d\u043e \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u043e.<\/li>\n<\/ol>\n<p>  \u0413\u043b\u0430\u0432\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u043d\u043a\u0442 3, \u043f\u0443\u043d\u043a\u0442\u044b 1 \u0438 2 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0438\u0437 \u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0442\u0430\u043a\u0430\u044f:<\/p>\n<ol>\n<li>\u0417\u0430\u0434\u0430\u0442\u044c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0411\u0435\u0442\u0430-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 0 \u0438 1 \u0434\u043b\u044f \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430.<\/li>\n<li>\u041f\u0440\u043e\u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0422\u0435\u0442\u0430.<\/li>\n<li>\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 k, \u043a\u0430\u043a\u043e\u0439 \u0431\u044b \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441 \u0441\u0430\u043c\u044b\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0442\u0435\u0442\u0430.<\/li>\n<li>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u043a\u043e\u0432 \u043d\u0430\u0431\u0440\u0430\u043b\u0438, \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/li>\n<\/ol>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0431\u0435\u0442\u0430-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%91%D0%B5%D1%82%D0%B0-%D1%80%D0%B0%D1%81%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5\">\u0442\u0443\u0442<\/a>. <br \/>  \u0410 \u043f\u0440\u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 Python \u2014 <a href=\"https:\/\/docs.scipy.org\/doc\/scipy\/reference\/generated\/scipy.stats.beta.html\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430: <\/p>\n<pre><code class=\"python\">\tclass ThompsonSampler(BaseSampler): \t \t    def __init__(self, env): \t        super().__init__(env) \t         \t    def choose_k(self): \t        # sample from posterior (this is the thompson sampling approach) \t        # this leads to more exploration because machines with &gt; uncertainty can then be selected as the machine \t        self.theta = np.random.beta(self.a, self.b) \t        # select machine with highest posterior p of payout \t        self.k = self.variants[np.argmax(self.theta)] \t        #self.k = np.argmax(self.a\/(self.a + self.b)) \t        return self.k \t     \t    def update(self): \t        \t        #update dist (a, b) = (a, b) + (r, 1 - r)  \t        self.a[self.k] += self.reward \t        self.b[self.k] += 1 - self.reward # i.e. only increment b when it's a swing and a miss. 1 - 0 = 1, 1 - 1 = 0 \t         \t        #self.thetaregret[self.i] = self.thetaregret[self.i] \t        #self.regret_i[self.i] = np.max(self.theta) - self.theta[self.k] \t        self.thetas[self.i] = self.theta[self.k] \t        self.thetaregret[self.i] = np.max(self.thetas) - self.theta[self.k] \t \t        self.ad_i[self.i] = self.k \t        self.r_i[self.i] = self.reward \t        self.i += 1<\/code><\/pre>\n<p>  \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5f\/n6\/xe\/5fn6xew2i7v1jjh_10h9jqkjdzu.png\"\/>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u044b, ThompsonSampler \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 BaseSampler \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b choose_k \u0438 update. \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430. <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">\ten2 = Environment(machines, payouts, n_trials) \ttsa = ThompsonSampler(env=en2) \ten2.run(agent=tsa)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ml\/kj\/1p\/mlkj1pvs8xnpxtkqmehmm_3xhgo.jpeg\"\/>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043e\u043d \u043d\u0430\u0431\u0440\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u0421\u0443\u043f\u0435\u0440! \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u043e\u043f\u044b\u0442\u043e\u043a. \u041d\u0430 \u043d\u0435\u043c \u0432\u0438\u0434\u043d\u044b \u0434\u0432\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u0435\u0449\u0438. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0430\u0433\u0435\u043d\u0442 \u0432\u0435\u0440\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u0432\u0430\u0440\u0438\u0430\u043d\u0442 9) \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u043d\u0430 \u043f\u043e\u043b\u043d\u0443\u044e \u043a\u0430\u0442\u0443\u0448\u043a\u0443. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0430\u0433\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0445\u0438\u0442\u0440\u044b\u043c \u043f\u0443\u0442\u0435\u043c \u2013 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u0441\u043b\u0435 1000 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0430\u0433\u0435\u043d\u0442, \u043a\u0440\u043e\u043c\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0430\u043c\u044b\u0435 \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0441\u0440\u0435\u0434\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043e\u043d \u0432\u044b\u0431\u0438\u0440\u0430\u043b \u043d\u0435 \u043d\u0430\u043e\u0431\u0443\u043c, \u0430 \u0431\u043e\u043b\u0435\u0435 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u2013 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439 \u0432\u044b\u0433\u043e\u0434\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u0430\u043b\u044c\u0444\u0430 \u0438 \u0431\u0435\u0442\u0430. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u044b\u0433\u043e\u0434\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0443 \u043d\u0435\u0433\u043e. \u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0438\u043c\u0435\u044f \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u043e\u0444\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0430\u0433\u0435\u043d\u0442 \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0443\u044e \u0441\u0440\u0435\u0434\u0443 \u0438 \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0430\u0431\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0439 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0443\u043f\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0438. \u041d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043f\u043e\u043f\u044b\u0442\u043e\u043a, \u0447\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0435\u0433\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0438 \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0435\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0448\u0430\u043d\u0441\u043e\u0432 \u0435\u0433\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430: \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u0446\u0435\u043d\u043a\u0435 \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. \u041d\u0438\u0436\u0435 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044b \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 6 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u043e\u0447\u043a\u0430\u0445 \u0438 \u0432 20000 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445. \u0412\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443 \u0441 \u0441\u0430\u043c\u043e\u0439 \u043b\u0443\u0447\u0448\u0435\u0439 \u043e\u043a\u0443\u043f\u0430\u0435\u043c\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>   <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bb\/ka\/fb\/bbkafb4nv1pajwkygxy2brtmowy.jpeg\"\/>   <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0432\u0441\u0435 3 \u0430\u0433\u0435\u043d\u0442\u0430 \u043d\u0430 100 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f\u0445. 1 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u2013 \u044d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a \u0430\u0433\u0435\u043d\u0442\u0430 \u043d\u0430 10000 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/j6\/v1\/sm\/j6v1smcrwkwyhlo27ffhly13pwk.jpeg\"\/>   <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430, \u0438 \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f, \u0438 \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438. \u0412\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0443\u0434\u0438\u0432\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0438 \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439. \u042d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439, \u043d\u043e \u043e\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u043d\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0441\u0442\u0440\u044f\u0442\u044c \u043d\u0430 \u0441\u0443\u0431\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u2013 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0432\u0430\u043b\u0430\u0445 \u0432\u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435. \u0410 \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442, \u0442.\u043a \u043e\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0431\u043e\u0440 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>   <\/p>\n<h2>\u0421\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u0435 (regret)<\/h2>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u044d\u0442\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u0435 (regret). \u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0447\u0435\u043c \u043e\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435. \u041d\u0438\u0436\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0433\u043e \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044f \u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0443. \u0415\u0449\u0435 \u0440\u0430\u0437 \u2013 \u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 regret, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>   <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8p\/kd\/o3\/8pkdo3bilrde28bwsimdnbesqwg.jpeg\"\/>  <\/p>\n<p>\u041d\u0430 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435 \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u0435, \u0430 \u043d\u0430 \u043d\u0438\u0436\u043d\u0435\u043c \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432, \u0442\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u044d\u043f\u0441\u0438\u043b\u043e\u043d-\u0436\u0430\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f. \u0418 \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u043d\u043e \u043a \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u043c\u0443 \u0443\u0440\u043e\u0432\u043d\u044e. \u0421 \u0442\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u043c \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u0433\u0435\u043d\u0442 \u0441\u043e\u0436\u0430\u043b\u0435\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0441\u0430\u043c\u044b\u0435 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u2013 \u0442\u0430\u043a \u0447\u0442\u043e \u0442\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u043c \u0441\u043b\u0443\u0447\u0430\u044f\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u043c, \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043b\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 k.<\/p>\n<p>  <\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0441\u0442. \u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u0442\u044c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041e\u0434\u043d\u043e \u0438\u0437 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u043e \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u0422.\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u0435\u043c\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u042d\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0438 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0435\u0435 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430, \u0447\u0435\u043c A\/B \u0442\u0435\u0441\u0442\u044b.<\/p>\n<p>  <\/p>\n<p><b>\u0412\u0430\u0436\u043d\u043e! \u0422\u043e\u043c\u043f\u0441\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0435 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c A\/B \u0442\u0435\u0441\u0442\u044b. \u041e\u0431\u044b\u0447\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0445\u043e\u0434\u044f\u0442 \u043b\u0443\u0447\u0448\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0438 \u043f\u043e\u0442\u043e\u043c \u0434\u0435\u043b\u0430\u044e\u0442 A\/B \u0442\u0435\u0441\u0442\u044b \u0443\u0436\u0435 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438.<\/b><\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/post\/425619\/\"> https:\/\/habr.com\/post\/425619\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><i>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/towardsdatascience.com\/solving-multiarmed-bandits-a-comparison-of-epsilon-greedy-and-thompson-sampling-d97167ca9a50\">Solving multiarmed bandits: A comparison of epsilon-greedy and Thompson sampling<\/a>.<\/i><\/p>\n<h1>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e \u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u043e\u043c \u0431\u0430\u043d\u0434\u0438\u0442\u0435<\/h1>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e \u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u043e\u043c \u0431\u0430\u043d\u0434\u0438\u0442\u0435 \u2013 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0443\u043a\u0435 \u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u0443c\u043b\u043e\u0432\u0438\u044f\u0445 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0421\u0430\u043c\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u00ab\u043c\u043d\u043e\u0433\u043e\u0440\u0443\u043a\u0438\u0439 \u0431\u0430\u043d\u0434\u0438\u0442\u00bb \u043f\u043e\u0448\u043b\u043e \u043e\u0442 \u0441\u0442\u0430\u0440\u044b\u0445 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0440\u0443\u0447\u0435\u043a. \u042d\u0442\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u043e\u0437\u0432\u0438\u0449\u0435 \u00ab\u0431\u0430\u043d\u0434\u0438\u0442\u044b\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043d\u0438\u043c\u0438 \u043b\u044e\u0434\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043e\u0433\u0440\u0430\u0431\u043b\u0435\u043d\u043d\u044b\u043c\u0438. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0445 \u043c\u0430\u0448\u0438\u043d \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u0448\u0430\u043d\u0441 \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0440\u0430\u0437\u043d\u044b\u0439. \u0420\u0430\u0437 \u0443\u0436 \u043c\u044b \u0432\u0437\u044f\u043b\u0438\u0441\u044c \u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0443 \u043a\u0430\u043a\u043e\u0439 \u044d\u0442\u043e\u0442 \u0448\u0430\u043d\u0441 \u0432\u044b\u0448\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (exploit) \u044d\u0442\u0443 \u043c\u0430\u0448\u0438\u043d\u0443 \u0447\u0430\u0449\u0435, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u043a\u0430\u043a \u043d\u0430\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438? \u042d\u0442\u043e \u043d\u0435 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u044d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c (\u0432 \u0447\u0438\u0441\u043b\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0445\u043e\u0434\u044f\u0442 \u0438 \u0440\u0435\u043a\u043b\u0430\u043c\u0430, \u0441\u0430\u0439\u0442\u044b, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f) \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0435\u043a\u043e\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u0437\u0430\u0434\u0430\u043d\u0438\u0435 (\u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044e, \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440.)<\/p>\n<p>  <\/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-290435","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290435","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=290435"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290435\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}