{"id":474826,"date":"2025-09-12T21:03:55","date_gmt":"2025-09-12T21:03:55","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=474826"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=474826","title":{"rendered":"<span>\u0414\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043a\u0430\u043a \u043c\u0435\u0440\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0432\u0430\u0448\u0435\u0439 \u043f\u0438\u043b\u043e\u0442\u043d\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0425\u0430\u0431\u0440, \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u041d\u0438\u043a\u0438\u0442\u0430 \u0438 \u0415\u0433\u043e\u0440, \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0439 \u0432 \u0434\u0438\u0440\u0435\u043a\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u04255. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430-\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0448\u0430 \u043f\u0438\u043b\u043e\u0442\u043d\u0430\u044f \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0438 \u043a\u0430\u043a\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u00ab\u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438\u00bb.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0432 \u044d\u043f\u043e\u0445\u0443 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 A\/B \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u0438\u0437 \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u04255, \u0438 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u043e\u0431 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0438\u0445 \u0431\u0438\u0437\u043d\u0435\u0441-\u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0430\u043b\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u043a (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u043a\u0443\u043f\u0438 \u0448\u043e\u043a\u043e\u043b\u0430\u0434 \u0425, \u043f\u043e\u043b\u0443\u0447\u0438 Y \u0431\u0430\u043b\u043b\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438\u00bb). \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0430\u043b\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u043d\u0430 \u0432\u0441\u0435\u043c \u0430\u0441\u0441\u043e\u0440\u0442\u0438\u043c\u0435\u043d\u0442\u0435 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u043d\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0438\u043b\u043e\u0442\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u043a.\u00a0<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u043a\u0443: \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442 \u0431\u0438\u0437\u043d\u0435\u0441\u0430-\u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 1 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430 \u043c\u0435\u0445\u0430\u043d\u0438\u043a:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u044d\u0448\u0431\u044d\u043a X% \u043d\u0430 \u043f\u043e\u043a\u0443\u043f\u043a\u0443 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0438 \u043e\u0432\u043e\u0449\u0435\u0439<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u044d\u0448\u0431\u044d\u043a X% \u043d\u0430 \u0448\u0432\u0435\u0439\u0446\u0430\u0440\u0441\u043a\u0438\u0439 \u0448\u043e\u043a\u043e\u043b\u0430\u0434<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u044d\u0448\u0431\u044d\u043a X% \u043d\u0430 \u0445\u043b\u0435\u0431\u043e\u0431\u0443\u043b\u043e\u0447\u043d\u044b\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0430 \u043a\u0430\u043a\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0432\u044b\u0431\u0440\u0430\u0442\u044c. \u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u0447\u0435\u0440\u0435\u0441\u0447\u0443\u0440 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0430 \u0443\u0437\u043a\u0438\u0439 \u043f\u0443\u043b \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u00ab\u043f\u0440\u0435\u043c\u0438\u0443\u043c\u00bb \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u041c\u044b \u0436\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0443\u044e \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0446\u0435\u043b\u043e\u043c.\u00a0<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u0430 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0438\u043b\u043e\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0442\u043e\u0432\u0430\u0440\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0441\u0445\u043e\u0436\u0430 \u0441\u043e \u0432\u0441\u0435\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432\u0430\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. <strong>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u0442\u0440\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0445\u043e\u0436\u0435\u0441\u0442\u0438 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c\u044e, \u043c\u044b \u043e\u0442\u0441\u0435\u0435\u043c \u0434\u0432\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u0443\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0417\u0430 \u0441\u0447\u0435\u0442 \u043e\u0442\u0431\u043e\u0440\u0430 \u0441\u0430\u043c\u043e\u0439 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d.<\/strong><\/p>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u00a0<\/h2>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043e\u0446\u0435\u043d\u043a\u0438 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0437\u043d\u0430\u043d\u0438\u044f\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0438\u043b\u043e\u0442\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u043e\u0439. \u0421\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0443: \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0445\u043e\u0436\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0438\u043b\u043e\u0442\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438? \u0414\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0443\u0436\u043d\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430.\u00a0 \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043c\u0435\u0442\u0440\u0438\u043a\u0443, \u0438 \u044d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<ol>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0439 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f\u043c \u043f\u043e \u043c\u0435\u0440\u0430\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u0438, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0435\u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u043e\u0433\u0434\u0430, \u0435\u0441\u043b\u0438 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043f\u043e \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0435, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0438\u043b\u043e\u0442\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u044d\u043a\u0441\u0442\u0440\u0430\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u043b\u0438\u0437\u043a\u043e\u043c \u043a \u043d\u0443\u043b\u044e) \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c. \u0410 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u0430\u0441\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e\u0439 1, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0447\u0442\u043e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c.\u00a0<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c, \u0442\u0430\u043a\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0435\u0441\u0442\u044c \u2013 \u0438 \u044d\u0442\u043e JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f (Jensen-Shannon divergence).<\/p>\n<h2>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438\u00a0<\/h2>\n<p>\u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u0430 KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 (Kullback\u2013Leibler divergence). \u0414\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f KL \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043a\u0430\u043a \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044f. \u0421\u0442\u0440\u043e\u0433\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0435: KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u043e\u0431\u044a\u0451\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u043e\u0439, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a D(P||Q), \u0433\u0434\u0435 P \u0438 Q \u2013 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u044f\u0434\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432:\u00a0<\/p>\n<ol>\n<li>\n<p>\u041d\u0435\u0441\u0441\u0438\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430,\u00a0\u00a0\u00a0<img decoding=\"async\" class=\"formula inline\" source=\"D_{KL} (P||Q)  \\ne D_{KL}(Q||P).\" alt=\"D_{KL} (P||Q)  \\ne D_{KL}(Q||P).\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d83\/249\/1b4\/d832491b4c3035536a070a5d3f1c141f.svg\" width=\"224\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d83\/249\/1b4\/d832491b4c3035536a070a5d3f1c141f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d83\/249\/1b4\/d832491b4c3035536a070a5d3f1c141f.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0433\u0440\u0430\u043d\u0438\u0446.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043a\u0430\u0436\u0435\u043c \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0432\u0435 \u0441\u0442\u043e\u043b\u0431\u0447\u0430\u0442\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b P \u0438 Q, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e \u043e\u0441\u0438 Y \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0410, \u0412 \u0438 \u0421 (\u0440\u0438\u0441. 1). \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.\u00a0<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/55b\/311\/d96\/55b311d96c605e0fc6aafc01153de8eb.png\" width=\"1108\" height=\"546\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/55b\/311\/d96\/55b311d96c605e0fc6aafc01153de8eb.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/55b\/311\/d96\/55b311d96c605e0fc6aafc01153de8eb.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><em>\u0420\u0438\u0441.1 \u0421\u0442\u043e\u043b\u0431\u0447\u0430\u0442\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u044b\u00a0<\/em><\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0438\u043d\u043e\u0432. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0431\u0438\u043d\u043e\u0432. \u0422\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0410 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0410 <img decoding=\"async\" class=\"formula inline\" source=\"=\" alt=\"=\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4\/43\/43e\/43ec3e5dee6e706af7766fffea512721.svg\" width=\"12\" height=\"12\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4\/43\/43e\/43ec3e5dee6e706af7766fffea512721.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4\/43\/43e\/43ec3e5dee6e706af7766fffea512721.svg 781w\" loading=\"lazy\" decode=\"async\"\/> <img decoding=\"async\" class=\"formula inline\" source=\"50 \/ 50=1\" alt=\"50 \/ 50=1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1db\/610\/212\/1db6102127e7d82e8aea5b9d7a8a9c38.svg\" width=\"85\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1db\/610\/212\/1db6102127e7d82e8aea5b9d7a8a9c38.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1db\/610\/212\/1db6102127e7d82e8aea5b9d7a8a9c38.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, \u0434\u043b\u044f \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u0431\u0438\u043d\u0430 \u0412<img decoding=\"async\" class=\"formula inline\" source=\"=\" alt=\"=\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6e2\/75b\/ad5\/6e275bad58ca7a0d2da678ed7e20c7a2.svg\" width=\"15\" height=\"10\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6e2\/75b\/ad5\/6e275bad58ca7a0d2da678ed7e20c7a2.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6e2\/75b\/ad5\/6e275bad58ca7a0d2da678ed7e20c7a2.svg 781w\" loading=\"lazy\" decode=\"async\"\/><img decoding=\"async\" class=\"formula inline\" source=\"10 \/ 40=0,25,\" alt=\"10 \/ 40=0,25,\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad8\/b82\/695\/ad8b82695623f083d181d8d6ae77ae73.svg\" width=\"119\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad8\/b82\/695\/ad8b82695623f083d181d8d6ae77ae73.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad8\/b82\/695\/ad8b82695623f083d181d8d6ae77ae73.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0434\u043b\u044f \u0441\u0438\u043d\u0435\u0433\u043e \u0410<img decoding=\"async\" class=\"formula inline\" source=\"=\" alt=\"=\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f11\/e6c\/588\/f11e6c588cb95e767d18771bd362d254.svg\" width=\"15\" height=\"10\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f11\/e6c\/588\/f11e6c588cb95e767d18771bd362d254.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f11\/e6c\/588\/f11e6c588cb95e767d18771bd362d254.svg 781w\" loading=\"lazy\" decode=\"async\"\/><img decoding=\"async\" class=\"formula inline\" source=\"40 \/ 10=4\" alt=\"40 \/ 10=4\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/125\/01e\/9cc\/12501e9ccf1d846e752bd237973a868d.svg\" width=\"85\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/125\/01e\/9cc\/12501e9ccf1d846e752bd237973a868d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/125\/01e\/9cc\/12501e9ccf1d846e752bd237973a868d.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.\u00a0 \u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043f\u043e\u043b\u0443\u0447\u0438\u043c <img decoding=\"async\" class=\"formula inline\" source=\"(1+0,25+4) \/ 3 = 1,75\" alt=\"(1+0,25+4) \/ 3 = 1,75\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fa4\/432\/214\/fa44322142cd875126bda16c32b8667a.svg\" width=\"204\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fa4\/432\/214\/fa44322142cd875126bda16c32b8667a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fa4\/432\/214\/fa44322142cd875126bda16c32b8667a.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. \u0422\u0430\u043a\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c: \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u0441\u0430\u043c\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u0431\u0438\u043d\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e, \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u043d\u044b \u0441\u0442\u043e\u044f\u0442 \u0432 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435, \u0430 \u043a\u0430\u043a\u0438\u0435 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u2013 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c, \u043e\u0442\u0441\u044e\u0434\u0430 \u0432\u044b\u0442\u0435\u043a\u0430\u0435\u0442 \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u0414\u043b\u044f \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u0441\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043a\u0430\u0436\u0434\u0443\u044e \u0434\u0440\u043e\u0431\u044c \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430. \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0431\u0438\u043d\u043e\u0432 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0435\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u043d\u0430 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0445.\u00a0 \u0422\u043e\u0433\u0434\u0430 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/p>\n<p>\u0414\u043b\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"          D_ {KL}(P||Q)=\\sum P(x) * log \\frac{P(x)} {Q(x)}\" alt=\"          D_ {KL}(P||Q)=\\sum P(x) * log \\frac{P(x)} {Q(x)}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bc4\/efc\/50b\/bc4efc50b088b7575e6fdf6fefaf8162.svg\" width=\"287\" height=\"50\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bc4\/efc\/50b\/bc4efc50b088b7575e6fdf6fefaf8162.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bc4\/efc\/50b\/bc4efc50b088b7575e6fdf6fefaf8162.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0414\u043b\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"D_ {KL}(P||Q)=\\int P(x) * log \\frac{P(x)} {Q(x)} \" alt=\"D_ {KL}(P||Q)=\\int P(x) * log \\frac{P(x)} {Q(x)} \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/891\/162\/c6b\/891162c6b67453f8e73c68d75f27cb26.svg\" width=\"277\" height=\"50\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/891\/162\/c6b\/891162c6b67453f8e73c68d75f27cb26.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/891\/162\/c6b\/891162c6b67453f8e73c68d75f27cb26.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b\u0438 \u0431\u044b \u043d\u0435 P c Q, \u0430 Q \u0441 P:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"D_ {KL}(Q||P)=\\int Q(x) * log \\frac{Q(x)} {P(x)}, \u0442.\u0435. D_{KL}(P||Q) \\ne D_{KL}(Q||P)\" alt=\"D_ {KL}(Q||P)=\\int Q(x) * log \\frac{Q(x)} {P(x)}, \u0442.\u0435. D_{KL}(P||Q) \\ne D_{KL}(Q||P)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ab\/54f\/0d7\/7ab54f0d75ec0a6da79ce8792a29e2ce.svg\" width=\"537\" height=\"50\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ab\/54f\/0d7\/7ab54f0d75ec0a6da79ce8792a29e2ce.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ab\/54f\/0d7\/7ab54f0d75ec0a6da79ce8792a29e2ce.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u0438\u0435 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043e\u0442 KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 P \u0438 Q \u043d\u0435 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c, \u0430 \u0441\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 P \u0438 Q \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"D_{JS}(P||Q)=\\frac {1}{2}D_{KL}(P||q)+\\frac{1}{2}D_{KL}(Q||q), q=\\frac{P+Q}{2}\" alt=\"D_{JS}(P||Q)=\\frac {1}{2}D_{KL}(P||q)+\\frac{1}{2}D_{KL}(Q||q), q=\\frac{P+Q}{2}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/61b\/320\/af1\/61b320af1a1341fe5d25b691d549810b.svg\" width=\"461\" height=\"44\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/61b\/320\/af1\/61b320af1a1341fe5d25b691d549810b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/61b\/320\/af1\/61b320af1a1341fe5d25b691d549810b.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"D_{JS}(P||Q)=\\frac{1}{2} \\int P(x) * log \\frac{P(x)} {\\frac{P(x)+Q(x)}{2}} +\\frac{1}{2} \\int Q(x)  * log \\frac{Q(x)}{\\frac{P(x)+Q(x)}{2}} =D_{JS}(Q||P)\" alt=\"D_{JS}(P||Q)=\\frac{1}{2} \\int P(x) * log \\frac{P(x)} {\\frac{P(x)+Q(x)}{2}} +\\frac{1}{2} \\int Q(x)  * log \\frac{Q(x)}{\\frac{P(x)+Q(x)}{2}} =D_{JS}(Q||P)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/969\/d15\/38a\/969d1538a53b14665a2e6b5895de9f84.svg\" width=\"681\" height=\"60\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/969\/d15\/38a\/969d1538a53b14665a2e6b5895de9f84.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/969\/d15\/38a\/969d1538a53b14665a2e6b5895de9f84.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0418\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0439. \u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0440\u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430 2 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e 1, \u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0432\u043d\u043e 0. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0442\u043e P=Q, \u0442\u043e\u0433\u0434\u0430:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"\\frac{1}{2} \\int P(x) * log_2 \u00a0\\frac{P(x)}{\\frac{P(x)+Q(x)}{2}} =\\frac{1}{2} \\int P(x) * log_2 \\frac{P(x)}{\\frac{P(x)+P(x)}{2}}=\\frac{1}{2} \\int P(x) * 0=0\" alt=\"\\frac{1}{2} \\int P(x) * log_2 \u00a0\\frac{P(x)}{\\frac{P(x)+Q(x)}{2}} =\\frac{1}{2} \\int P(x) * log_2 \\frac{P(x)}{\\frac{P(x)+P(x)}{2}}=\\frac{1}{2} \\int P(x) * 0=0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f1f\/870\/a4b\/f1f870a4bffa8b902483449b5c6f7d0c.svg\" width=\"636\" height=\"60\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f1f\/870\/a4b\/f1f870a4bffa8b902483449b5c6f7d0c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f1f\/870\/a4b\/f1f870a4bffa8b902483449b5c6f7d0c.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u043a\u0430\u043a <img decoding=\"async\" class=\"formula inline\" source=\"P(x)\u22650 \" alt=\"P(x)\u22650 \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/287\/100\/498\/287100498d6201aac3a6e6fce0cfc3e9.svg\" width=\"77\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/287\/100\/498\/287100498d6201aac3a6e6fce0cfc3e9.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/287\/100\/498\/287100498d6201aac3a6e6fce0cfc3e9.svg 781w\" loading=\"lazy\" decode=\"async\"\/>\u0438 <img decoding=\"async\" class=\"formula inline\" source=\"Q(x)\u22650\" alt=\"Q(x)\u22650\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c5c\/529\/a21\/c5c529a21f5b78522a4624fb908d348e.svg\" width=\"78\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c5c\/529\/a21\/c5c529a21f5b78522a4624fb908d348e.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c5c\/529\/a21\/c5c529a21f5b78522a4624fb908d348e.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, \u0442\u043e:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"\\frac{1}{2} \\int P(x) * log_2 \\frac{P(x)}{\\frac{P(x)+Q(x)}{2}} =\\frac{1}{2} \\int Px * (1 + log_2\\frac{P(x)}{P(x)+Q(x)} )\" alt=\"\\frac{1}{2} \\int P(x) * log_2 \\frac{P(x)}{\\frac{P(x)+Q(x)}{2}} =\\frac{1}{2} \\int Px * (1 + log_2\\frac{P(x)}{P(x)+Q(x)} )\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/71b\/0a2\/335\/71b0a23356e7650b95c0b34d3b3278f7.svg\" width=\"527\" height=\"60\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/71b\/0a2\/335\/71b0a23356e7650b95c0b34d3b3278f7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/71b\/0a2\/335\/71b0a23356e7650b95c0b34d3b3278f7.svg 781w\" loading=\"lazy\" decode=\"async\"\/><img decoding=\"async\" class=\"formula\" source=\"\\frac{1}{2}\\int P(x) * (1 + log_2\\frac{P(x)}{P(x)+Q(x)})\u2264 \\frac{1}{2}\\int P(x) \u2264 \\frac{1}{2} \" alt=\"\\frac{1}{2}\\int P(x) * (1 + log_2\\frac{P(x)}{P(x)+Q(x)})\u2264 \\frac{1}{2}\\int P(x) \u2264 \\frac{1}{2} \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/254\/c62\/f6d\/254c62f6d848bb14a8b5cfd5dae336bf.svg\" width=\"450\" height=\"50\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/254\/c62\/f6d\/254c62f6d848bb14a8b5cfd5dae336bf.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/254\/c62\/f6d\/254c62f6d848bb14a8b5cfd5dae336bf.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u0435\u0435\u043c \u0434\u0432\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438, \u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 1, \u043a\u043e\u0433\u0434\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"P(x)\u2260Q(x)\" alt=\"P(x)\u2260Q(x)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/54d\/346\/a2d\/54d346a2dffd712ea4c5c870bf578f62.svg\" width=\"109\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/54d\/346\/a2d\/54d346a2dffd712ea4c5c870bf578f62.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/54d\/346\/a2d\/54d346a2dffd712ea4c5c870bf578f62.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<ol>\n<li>\n<p>JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430 \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 [0,1].<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f JS = 1, \u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0438 \u043f\u0438\u043b\u043e\u0442\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438. \u0415\u0441\u043b\u0438 JS = 0, \u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438. \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u0442\u0435\u043e\u0440\u0438\u044f, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043d\u0430 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f, \u043a\u0430\u043a \u044d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0440\u0430\u0437\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f, \u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.\u00a0<\/p>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438<\/h2>\n<p>\u0414\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f KL \u0438 JS \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043a\u0435\u0439\u0441\u0430: \u0410\/\u0410 \u0442\u0435\u0441\u0442\u044b \u0438 \u0410\/\u0411 \u0442\u0435\u0441\u0442\u044b \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438, \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0438 \u0434\u0440.<\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0431\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439:\u00a0<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"bins=\\max(len(data1), len(data2)) ^ \\frac{2}{3},\" alt=\"bins=\\max(len(data1), len(data2)) ^ \\frac{2}{3},\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/990\/c1c\/f19\/990c1cf19fb23dce3338910a6e802b4d.svg\" width=\"321\" height=\"29\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/990\/c1c\/f19\/990c1cf19fb23dce3338910a6e802b4d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/990\/c1c\/f19\/990c1cf19fb23dce3338910a6e802b4d.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import numpy as np from scipy.stats import entropy  def KL(data1, data2):     \"\"\"     \u0420\u0430\u0441\u0447\u0435\u0442 KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.          Parameters:     - data1: \u041f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.     - data2: \u0412\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.          Returns:     - kl_divergence_data1_data2: KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0442 data1 \u043a data2.     - kl_divergence_data2_data1: KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0442 data2 \u043a data1.     \"\"\"          # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0431\u0438\u043d\u043e\u0432 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438      bins = max(len(data1), len(data2))     bins = int(bins ** (2 \/ 3))          # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     hist1, bin_edges = np.histogram(data1, bins=bins, density=True)     hist2, _ = np.histogram(data2, bins=bin_edges, density=True)  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b          # \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     p = hist1 \/ hist1.sum()     q = hist2 \/ hist2.sum()          # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u043b\u044c     p = np.clip(p, 1e-10, None)     q = np.clip(q, 1e-10, None)          # \u0420\u0430\u0441\u0447\u0435\u0442 KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e     kl_divergence_data1_data2 = round(np.sum(p * np.log(p \/ q)), 2)     kl_divergence_data2_data1 = round(np.sum(q * np.log(q \/ p)), 2)          return kl_divergence_data1_data2, kl_divergence_data2_data1 <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import numpy as np from scipy.stats import entropy  def JS(data1, data2):     \"\"\"     \u0420\u0430\u0441\u0447\u0435\u0442 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0419\u0435\u043d\u0441\u0435\u043d\u0430 \u2014 \u0428\u0435\u043d\u043d\u043e\u043d\u0430 (Jensen-Shannon divergence) \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.          Parameters:     - data1: \u041f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.     - data2: \u0412\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.          Returns:     - js_divergence: \u0414\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0419\u0435\u043d\u0441\u0435\u043d\u0430 \u2014 \u0428\u0435\u043d\u043d\u043e\u043d\u0430.     \"\"\"          # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0431\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     bins = max(len(data1), len(data2))     bins = int(bins ** (2 \/ 3))          # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     hist1, bin_edges = np.histogram(data1, bins=bins, density=True)     hist2, _ = np.histogram(data2, bins=bin_edges, density=True)  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u0434\u043b\u044f \u0431\u0438\u043d\u043e\u0432          # \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f     p = hist1 \/ hist1.sum()     q = hist2 \/ hist2.sum()          # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u043b\u044c     p = np.clip(p, 1e-10, None)     q = np.clip(q, 1e-10, None)          # \u0420\u0430\u0441\u0447\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f     m = 0.5 * (p + q)          # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0419\u0435\u043d\u0441\u0435\u043d\u0430 \u2014 \u0428\u0435\u043d\u043d\u043e\u043d\u0430     js_divergence = 0.5 * (entropy(p, m, base=2) + entropy(q, m, base=2))          # \u041e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0434\u043e \u0434\u0432\u0443\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439     js_divergence = round(js_divergence, 2)      return js_divergence  # \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f data1 = np.random.normal(0, 1, 1000) data2 = np.random.normal(1, 1, 1000)  js_divergence = JS(data1, data2) print(f'JS divergence: {js_divergence}') <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def plot_divergences(klab_list, klba_list, js_list):     \"\"\"     \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442 \u0442\u0440\u0438 scatter-\u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0439:     - klab_list: KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f A-&gt;B     - klba_list: KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f B-&gt;A     - js_list: Jensen-Shannon \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f          \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 50-\u0433\u043e \u0438 95-\u0433\u043e \u043a\u0432\u0430\u043d\u0442\u0438\u043b\u0435\u0439.     \"\"\"     # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043a\u0432\u0430\u043d\u0442\u0438\u043b\u0435\u0439     klab_q95 = np.quantile(klab_list, 0.95)     klba_q95 = np.quantile(klba_list, 0.95)     js_q95 = np.quantile(js_list, 0.95)      klab_q50 = np.quantile(klab_list, 0.5)     klba_q50 = np.quantile(klba_list, 0.5)     js_q50 = np.quantile(js_list, 0.5)      n_points = len(klab_list)     x_vals = range(n_points)      plt.figure(figsize=(10, 7))      plt.subplot(3, 1, 1)     sns.scatterplot(x=x_vals, y=klab_list, label='kl_ab')     plt.title('KL-divergence (A to B)')     plt.axhline(klab_q95, color='r', linestyle='--', label='95th Quantile')     plt.axhline(klab_q50, color='b', linestyle='--', label='50th Quantile')     plt.legend()      plt.subplot(3, 1, 2)     sns.scatterplot(x=x_vals, y=klba_list, label='kl_ba')     plt.title('KL-divergence (B to A)')     plt.axhline(klba_q95, color='r', linestyle='--', label='95th Quantile')     plt.axhline(klba_q50, color='b', linestyle='--', label='50th Quantile')     plt.legend()      plt.subplot(3, 1, 3)     sns.scatterplot(x=x_vals, y=js_list, label='JS-divergence')     plt.title('Jensen-Shannon Divergence')     plt.axhline(js_q95, color='r', linestyle='--', label='95th Quantile')     plt.axhline(js_q50, color='b', linestyle='--', label='50th Quantile')     plt.legend()      plt.tight_layout()     plt.show() <\/code><\/pre>\n<\/div>\n<\/details>\n<h4>\u0410\/\u0410 \u0442\u0435\u0441\u0442\u044b\u00a0<\/h4>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0410\/\u0410 \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0432\u0443\u0445 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0445 \u0441 \u0441\u0440\u0435\u0434\u043d\u0438\u043c 0, \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0435\u0439 1, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 2000. \u0417\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043e\u0434\u043d\u043e \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439, \u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u043e\u0435, \u043d\u043e \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0438 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 (\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f 1). \u0421\u0434\u0435\u043b\u0430\u0435\u043c 10 000 \u0442\u0430\u043a\u0438\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0440\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044e (\u043d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439) \u0438 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044e. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 2.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f7e\/700\/854\/f7e700854215c2cd4ef226ef31d13eb1.gif\" alt=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 1. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0410\/\u0410 \u0442\u0435\u0441\u0442\u044b\" title=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 1. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0410\/\u0410 \u0442\u0435\u0441\u0442\u044b\" width=\"1000\" height=\"600\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f7e\/700\/854\/f7e700854215c2cd4ef226ef31d13eb1.gif 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f7e\/700\/854\/f7e700854215c2cd4ef226ef31d13eb1.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 1. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0410\/\u0410 \u0442\u0435\u0441\u0442\u044b<\/em><\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 a = np.random.normal(0, 1, 2000)  klab_list = [] klba_list = [] js_list = []  # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 KL \u0438 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0439 \u0434\u043b\u044f 10000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 for k in tqdm(range(10000)):     b = np.random.normal(0, 1, 2000)     kl_ab, kl_ba = KL(a, b)     js = JS(a, b)     klab_list.append(kl_ab)     klba_list.append(kl_ba)     js_list.append(js)  # \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 plot_divergences(klab_list, klba_list, js_list) <\/code><\/pre>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/891\/6c1\/a58\/8916c1a58edc61848f43d14a20110f9a.png\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0410 \u0442\u0435\u0441\u0442\u0430\u0445\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0410 \u0442\u0435\u0441\u0442\u0430\u0445\" width=\"1117\" height=\"773\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/891\/6c1\/a58\/8916c1a58edc61848f43d14a20110f9a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/891\/6c1\/a58\/8916c1a58edc61848f43d14a20110f9a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0410 \u0442\u0435\u0441\u0442\u0430\u0445<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e 95 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0,1. KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u2013 \u043e\u043a\u043e\u043b\u043e 0,95 \u0438 0,4 \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043d\u0430 \u0410\u0410 \u0442\u0435\u0441\u0442\u0430\u0445 \u0434\u0430\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0431\u043b\u0438\u0437\u043a\u043e\u0435 \u043a \u043d\u0443\u043b\u044e, \u043d\u043e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0432\u044b\u0448\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u043f\u043e\u043b\u043d\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u044c\u044e \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u0438\u044f, \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043d\u0430 \u044d\u0442\u043e \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442.<\/p>\n<h4>\u0410\/B \u0442\u0435\u0441\u0442\u044b. \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e.\u00a0<\/h4>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u044e\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u043a\u0443\u043f\u043e\u043b\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0440\u0430\u0437\u044a\u0435\u0437\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 (\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f 2), \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439. \u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u043f\u043e \u043c\u0435\u0440\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 3.\u00a0<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/18a\/330\/7b4\/18a3307b4d16b5bfff5fc854e21686a5.gif\" alt=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 2. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e\" title=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 2. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e\" width=\"1000\" height=\"600\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/18a\/330\/7b4\/18a3307b4d16b5bfff5fc854e21686a5.gif 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/18a\/330\/7b4\/18a3307b4d16b5bfff5fc854e21686a5.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 2. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e<\/em><\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 A\/B \u0442\u0435\u0441\u0442\u0430 \u043f\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 a = np.random.normal(0, 1, 2000)  klab_list = [] klba_list = [] js_list = []  # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 KL \u0438 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0439 \u0434\u043b\u044f 10 000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 for k in tqdm(range(10000)):     b = np.random.normal(0 + k \/ 1000, 1, 2000)          kl_ab, kl_ba = KL(a, b)     js = JS(a, b)          klab_list.append(kl_ab)     klba_list.append(kl_ba)     js_list.append(js)  # \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 plot_divergences(klab_list, klba_list, js_list) <\/code><\/pre>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/398\/42b\/cbb\/39842bcbbd3d31df64ccff08d2f39b75.png\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 3. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 3. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e\" width=\"1110\" height=\"773\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/398\/42b\/cbb\/39842bcbbd3d31df64ccff08d2f39b75.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/398\/42b\/cbb\/39842bcbbd3d31df64ccff08d2f39b75.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 3. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e 95-\u0439 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c \u0434\u043b\u044f JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 0,1. KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 0,5 \u0438 0,6 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0439 \u043a\u0430\u043c\u0435\u043d\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u2013 \u043e\u043d\u0430 \u043d\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<h4>A\/B \u0442\u0435\u0441\u0442\u044b. \u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432.<\/h4>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u044e\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043d\u0430 \u0432\u044b\u0431\u0440\u043e\u0441\u044b. \u041f\u043e \u043c\u0435\u0440\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0432\u044b\u0431\u0440\u043e\u0441\u044b \u0432 \u043b\u0435\u0432\u0443\u044e \u0438 \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043e\u0442 \u0447\u0435\u0433\u043e \u0445\u0432\u043e\u0441\u0442\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0442\u044f\u0436\u0435\u043b\u0435\u0435, \u0447\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 (\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f 4). \u0421\u0434\u0435\u043b\u0430\u0435\u043c 10 \u0442\u044b\u0441. \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 100 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438\u0437 2000 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 4.\u00a0<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9f1\/f70\/83a\/9f1f7083a42303a420c3db02926a9008.gif\" alt=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 3. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432\" title=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 3. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432\" width=\"1000\" height=\"600\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9f1\/f70\/83a\/9f1f7083a42303a420c3db02926a9008.gif 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9f1\/f70\/83a\/9f1f7083a42303a420c3db02926a9008.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 3. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432<\/em><\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 A\/B \u0442\u0435\u0441\u0442\u0430 \u043f\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044e \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 a = np.random.normal(0, 1, 2000)  klab_list = [] klba_list = [] js_list = [] for k in tqdm(range(10000)):      b = np.random.normal(0, 1, 2000-int(k\/100))          b = np.append(b, np.random.normal(10, 1, int(k\/200) ))  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c 5 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 \u0432 b     b = np.append(b, np.random.normal(-10, 1, int(k\/200) ))  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c 5 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 \u0432 b              kl_ab, kl_ba = KL(a, b)     js = JS(a, b)     klab_list.append(kl_ab)     klba_list.append(kl_ba)     js_list.append(js)  plot_divergences(klab_list, klba_list, js_list) <\/code><\/pre>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a28\/cca\/f69\/a28ccaf6923fa023bcee9e9b7faa8f29.png\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432\" width=\"993\" height=\"690\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/a28\/cca\/f69\/a28ccaf6923fa023bcee9e9b7faa8f29.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a28\/cca\/f69\/a28ccaf6923fa023bcee9e9b7faa8f29.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0447\u0435\u0442\u0430, \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u00ab\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00bb \u043d\u0430 \u0432\u044b\u0431\u0440\u043e\u0441\u044b. \u041d\u0430 200-\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0443 \u043d\u0430\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u044b\u0431\u0440\u043e\u0441\u0443 \u0432 \u043b\u0435\u0432\u0443\u044e \u0438 \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u0430 \u0444\u043e\u0440\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u044f\u0436\u0435\u043b\u044b\u0435 \u0445\u0432\u043e\u0441\u0442\u044b.<\/p>\n<h4>\u0410\/B \u0442\u0435\u0441\u0442\u044b. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0434\u0432\u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e \u0444\u043e\u0440\u043c\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u044d\u0441\u043a\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u0443 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0410\/\u0410 \u0442\u0435\u0441\u0442 \u043d\u0430 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e \u0444\u043e\u0440\u043c\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 (\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f 4). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 5.\u00a0<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a2d\/f66\/f09\/a2df66f093a713517775868a72030aa8.gif\" alt=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 4. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e \u0444\u043e\u0440\u043c\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439\" title=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 4. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e \u0444\u043e\u0440\u043c\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439\" width=\"1000\" height=\"600\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a2d\/f66\/f09\/a2df66f093a713517775868a72030aa8.gif 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a2d\/f66\/f09\/a2df66f093a713517775868a72030aa8.gif 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f 4. \u0410\/B \u0442\u0435\u0441\u0442\u044b, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e \u0444\u043e\u0440\u043c\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439<\/em><\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 A\/B \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 <\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f a = np.random.normal(0, 1, 2000)  # \u0421\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 klab_list = [] klba_list = [] js_list = []  # \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0439 \u0438 JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 for k in tqdm(range(10000)):     # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f     b = np.random.exponential(1, 2000)          # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0439 \u0438 JS-\u0434\u0438\u0432\u0435\u0440\u0441\u0438\u0438     kl_ab, kl_ba = KL(a, b)  # \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f KL \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430     js = JS(a, b)            # \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f JS \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430          # \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u043f\u0438\u0441\u043a\u0438     klab_list.append(kl_ab)     klba_list.append(kl_ba)     js_list.append(js)  # \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 plot_divergences(klab_list, klba_list, js_list) <\/code><\/pre>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8bf\/2cd\/f35\/8bf2cdf356645f9620c5ee00bb873921.png\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 5. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 5. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439\" width=\"1106\" height=\"771\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/8bf\/2cd\/f35\/8bf2cdf356645f9620c5ee00bb873921.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8bf\/2cd\/f35\/8bf2cdf356645f9620c5ee00bb873921.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 5. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430 \u0410\/\u0412 \u0442\u0435\u0441\u0442\u0430\u0445, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e \u0444\u043e\u0440\u043c\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438, 95-\u0439 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c \u043e\u043a\u043e\u043b\u043e 0,8. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c 95-\u0439 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 12 \u0438 10 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0417\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0,8 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043b\u0438\u0437\u043a\u043e \u043a 1, \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u043e \u044d\u0442\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430, \u0438 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u044b \u0435\u0451 \u0433\u0440\u0430\u043d\u0438\u0446\u044b. <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u0445 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/p>\n<ol>\n<li>\n<p>KL\/JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043d\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>KL\/JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u0432\u044b\u0431\u0440\u043e\u0441\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p>KL\/JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u043b\u0435\u0436\u0438\u0442 \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 [0,1].<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u043c JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u0430\u0448\u0438\u0445 \u043f\u0438\u043b\u043e\u0442\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e \u0435\u0434\u0438\u043d\u0438\u0446\u044b.<\/p>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u0438\u043c\u0435\u043d\u0430 <strong>\u0430\u0432\u0442\u043e\u0440\u043e\u0432<\/strong> \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430: <a href=\"https:\/\/www.linkedin.com\/in\/nikisumnitelnyy\" rel=\"noopener noreferrer nofollow\">\u041d\u0438\u043a\u0438\u0442\u0430 \u0421\u0443\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439<\/a>, <a href=\"https:\/\/ru.linkedin.com\/in\/egoryano\" rel=\"noopener noreferrer nofollow\">\u0415\u0433\u043e\u0440 \u041a\u0430\u0440\u043d\u0430\u0443\u0445<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/946292\/\"> https:\/\/habr.com\/ru\/articles\/946292\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0425\u0430\u0431\u0440, \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u041d\u0438\u043a\u0438\u0442\u0430 \u0438 \u0415\u0433\u043e\u0440, \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0439 \u0432 \u0434\u0438\u0440\u0435\u043a\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u04255. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u041a\u0443\u043b\u044c\u0431\u0430\u043a\u0430-\u041b\u0435\u0439\u0431\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0448\u0430 \u043f\u0438\u043b\u043e\u0442\u043d\u0430\u044f \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0438 \u043a\u0430\u043a\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u00ab\u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438\u00bb.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0432 \u044d\u043f\u043e\u0445\u0443 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 A\/B \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u0438\u0437 \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u04255, \u0438 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b \u043e\u0431 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0438\u0445 \u0431\u0438\u0437\u043d\u0435\u0441-\u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0430\u043b\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u043a (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u043a\u0443\u043f\u0438 \u0448\u043e\u043a\u043e\u043b\u0430\u0434 \u0425, \u043f\u043e\u043b\u0443\u0447\u0438 Y \u0431\u0430\u043b\u043b\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438\u00bb). \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0430\u043b\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u043d\u0430 \u0432\u0441\u0435\u043c \u0430\u0441\u0441\u043e\u0440\u0442\u0438\u043c\u0435\u043d\u0442\u0435 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u043d\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0438\u043b\u043e\u0442\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u043a.\u00a0<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u043a\u0443: \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442 \u0431\u0438\u0437\u043d\u0435\u0441\u0430-\u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 1 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430 \u043c\u0435\u0445\u0430\u043d\u0438\u043a:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u044d\u0448\u0431\u044d\u043a X% \u043d\u0430 \u043f\u043e\u043a\u0443\u043f\u043a\u0443 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0438 \u043e\u0432\u043e\u0449\u0435\u0439<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u044d\u0448\u0431\u044d\u043a X% \u043d\u0430 \u0448\u0432\u0435\u0439\u0446\u0430\u0440\u0441\u043a\u0438\u0439 \u0448\u043e\u043a\u043e\u043b\u0430\u0434<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u044d\u0448\u0431\u044d\u043a X% \u043d\u0430 \u0445\u043b\u0435\u0431\u043e\u0431\u0443\u043b\u043e\u0447\u043d\u044b\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0430 \u043a\u0430\u043a\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0432\u044b\u0431\u0440\u0430\u0442\u044c. \u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u0447\u0435\u0440\u0435\u0441\u0447\u0443\u0440 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0430 \u0443\u0437\u043a\u0438\u0439 \u043f\u0443\u043b \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u00ab\u043f\u0440\u0435\u043c\u0438\u0443\u043c\u00bb \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u041c\u044b \u0436\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0443\u044e \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0446\u0435\u043b\u043e\u043c.\u00a0<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u0430 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0438\u043b\u043e\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0442\u043e\u0432\u0430\u0440\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0441\u0445\u043e\u0436\u0430 \u0441\u043e \u0432\u0441\u0435\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432\u0430\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. <strong>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u0442\u0440\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0445\u043e\u0436\u0435\u0441\u0442\u0438 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c\u044e, \u043c\u044b \u043e\u0442\u0441\u0435\u0435\u043c \u0434\u0432\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u0443\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0417\u0430 \u0441\u0447\u0435\u0442 \u043e\u0442\u0431\u043e\u0440\u0430 \u0441\u0430\u043c\u043e\u0439 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d.<\/strong><\/p>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u00a0<\/h2>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043e\u0446\u0435\u043d\u043a\u0438 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0437\u043d\u0430\u043d\u0438\u044f\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0438\u043b\u043e\u0442\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u043e\u0439. \u0421\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0443: \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0445\u043e\u0436\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0438\u043b\u043e\u0442\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438? \u0414\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0443\u0436\u043d\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430.\u00a0 \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043c\u0435\u0442\u0440\u0438\u043a\u0443, \u0438 \u044d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<ol>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0439 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f\u043c \u043f\u043e \u043c\u0435\u0440\u0430\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u0438, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0435\u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u043e\u0433\u0434\u0430, \u0435\u0441\u043b\u0438 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043f\u043e \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0435, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0438\u043b\u043e\u0442\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u044d\u043a\u0441\u0442\u0440\u0430\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u043b\u0438\u0437\u043a\u043e\u043c \u043a \u043d\u0443\u043b\u044e) \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c. \u0410 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0434\u0430\u0441\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e\u0439 1, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0447\u0442\u043e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c.\u00a0<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c, \u0442\u0430\u043a\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0435\u0441\u0442\u044c \u2013 \u0438 \u044d\u0442\u043e JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f (Jensen-Shannon divergence).<\/p>\n<h2>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438\u00a0<\/h2>\n<p>\u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u0430 KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 (Kullback\u2013Leibler divergence). \u0414\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f KL \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043a\u0430\u043a \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044f. \u0421\u0442\u0440\u043e\u0433\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0435: KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u043e\u0431\u044a\u0451\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u043e\u0439, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a D(P||Q), \u0433\u0434\u0435 P \u0438 Q \u2013 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u044f\u0434\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432:\u00a0<\/p>\n<ol>\n<li>\n<p>\u041d\u0435\u0441\u0441\u0438\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430,\u00a0\u00a0\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0433\u0440\u0430\u043d\u0438\u0446.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043a\u0430\u0436\u0435\u043c \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0432\u0435 \u0441\u0442\u043e\u043b\u0431\u0447\u0430\u0442\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b P \u0438 Q, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e \u043e\u0441\u0438 Y \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0410, \u0412 \u0438 \u0421 (\u0440\u0438\u0441. 1). \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.\u00a0<\/p>\n<figure class=\"full-width\"><\/figure>\n<p><em>\u0420\u0438\u0441.1 \u0421\u0442\u043e\u043b\u0431\u0447\u0430\u0442\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u044b\u00a0<\/em><\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0438\u043d\u043e\u0432. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0431\u0438\u043d\u043e\u0432. \u0422\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0410 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0410  , \u0434\u043b\u044f \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u0431\u0438\u043d\u0430 \u0412 \u0434\u043b\u044f \u0441\u0438\u043d\u0435\u0433\u043e \u0410.\u00a0 \u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043f\u043e\u043b\u0443\u0447\u0438\u043c . \u0422\u0430\u043a\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c: \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u0441\u0430\u043c\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u0431\u0438\u043d\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e, \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u043d\u044b \u0441\u0442\u043e\u044f\u0442 \u0432 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435, \u0430 \u043a\u0430\u043a\u0438\u0435 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u2013 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c, \u043e\u0442\u0441\u044e\u0434\u0430 \u0432\u044b\u0442\u0435\u043a\u0430\u0435\u0442 \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u0414\u043b\u044f \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u0441\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043a\u0430\u0436\u0434\u0443\u044e \u0434\u0440\u043e\u0431\u044c \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430. \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0431\u0438\u043d\u043e\u0432 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0435\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u043d\u0430 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0445.\u00a0 \u0422\u043e\u0433\u0434\u0430 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/p>\n<p>\u0414\u043b\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<p>\u0414\u043b\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d:<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b\u0438 \u0431\u044b \u043d\u0435 P c Q, \u0430 Q \u0441 P:<\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u0438\u0435 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043e\u0442 KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 P \u0438 Q \u043d\u0435 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c, \u0430 \u0441\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 P \u0438 Q \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439:<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/p>\n<p>\u0418\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0439. \u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0440\u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0430 2 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e 1, \u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0432\u043d\u043e 0. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0442\u043e P=Q, \u0442\u043e\u0433\u0434\u0430:<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u043a\u0430\u043a \u0438 , \u0442\u043e:<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u0435\u0435\u043c \u0434\u0432\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 JS-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438, \u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 1, \u043a\u043e\u0433\u0434\u0430 . \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<ol>\n<li>\n<p>JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430 \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 [0,1].<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f JS = 1, \u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0438 \u043f\u0438\u043b\u043e\u0442\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438. \u0415\u0441\u043b\u0438 JS = 0, \u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438. \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u0442\u0435\u043e\u0440\u0438\u044f, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043d\u0430 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f, \u043a\u0430\u043a \u044d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0440\u0430\u0437\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f, \u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.\u00a0<\/p>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438<\/h2>\n<p>\u0414\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f KL \u0438 JS \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043a\u0435\u0439\u0441\u0430: \u0410\/\u0410 \u0442\u0435\u0441\u0442\u044b \u0438 \u0410\/\u0411 \u0442\u0435\u0441\u0442\u044b \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438, \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0438 \u0434\u0440.<\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0431\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439:\u00a0<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f KL \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import numpy as np from scipy.stats import entropy  def KL(data1, data2):     \"\"\"     \u0420\u0430\u0441\u0447\u0435\u0442 KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.          Parameters:     - data1: \u041f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.     - data2: \u0412\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.          Returns:     - kl_divergence_data1_data2: KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0442 data1 \u043a data2.     - kl_divergence_data2_data1: KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u043e\u0442 data2 \u043a data1.     \"\"\"          # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0431\u0438\u043d\u043e\u0432 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438      bins = max(len(data1), len(data2))     bins = int(bins ** (2 \/ 3))          # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     hist1, bin_edges = np.histogram(data1, bins=bins, density=True)     hist2, _ = np.histogram(data2, bins=bin_edges, density=True)  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b          # \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     p = hist1 \/ hist1.sum()     q = hist2 \/ hist2.sum()          # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u043b\u044c     p = np.clip(p, 1e-10, None)     q = np.clip(q, 1e-10, None)          # \u0420\u0430\u0441\u0447\u0435\u0442 KL-\u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e     kl_divergence_data1_data2 = round(np.sum(p * np.log(p \/ q)), 2)     kl_divergence_data2_data1 = round(np.sum(q * np.log(q \/ p)), 2)          return kl_divergence_data1_data2, kl_divergence_data2_data1 <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f JS \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import numpy as np from scipy.stats import entropy  def JS(data1, data2):     \"\"\"     \u0420\u0430\u0441\u0447\u0435\u0442 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0419\u0435\u043d\u0441\u0435\u043d\u0430 \u2014 \u0428\u0435\u043d\u043d\u043e\u043d\u0430 (Jensen-Shannon divergence) \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.          Parameters:     - data1: \u041f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.     - data2: \u0412\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.          Returns:     - js_divergence: \u0414\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u044f \u0419\u0435\u043d\u0441\u0435\u043d\u0430 \u2014 \u0428\u0435\u043d\u043d\u043e\u043d\u0430.     \"\"\"          # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0431\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     bins = max(len(data1), len(data2))     bins = int(bins ** (2 \/ 3))          # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c     hist1, bin_edges = np.histogram(data1, bins=bins, density=True)     hist2, _ = np.histogram(data2, bins=bin_edges, density=True)  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u0434\u043b\u044f \u0431\u0438\u043d\u043e\u0432          # \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f     p = hist1 \/ hist1.sum()     q = hist2 \/ hist2.sum()          # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u043b\u044c     p = np.clip(p, 1e-10, None)     q = np.clip(q, 1e-10, None)          # \u0420\u0430\u0441\u0447\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f     m = 0.5 * (p + q)          # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0434\u0438\u0432\u0435\u0440\u0433\u0435\u043d\u0446\u0438\u0438 \u0419\u0435\u043d\u0441\u0435\u043d\u0430 \u2014 \u0428\u0435\u043d\u043d\u043e\u043d\u0430     js_divergence = 0.5 * (entropy(p, m, base=2) + entropy(q, m, base=2))          # \u041e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0434\u043e \u0434\u0432\u0443\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439     js_divergence = round(js_divergence, 2)      return js_divergence  # \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f data1 = np.random.normal(0, 1, 1000) data2 = np.random.normal(1, 1, 1000)  js_divergence = JS(data1, data2) print(f'JS divergence: {js_divergence}') <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def plot_divergences(klab_list, klba_list, js_list):     \"\"\"<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-474826","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/474826","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=474826"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/474826\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=474826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=474826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=474826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}