{"id":431341,"date":"2024-09-05T15:01:35","date_gmt":"2024-09-05T15:01:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=431341"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=431341","title":{"rendered":"<span>\u0423\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\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>\u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a \u043f\u0440\u043e\u0441\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <abbr title=\"\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0438\u043b\u0438 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438.\">\u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438<\/abbr> \u0434\u043b\u044f <abbr title=\"\u041c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: 1, 3, 10, \u0438 \u0442.\u0434.\">\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/abbr> \u0438 \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 <abbr title=\"\u041c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: 0.135, 31.4, 289.7, \u0438 \u0442.\u0434.\">\u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d<\/abbr>, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u044d\u0442\u043e. \u041e\u0442\u0432\u0435\u0442 \u2014 \u0434\u0430, \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044e.<\/p>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/strong> \u2014 \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u043b\u0438 \u0431\u044b \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438, \u0447\u0435\u043c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_w\/dp\/uq\/_wdpuqbsf9z2ld-iyrzqcxrfqre.png\" data-src=\"https:\/\/habrastorage.org\/webt\/_w\/dp\/uq\/_wdpuqbsf9z2ld-iyrzqcxrfqre.png\"\/><\/figure>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u043c\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 <abbr title=\"\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c 100 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0433\u043b\u0430\u0437. \u041c\u044b \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.\">100 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439<\/abbr>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0442 1 \u0434\u043e 10. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u0442\u0440\u0451\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439: 0.25, <abbr title=\"\u0412 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044f\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0.50 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0434\u0438\u0430\u043d\u043e\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0443\u0442\u043e\u0447\u043d\u044f\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0.50 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0435\u0434\u0438\u0430\u043d\u043e\u0439 \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438, \u0430 \u043d\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.\">0.50<\/abbr> \u0438 0.75.<\/p>\n<pre><code class=\"python\"># \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c np.random.seed(45)  # \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0442 1 \u0434\u043e 10 data = pd.DataFrame(data=list(np.random.randint(1, 11, size=100)), columns=['values'])  # \u043d\u0430\u0439\u0434\u0451\u043c \u0434\u043b\u0438\u043d\u0443 \u043e\u0441\u0438 X x_length = len(data['values'].value_counts())  # \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 plt.hist(data, lw=2.5, edgecolor='#e5d5ff', color=\"#fbf9ff\", bins=x_length) plt.xticks(np.arange(1, x_length + 1, step=1))  # \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 for percentile in [0.25, 0.50, 0.75]:     plt.axvline(         x=data['values'].quantile(percentile), label=f'{percentile} \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c (\u043d\u0435 \u0442\u043e\u0447\u043d\u044b\u0439)', lw=2.5, color='#ffdb4d', linestyle='--')  # \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0435\u0442\u043a\u0443 plt.grid(visible=False)      # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043b\u0435\u0433\u0435\u043d\u0434\u0443 plt.legend()  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a plt.show() <\/code><\/pre>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/cb\/6c\/k0\/cb6ck0ey_le7dqf-j59khiiqnh8.png\" data-src=\"https:\/\/habrastorage.org\/webt\/cb\/6c\/k0\/cb6ck0ey_le7dqf-j59khiiqnh8.png\"\/><\/figure>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u044f\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 4, 7 \u0438 9. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0442 \u043b\u0438 \u043e\u043d\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439? \u041d\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0432\u0438\u0434.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/strong> \u2014 \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <abbr title=\"\u0410\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u043d\u0430\u0443\u043a\u0438 \u0438 \u0442\u0435\u0445\u043d\u0438\u043a\u0438, \u0433\u0434\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.\">\u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0435\u0439<\/abbr>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0434\u043b\u044f \u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0439\u0434\u0451\u043c \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u043e\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439.<\/p>\n<p>\u041d\u043e \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439 <abbr title=\"C\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.\"><img decoding=\"async\" class=\"formula inline\" source=\"R^2\" alt=\"R^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e\/e3\/e31\/e31b458b48dd58470b662e66b9742071.svg\" width=\"auto\" height=\"auto\"\/><\/abbr>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435. \u041e\u0446\u0435\u043d\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ul>\n<li>\n<p><img decoding=\"async\" class=\"formula inline\" source=\"R^2 = 0\" alt=\"R^2 = 0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e\/e8\/e8d\/e8d5f0deb325d06450a9a414c84e102a.svg\" width=\"auto\" height=\"auto\"\/> \u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u043e\u0431\u0449\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u0443\u044e\u0442 \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" class=\"formula inline\" source=\"R^2 = 1\" alt=\"R^2 = 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/3f\/3f8\/3f87ece10301a89bb33be63bd4afd3a1.svg\" width=\"auto\" height=\"auto\"\/> \u041c\u043e\u0434\u0435\u043b\u044c \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u0442.\u0435. \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" class=\"formula inline\" source=\"R^2 &gt; 0\" alt=\"R^2 &gt; 0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6\/60\/60d\/60d0aef24280dfe87ef812daa3eacb89.svg\" width=\"auto\" height=\"auto\"\/> \u0438 <img decoding=\"async\" class=\"formula inline\" source=\"&lt; 1\" alt=\"&lt; 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c\/ca\/ca2\/ca2715cd13388d75020483476df4dbfa.svg\" width=\"auto\" height=\"auto\"\/> \u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0435\u043c \u0431\u043b\u0438\u0436\u0435 R\u00b2 \u043a 1, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\"># \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 def r2(x, y):     return 1 - (np.mean((x - y) ** 2) \/ np.var(x))  # \u043d\u0430\u0439\u0434\u0451\u043c \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043f\u043e \u043e\u0446\u0435\u043d\u043a\u0430\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 def get_best_polynome(x, y):          best_result = 0     best_polynome = 0          # \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 1, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438 0 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430     for degree in range(1, 11):                  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438         polynome = np.poly1d(np.polyfit(x, y, degree))                  # \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430         results = r2(y, polynome(x))                  # \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442         if results &gt; best_result and results &lt; 1:             best_result = results             best_polynome = polynome          return best_polynome, best_result  # \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043e\u0441\u044c X x_data = range(1, x_length + 1)  # \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043e\u0441\u044c Y (\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0438\u0434\u0443\u0442 \u0432\u0440\u0430\u0437\u043d\u043e\u0431\u043e\u0439) y_data = list(data['values'].value_counts().sort_index())  # \u043d\u0430\u0439\u0434\u0451\u043c \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439, \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e best_polynome, best_score = get_best_polynome(x_data, y_data)  print(f'\u041b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438: {best_polynome.order}\\n\u041b\u0443\u0447\u0448\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430: {str(best_score)[:4]}')  # \u041b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438: 8 # \u041b\u0443\u0447\u0448\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430: 0.99 <\/code><\/pre>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043d\u043e, \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e 8. \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0433\u0438\u0431\u043e\u0432 \u0443 \u043b\u0438\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0442\u043e\u0447\u043d\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0431\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u043f\u0440\u044f\u043c\u0430\u044f, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u043e\u0442 \u0442\u043e\u0447\u043a\u0438 A \u0434\u043e \u0442\u043e\u0447\u043a\u0438 B \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0438\u0437\u0433\u0438\u0431\u0430.<\/p>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u044f\u043c\u0430\u044f \u0431\u044b\u043b\u0430 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0430\u0434\u043a\u0430\u044f, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c\u0438, \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a, \u0432\u0435\u0434\u044c \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 10 \u0442\u043e\u0447\u0435\u043a, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043b\u043e\u043c\u0430\u043d\u043d\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0435\u0440\u0435\u043b\u043e\u043c\u0430 \u043b\u0438\u043d\u0438\u0438.<\/p>\n<pre><code class=\"python\"># \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 coefficients = np.poly1d(np.polyfit(x_data, y_data, best_polynome.order))  # \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c 10000 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u043e\u0447\u043a\u0435\u043a \u043e\u0442 1 \u0434\u043e 10 polyline = np.linspace(1, x_length, 10000)  # \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 plt.hist(data, lw=2.5, edgecolor='#ffffff', color=\"#fbf9ff\", bins=x_length) plt.xticks(np.arange(1, x_length + 1, step=1))  # \u0433\u0440\u0430\u0444\u0438\u043a, \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f plt.scatter(x=x_data, y=y_data, label=f'\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435', color='#ffdb4d')  # \u0433\u0440\u0430\u0444\u0438\u043a, \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043b\u0438\u043d\u0438\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 plt.plot(polyline, coefficients(polyline), lw=2.5, label=f'\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c', color='#c2a4f4')  # \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0435\u0442\u043a\u0443 plt.grid(visible=False)  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043b\u0435\u0433\u0435\u043d\u0434\u0443 plt.legend()  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a plt.show() <\/code><\/pre>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sa\/tl\/84\/satl84vmcanuqr3593wddj2knuo.png\" data-src=\"https:\/\/habrastorage.org\/webt\/sa\/tl\/84\/satl84vmcanuqr3593wddj2knuo.png\"\/><\/figure>\n<p>\u041f\u043e\u043b\u0438\u043d\u043e\u043c 8 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u2014 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0445 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435 x, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u00abfunction()\u00bb. \u0412\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 for \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u043a\u043b\u0430\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u043b\u0435\u043d\u0430 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430. \u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 coefficients, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u00abfunction()\u00bb \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0451 \u0432 \u00abnormalized_function()\u00bb, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u043e\u0442 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0431\u044b\u043b \u0440\u0430\u0432\u0435\u043d 1. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e function() \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u043e\u0442 lower_limit \u0434\u043e upper_limit, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f function() \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 (\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u0438) \u0440\u0430\u0432\u043d\u044f\u043b\u0430\u0441\u044c 1.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0442\u043e\u0447\u043a\u0435 x, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 x.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 (\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0411\u0440\u0435\u043d\u0442\u0430, brentq) \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f x, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c CDF(x) \u0440\u0430\u0432\u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044e. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0435 x, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442 lower_limit \u0434\u043e x \u0440\u0430\u0432\u0435\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\"># \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435 x def function(x):          result = 0          # \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0432\u043a\u043b\u0430\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u043b\u0435\u043d\u0430 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430     for i in range(len(coefficients) + 1):                  result = result + coefficients[i] * x ** i          return result  # \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u043e\u0442 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0431\u044b\u043b \u0440\u0430\u0432\u0435\u043d 1 def normalized_function(x):          integration, error = quad(function, lower_limit, upper_limit)          result = (1 \/ integration) * function(x)          return result  # \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0442\u043e\u0447\u043a\u0435 x def CDF(x):          integration, error = quad(normalized_function, lower_limit, x)          return integration  # \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0438\u0441\u043a\u043e\u043c\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044e def get_percentile(percentile):          result = brentq(         lambda x: CDF(x) - percentile, lower_limit, upper_limit)          return result  lower_limit = 1 upper_limit = 10  print(f'25-\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c: {get_percentile(0.25)}') # 4.148070830469738 print(f'50-\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c: {get_percentile(0.50)}') # 6.635723812105114 print(f'75-\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c: {get_percentile(0.75)}') # 8.16891812557873 <\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u0441 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0432 4, 7 \u0438 9, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432 4.14, 6.63 \u0438 8.16 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0438 \u0443\u0442\u043e\u0447\u043d\u0451\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\"># \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 plt.hist(data, lw=2.5, edgecolor='#ffffff', color=\"#fbf9ff\", bins=x_length) plt.xticks(np.arange(1, x_length + 1, step=1))  # \u0433\u0440\u0430\u0444\u0438\u043a, \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043b\u0438\u043d\u0438\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 plt.plot(polyline, coefficients(polyline), lw=2.5, color='#c2a4f4')  for percentile in [0.25, 0.50, 0.75]:     plt.axvline(         x=get_percentile(percentile), label=f'{percentile} \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c (\u0442\u043e\u0447\u043d\u044b\u0439)', lw=2.5, color='#ade6b6', linestyle='-')     plt.axvline(         x=data['values'].quantile(percentile), label=f'{percentile} \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c (\u043d\u0435 \u0442\u043e\u0447\u043d\u044b\u0439)', color='#ffdb4d', linestyle='--')  # \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0435\u0442\u043a\u0443 plt.grid(visible=False)  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043b\u0435\u0433\u0435\u043d\u0434\u0443 plt.legend()  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a plt.show() <\/code><\/pre>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nj\/qj\/4_\/njqj4_wf03sakgi9v0x3fh6ku74.png\" data-src=\"https:\/\/habrastorage.org\/webt\/nj\/qj\/4_\/njqj4_wf03sakgi9v0x3fh6ku74.png\"\/><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u0438\u0437\u0443\u0447\u0438\u043b\u0438, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0434\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043b\u0443\u0447\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u044b \u043f\u0440\u043e\u0448\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u044d\u0442\u0430\u043f\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430: \u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0446\u0438\u0438 R\u00b2.<\/p>\n<\/li>\n<li>\n<p>\u041d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430: \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 (PDF), \u043c\u044b \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0435\u0433\u043e, \u0447\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u043e, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0440\u0430\u0432\u0435\u043d 1.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439: \u041c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u0430 \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f (CDF), \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0442\u043e\u0447\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u0448\u0443\u043c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u0434\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u044b\u043c\u0438. \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u0434\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0438 \u043d\u0435\u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c\u0438.<\/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\/841170\/\"> https:\/\/habr.com\/ru\/articles\/841170\/<\/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>\u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a \u043f\u0440\u043e\u0441\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <abbr title=\"\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0438\u043b\u0438 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438.\">\u0438\u044f. \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0438\u043b\u0438 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438.&#187;>\u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b<\/abbr> \u0434\u043b\u044f <abbr title=\"\u041c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: 1, 3, 10, \u0438 \u0442.\u0434.\">\u0447\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: 1, 3, 10, \u0438 \u0442.\u0434.&#187;>\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/abbr> \u0438 \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 <abbr title=\"\u041c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: 0.135, 31.4, 289.7, \u0438 \u0442.\u0434.\">\u0430\u0437\u043e\u043d\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: 0.135, 31.4, 289.7, \u0438 \u0442.\u0434.&#187;>\u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438<\/abbr>, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u044d\u0442\u043e. \u041e\u0442\u0432\u0435\u0442 \u2014 \u0434\u0430, \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044e.<\/p>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/strong> \u2014 \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u043b\u0438 \u0431\u044b \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438, \u0447\u0435\u043c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b.<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u043c\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 <abbr title=\"\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c 100 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0433\u043b\u0430\u0437. \u041c\u044b \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.\">\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0433\u043b\u0430\u0437. \u041c\u044b \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.&#187;>100 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439<\/abbr>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0442 1 \u0434\u043e 10. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u0442\u0440\u0451\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439: 0.25, <abbr title=\"\u0412 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044f\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0.50 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0434\u0438\u0430\u043d\u043e\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0443\u0442\u043e\u0447\u043d\u044f\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0.50 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0435\u0434\u0438\u0430\u043d\u043e\u0439 \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438, \u0430 \u043d\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.\">\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0.50 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0435\u0434\u0438\u0430\u043d\u043e\u0439 \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438, \u0430 \u043d\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.&#187;>0.50<\/abbr> \u0438 0.75.<\/p>\n<pre><code class=\"python\"># \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c np.random.seed(45)  # \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0442 1 \u0434\u043e 10 data = pd.DataFrame(data=list(np.random.randint(1, 11, size=100)), columns=['values'])  # \u043d\u0430\u0439\u0434\u0451\u043c \u0434\u043b\u0438\u043d\u0443 \u043e\u0441\u0438 X x_length = len(data['values'].value_counts())  # \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 plt.hist(data, lw=2.5, edgecolor='#e5d5ff', color=\"#fbf9ff\", bins=x_length) plt.xticks(np.arange(1, x_length + 1, step=1))  # \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 for percentile in [0.25, 0.50, 0.75]:     plt.axvline(         x=data['values'].quantile(percentile), label=f'{percentile} \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c (\u043d\u0435 \u0442\u043e\u0447\u043d\u044b\u0439)', lw=2.5, color='#ffdb4d', linestyle='--')  # \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0435\u0442\u043a\u0443 plt.grid(visible=False)      # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043b\u0435\u0433\u0435\u043d\u0434\u0443 plt.legend()  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a plt.show() <\/code><\/pre>\n<figure class=\"\"><\/figure>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u044f\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 4, 7 \u0438 9. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0442 \u043b\u0438 \u043e\u043d\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439? \u041d\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0432\u0438\u0434.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/strong> \u2014 \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <abbr title=\"\u0410\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u043d\u0430\u0443\u043a\u0438 \u0438 \u0442\u0435\u0445\u043d\u0438\u043a\u0438, \u0433\u0434\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.\">\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.&#187;>\u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0435<\/abbr>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0434\u043b\u044f \u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0439\u0434\u0451\u043c \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u043e\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439.<\/p>\n<p>\u041d\u043e \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439 <abbr title=\"C\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.\">\u043e\u043b\u0438\u043d\u043e\u043c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.&#187;<\/abbr>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435. \u041e\u0446\u0435\u043d\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ul>\n<li>\n<p> \u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u043e\u0431\u0449\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u0443\u044e\u0442 \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p> \u041c\u043e\u0434\u0435\u043b\u044c \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u0442.\u0435. \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p> \u0438  \u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0435\u043c \u0431\u043b\u0438\u0436\u0435 R\u00b2 \u043a 1, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\"># \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 def r2(x, y):     return 1 - (np.mean((x - y) ** 2) \/ np.var(x))  # \u043d\u0430\u0439\u0434\u0451\u043c \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043f\u043e \u043e\u0446\u0435\u043d\u043a\u0430\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 def get_best_polynome(x, y):          best_result = 0     best_polynome = 0          # \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 1, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438 0 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430     for degree in range(1, 11):                  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438         polynome = np.poly1d(np.polyfit(x, y, degree))                  # \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430         results = r2(y, polynome(x))                  # \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442         if results &gt; best_result and results &lt; 1:             best_result = results             best_polynome = polynome          return best_polynome, best_result  # \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043e\u0441\u044c X x_data = range(1, x_length + 1)  # \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043e\u0441\u044c Y (\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0438\u0434\u0443\u0442 \u0432\u0440\u0430\u0437\u043d\u043e\u0431\u043e\u0439) y_data = list(data['values'].value_counts().sort_index())  # \u043d\u0430\u0439\u0434\u0451\u043c \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439, \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e best_polynome, best_score = get_best_polynome(x_data, y_data)  print(f'\u041b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438: {best_polynome.order}\\n\u041b\u0443\u0447\u0448\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430: {str(best_score)[:4]}')  # \u041b\u0443\u0447\u0448\u0438\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438: 8 # \u041b\u0443\u0447\u0448\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430: 0.99 <\/code><\/pre>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043d\u043e, \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e 8. \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u0433\u0438\u0431\u043e\u0432 \u0443 \u043b\u0438\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0442\u043e\u0447\u043d\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0431\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u043f\u0440\u044f\u043c\u0430\u044f, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u043e\u0442 \u0442\u043e\u0447\u043a\u0438 A \u0434\u043e \u0442\u043e\u0447\u043a\u0438 B \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0438\u0437\u0433\u0438\u0431\u0430.<\/p>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u044f\u043c\u0430\u044f \u0431\u044b\u043b\u0430 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0430\u0434\u043a\u0430\u044f, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c\u0438, \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a, \u0432\u0435\u0434\u044c \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 10 \u0442\u043e\u0447\u0435\u043a, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043b\u043e\u043c\u0430\u043d\u043d\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0435\u0440\u0435\u043b\u043e\u043c\u0430 \u043b\u0438\u043d\u0438\u0438.<\/p>\n<pre><code class=\"python\"># \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 coefficients = np.poly1d(np.polyfit(x_data, y_data, best_polynome.order))  # \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c 10000 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0442\u043e\u0447\u043a\u0435\u043a \u043e\u0442 1 \u0434\u043e 10 polyline = np.linspace(1, x_length, 10000)  # \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 plt.hist(data, lw=2.5, edgecolor='#ffffff', color=\"#fbf9ff\", bins=x_length) plt.xticks(np.arange(1, x_length + 1, step=1))  # \u0433\u0440\u0430\u0444\u0438\u043a, \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f plt.scatter(x=x_data, y=y_data, label=f'\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435', color='#ffdb4d')  # \u0433\u0440\u0430\u0444\u0438\u043a, \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043b\u0438\u043d\u0438\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 plt.plot(polyline, coefficients(polyline), lw=2.5, label=f'\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c', color='#c2a4f4')  # \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0435\u0442\u043a\u0443 plt.grid(visible=False)  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043b\u0435\u0433\u0435\u043d\u0434\u0443 plt.legend()  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a plt.show() <\/code><\/pre>\n<figure class=\"\"><\/figure>\n<p>\u041f\u043e\u043b\u0438\u043d\u043e\u043c 8 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u2014 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0445 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435 x, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u00abfunction()\u00bb. \u0412\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 for \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u043a\u043b\u0430\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u043b\u0435\u043d\u0430 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430. \u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 coefficients, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u00abfunction()\u00bb \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0451 \u0432 \u00abnormalized_function()\u00bb, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u043e\u0442 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0431\u044b\u043b \u0440\u0430\u0432\u0435\u043d 1. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e function() \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u043e\u0442 lower_limit \u0434\u043e upper_limit, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f function() \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 (\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u0438) \u0440\u0430\u0432\u043d\u044f\u043b\u0430\u0441\u044c 1.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0442\u043e\u0447\u043a\u0435 x, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 x.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 (\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0411\u0440\u0435\u043d\u0442\u0430, brentq) \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f x, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c CDF(x) \u0440\u0430\u0432\u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044e. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0435 x, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442 lower_limit \u0434\u043e x \u0440\u0430\u0432\u0435\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0438.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\"># \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435 x def function(x):          result = 0          # \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0432\u043a\u043b\u0430\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u043b\u0435\u043d\u0430 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430     for i in range(len(coefficients) + 1):                  result = result + coefficients[i] * x ** i          return result  # \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u043e\u0442 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0431\u044b\u043b \u0440\u0430\u0432\u0435\u043d 1 def normalized_function(x):          integration, error = quad(function, lower_limit, upper_limit)          result = (1 \/ integration) * function(x)          return result  # \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0442\u043e\u0447\u043a\u0435 x def CDF(x):          integration, error = quad(normalized_function, lower_limit, x)          return integration  # \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0438\u0441\u043a\u043e\u043c\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044e def get_percentile(percentile):          result = brentq(         lambda x: CDF(x) - percentile, lower_limit, upper_limit)          return result  lower_limit = 1 upper_limit = 10  print(f'25-\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c: {get_percentile(0.25)}') # 4.148070830469738 print(f'50-\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c: {get_percentile(0.50)}') # 6.635723812105114 print(f'75-\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c: {get_percentile(0.75)}') # 8.16891812557873 <\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u0441 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0432 4, 7 \u0438 9, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432 4.14, 6.63 \u0438 8.16 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0438 \u0443\u0442\u043e\u0447\u043d\u0451\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\"># \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 plt.hist(data, lw=2.5, edgecolor='#ffffff', color=\"#fbf9ff\", bins=x_length) plt.xticks(np.arange(1, x_length + 1, step=1))  # \u0433\u0440\u0430\u0444\u0438\u043a, \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043b\u0438\u043d\u0438\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 plt.plot(polyline, coefficients(polyline), lw=2.5, color='#c2a4f4')  for percentile in [0.25, 0.50, 0.75]:     plt.axvline(         x=get_percentile(percentile), label=f'{percentile} \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c (\u0442\u043e\u0447\u043d\u044b\u0439)', lw=2.5, color='#ade6b6', linestyle='-')     plt.axvline(         x=data['values'].quantile(percentile), label=f'{percentile} \u041f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c (\u043d\u0435 \u0442\u043e\u0447\u043d\u044b\u0439)', color='#ffdb4d', linestyle='--')  # \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0435\u0442\u043a\u0443 plt.grid(visible=False)  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043b\u0435\u0433\u0435\u043d\u0434\u0443 plt.legend()  # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a plt.show() <\/code><\/pre>\n<figure class=\"\"><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u0438\u0437\u0443\u0447\u0438\u043b\u0438, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0434\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043b\u0443\u0447\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u044b \u043f\u0440\u043e\u0448\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u044d\u0442\u0430\u043f\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430: \u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0446\u0438\u0438 R\u00b2.<\/p>\n<\/li>\n<li>\n<p>\u041d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430: \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 (PDF), \u043c\u044b \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0435\u0433\u043e, \u0447\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u043e, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0440\u0430\u0432\u0435\u043d 1.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439: \u041c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u0430 \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f (CDF), \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442,<\/p>\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-431341","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/431341","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=431341"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/431341\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=431341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=431341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=431341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}