{"id":503789,"date":"2026-11-18T16:13:11","date_gmt":"2026-11-18T13:13:11","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=503789"},"modified":"2026-11-18T16:13:11","modified_gmt":"2026-11-18T13:13:11","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=503789","title":{"rendered":"\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435, \u0435\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u0442\u044b? 150 \u0447\u0438\u0441\u0435\u043b \u0438 Python"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043e\u0434\u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0430: \u0432\u0438\u0437\u0438\u0442\u044b \u0437\u0430 \u0441\u0443\u0442\u043a\u0438. \u0414\u0430\u0442\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438\u0441\u044c, \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0441\u044f. \u0413\u0434\u0435-\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u0442\u0438\u0445 150 \u0447\u0438\u0441\u0435\u043b \u043b\u044e\u0434\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0438 \u0438 \u0443\u0445\u043e\u0434\u0438\u043b\u0438 \u043e\u0442\u0434\u044b\u0445\u0430\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c, \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e?<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e\u0431\u043b\u0430\u0437\u043d: \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u0445 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f\u043c\u0438. \u0422\u043e\u0433\u0434\u0430 \u0434\u0435\u043d\u044c \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u043e\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0437\u0430\u043a\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0440\u0443\u0434\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043a\u043e\u043d\u043e\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430.<\/p>\n<p>\u0414\u043b\u044f \u043e\u043f\u044b\u0442\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c <strong>\u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong> \u043e \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430: \u043f\u043e \u0431\u0443\u0434\u043d\u044f\u043c \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0447\u0430\u0449\u0435, \u043f\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0440\u0435\u0436\u0435. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u043e\u0441\u0442 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438, \u0448\u0443\u043c, \u0434\u0432\u0430 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u0430 \u0438 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0432\u0430\u043b. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0441 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u0430\u043c\u0438 \u0441\u043f\u0440\u044f\u0442\u0430\u043b\u0438.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/12\/00\/ef\/1200ef10d054e10e5bd25ee7b14b5a5c.png\" alt=\"150 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0431\u0435\u0437 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/12\/00\/ef\/1200ef10d054e10e5bd25ee7b14b5a5c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/12\/00\/ef\/1200ef10d054e10e5bd25ee7b14b5a5c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>150 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0431\u0435\u0437 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439<\/figcaption><\/div>\n<\/figure>\n<p><em>\u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043e\u043a. \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u044f.<\/em><\/p>\n<p>\u0412\u0430\u0436\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435: \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0440\u043e\u0432\u043d\u043e \u0441\u0443\u0442\u043a\u0438, \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432 \u043d\u0435\u0442. \u0414\u0430\u0442\u044b \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043b\u0438, \u0430 \u0437\u043d\u0430\u043d\u0438\u0435 \u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0435 \u0441\u0431\u043e\u0440\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438. \u0411\u0435\u0437 \u043d\u0435\u0433\u043e \u0441\u0435\u043c\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0441\u0435\u043c\u044c \u0447\u0430\u0441\u043e\u0432 \u0438\u043b\u0438 \u0441\u0435\u043c\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0438\u0441\u044c 150 \u0447\u0438\u0441\u0435\u043b<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u043e\u043f\u044b\u0442\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f Python 3.12+, NumPy, Pandas \u0438 Matplotlib. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\">import numpy as npimport pandas as pdrng = np.random.default_rng(42)t = np.arange(150)dates = pd.date_range(\"2025-02-05\", periods=150, freq=\"D\")weekly = np.array([1100, 1180, 1140, 1120, 1060, 650, 610])visits = weekly[dates.dayofweek] + 0.9 * t + rng.normal(0, 85, 150)visits[[26, 73, 111]] += [650, -480, 520]truth = pd.DataFrame({\"date\": dates,                      \"visits\": np.maximum(0, np.rint(visits)).astype(int)})truth[[\"visits\"]].to_csv(\"values.csv\", index=False)# \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u0430. \u041a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.y = pd.read_csv(\"values.csv\")[\"visits\"].to_numpy()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>weekly<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0434\u0443\u0442 \u043e\u0442 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430 \u0434\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f. \u0410\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0442 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443, \u0441\u0431\u043e\u0439 \u0438 \u0443\u0434\u0430\u0447\u043d\u0443\u044e \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0441\u0441\u044b\u043b\u043a\u0443. \u041d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0438\u0442\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u043d\u043e \u0432 CSV \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u0430. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043b\u0438 \u0432 \u043d\u0438\u0445 \u0443\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a.<\/p>\n<\/div>\n<\/details>\n<h3>\u0420\u044f\u0434 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0440\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u0440\u043e\u0441\u0442. \u0418\u043d\u0430\u0447\u0435 \u0434\u0432\u0430 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u0431\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0441\u0442\u0443\u0449\u0435\u0433\u043e \u0440\u044f\u0434\u0430.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0440\u044f\u0434 \u0441 \u0435\u0433\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u043e\u0439 \u043a\u043e\u043f\u0438\u0435\u0439. \u0415\u0441\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u043c\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438. \u042d\u0442\u043e \u0438 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, ACF.<\/p>\n<pre><code class=\"python\">def detrend(y):    t = np.arange(len(y))    return y - np.polyval(np.polyfit(t, y, 1), t)def acf(y, max_lag=28):    z = y - y.mean()    return np.array([z[:len(z)-k] @ z[k:] \/ (z @ z)                     for k in range(max_lag + 1)])z = detrend(y)r = acf(z)lags = np.arange(2, 22)period = int(lags[np.argmax(r[lags])])print(period, r[period])  # 7, 0.782197...<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <code>k<\/code>, \u0430 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0434\u0430\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431. \u042d\u0442\u043e <a href=\"https:\/\/www.itl.nist.gov\/div898\/handbook\/eda\/section3\/eda35c.htm\" rel=\"noopener nofollow\">\u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 ACF \u0441 \u043e\u0431\u0449\u0438\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c<\/a>. \u0415\u0441\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>Series.autocorr()<\/code>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f: Pandas \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e \u0434\u0432\u0443\u0445 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u043c\u0438.<\/p>\n<p>\u041b\u0430\u0433 \u043d\u043e\u043b\u044c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c: \u0440\u044f\u0434 \u0438 \u0431\u0435\u0437 \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0441\u0435\u0431\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0434\u0432\u0438\u0433\u0438 \u043e\u0442 2 \u0434\u043e 21 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f. \u0412 \u043e\u043f\u044b\u0442\u0435 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/8a\/c8\/f6\/8ac8f64d7576b42a297be53019484dc0.png\" alt=\"ACF \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/8a\/c8\/f6\/8ac8f64d7576b42a297be53019484dc0.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/8a\/c8\/f6\/8ac8f64d7576b42a297be53019484dc0.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>ACF \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438<\/figcaption><\/div>\n<\/figure>\n<p><em>\u0421\u043b\u0435\u0432\u0430 \u043f\u0438\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 7, 14, 21 \u0438 28 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439. \u0421\u043f\u0440\u0430\u0432\u0430 \u0442\u0435 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f. \u041b\u0430\u0433 28 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0432 \u043f\u043e\u0438\u0441\u043a \u043e\u043d \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442.<\/em><\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 <code>ACF(7) = 0,782<\/code>, <code>ACF(14) = 0,762<\/code>, <code>ACF(21) = 0,738<\/code>. \u041f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u0438\u0434\u043d\u043e. \u041f\u0438\u043a\u0438 \u043d\u0430 \u043a\u0440\u0430\u0442\u043d\u044b\u0445 \u043b\u0430\u0433\u0430\u0445 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b: \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u0430\u0439\u0442 \u0441\u043d\u043e\u0432\u0430 \u0437\u0430\u043d\u044f\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0435\u043c \u0436\u0435. \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0435\u0437\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0438\u0441\u0430\u043d, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <a href=\"https:\/\/itl.nist.gov\/div898\/handbook\/pmc\/section4\/pmc443.htm\" rel=\"noopener nofollow\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 NIST<\/a>.<\/p>\n<h3>\u0412 \u043a\u0430\u043a\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h3>\n<p>\u0420\u0430\u0437\u0440\u0435\u0436\u0435\u043c \u0440\u044f\u0434 \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u043f\u043e \u0441\u0435\u043c\u044c \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0434\u0440\u0443\u0433 \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u043c. \u0423 \u043f\u0435\u0440\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0444\u0430\u0437\u0430 0, \u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 1, \u0437\u0430\u0442\u0435\u043c 2 \u0438 \u0442\u0430\u043a \u0434\u043e 6. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u043e\u043f\u044f\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u044f.<\/p>\n<p>\u042d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0434\u043d\u0438 \u043d\u0435\u0434\u0435\u043b\u0438. \u041f\u043e\u043a\u0430 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0435\u043c\u044c \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0445 \u044f\u0449\u0438\u043a\u043e\u0432.<\/p>\n<pre><code class=\"python\">profile = pd.Series(z).groupby(np.arange(len(y)) % period).median()m = profile.to_numpy()pair_score = (m + np.roll(m, -1)) \/ 2first = int(np.argmin(pair_score))pair = [first, (first + 1) % period]print(pair)  # [3, 4]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041c\u0435\u0434\u0438\u0430\u043d\u0430 \u043d\u0435 \u0434\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0432\u0441\u044e \u0444\u0430\u0437\u0443 \u0434\u043d\u0435\u043c \u0440\u0435\u043a\u043e\u0440\u0434\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0430\u0437\u044b \u0437\u0434\u0435\u0441\u044c 21 \u0438\u043b\u0438 22 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f. \u0418\u0449\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043e\u0441\u0435\u0434\u043d\u044e\u044e \u043f\u0430\u0440\u0443 \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u0434\u0432\u0443\u0445 \u043c\u0435\u0434\u0438\u0430\u043d, \u043f\u0430\u0440\u0430 <code>6, 0<\/code> \u0442\u043e\u0436\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442. <code>np.roll<\/code> \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u0430 \u043d\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 150 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/7f\/e8\/e1\/7fe8e10ecab981a87244a4931caa6ee6.png\" alt=\"\u0420\u044f\u0434, \u0441\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0435\u043c\u044c, \u0438 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0444\u0430\u0437\u0430\u043c\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/7f\/e8\/e1\/7fe8e10ecab981a87244a4931caa6ee6.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/7f\/e8\/e1\/7fe8e10ecab981a87244a4931caa6ee6.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0420\u044f\u0434, \u0441\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0435\u043c\u044c, \u0438 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0444\u0430\u0437\u0430\u043c<\/figcaption><\/div>\n<\/figure>\n<p><em>\u0414\u0432\u0430 \u0442\u0435\u043c\u043d\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043d\u0430 \u0442\u0435\u043f\u043b\u043e\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u0432 \u0434\u0432\u0430 \u043d\u0438\u0437\u043a\u0438\u0445 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0430 \u0441\u043f\u0440\u0430\u0432\u0430. \u0421\u0435\u0440\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0443\u0441\u0442\u044b\u0435: 150 \u043d\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 7.<\/em><\/p>\n<p>\u041c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u0442\u0440\u0435\u043d\u0434\u0430 \u0434\u043b\u044f \u0444\u0430\u0437 3 \u0438 4 \u0440\u0430\u0432\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <code>-331<\/code> \u0438 <code>-401<\/code> \u0432\u0438\u0437\u0438\u0442\u0443. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0437\u0430\u0445 \u043e\u043d\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435. \u0423\u0431\u0435\u0440\u0435\u043c \u0442\u0440\u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u0430, \u0438 \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0430\u0440\u0430 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0442\u043e\u0439 \u0436\u0435. \u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043f\u043e\u043b\u0430\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439, \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0444\u0430\u0437\u044b 3 \u0438 4.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0441\u044f \u0441\u043e \u0441\u0440\u0435\u0434\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0437\u044b 3 \u0438 4 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u0443\u0431\u0431\u043e\u0442\u0435 \u0438 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044e. \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<h3>\u0427\u0438\u0441\u043b\u0430 \u0442\u0435 \u0436\u0435, \u043d\u0435\u0434\u0435\u043b\u044f \u0438\u0441\u0447\u0435\u0437\u043b\u0430<\/h3>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441\u0440\u0435\u0434\u043d\u0435\u0435, \u043c\u0435\u0434\u0438\u0430\u043d\u0430 \u0438 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u0420\u0430\u0437\u0440\u0443\u0448\u0438\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u0441\u0442\u0432\u043e: \u0431\u044b\u0432\u0448\u0430\u044f \u0441\u0443\u0431\u0431\u043e\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0432\u0442\u043e\u0440\u043d\u0438\u043a\u0430\u043c\u0438. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u043e\u0432\u043e\u0434 \u043d\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u044f\u0434 \u00ab\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430\u00bb.<\/p>\n<p>\u041d\u043e \u043e\u0434\u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442. \u0421\u0434\u0435\u043b\u0430\u0435\u043c 4 999. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0437\u0430\u043d\u043e\u0432\u043e \u0443\u0431\u0435\u0440\u0435\u043c \u0442\u0440\u0435\u043d\u0434, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c ACF \u0438 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c <strong>\u043f\u043e \u0432\u0441\u0435\u043c \u043b\u0430\u0433\u0430\u043c \u043e\u0442 2 \u0434\u043e 21<\/strong>. \u041c\u044b \u0432\u0435\u0434\u044c \u0438 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0441\u0430\u043c\u044b\u0439 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043b\u0430\u0433. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044e.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def score(y):    return acf(detrend(y))[lags].max()shuffle_rng = np.random.default_rng(2026)shuffled = shuffle_rng.permutation(y)  # \u0414\u043b\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0441 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439null = np.array([score(shuffle_rng.permutation(y)) for _ in range(4999)])observed = score(y)p = (1 + np.count_nonzero(null &gt;= observed)) \/ (len(null) + 1)print(p, null.max())  # 0.0002, 0.364832...<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/97\/36\/14\/9736149b44a4f95fc6d6f6231c09fc49.png\" alt=\"\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 ACF \u043f\u043e\u0441\u043b\u0435 4999 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/97\/36\/14\/9736149b44a4f95fc6d6f6231c09fc49.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/97\/36\/14\/9736149b44a4f95fc6d6f6231c09fc49.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 ACF \u043f\u043e\u0441\u043b\u0435 4999 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a<\/figcaption><\/div>\n<\/figure>\n<p><em>\u0421\u0442\u043e\u043b\u0431\u0446\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u044b ACF \u0443 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a. \u041e\u0440\u0430\u043d\u0436\u0435\u0432\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430.<\/em><\/p>\n<p>\u041d\u0438 \u043e\u0434\u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0435 \u0434\u043e\u0431\u0440\u0430\u043b\u0430\u0441\u044c \u0434\u043e <code>0,782<\/code>: \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f <code>0,365<\/code>. \u041e\u0446\u0435\u043d\u043a\u0430 \u0441 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u00ab\u043f\u043b\u044e\u0441 \u043e\u0434\u0438\u043d\u00bb \u0440\u0430\u0432\u043d\u0430 <code>1 \/ 5000 = 0,0002<\/code>. \u041d\u043e\u043b\u044c \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0439 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u042d\u0442\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u044d\u0442\u0438\u0445 \u0447\u0438\u0441\u0435\u043b. <strong>\u042d\u0442\u043e \u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435.<\/strong> \u0418\u043d\u0435\u0440\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u043e\u0436\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0445\u043e\u0442\u044f \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0435\u043c\u0443 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0432\u044b\u0434\u0430\u0432\u0430\u043b.<\/p>\n<h3>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h3>\n<p>\u041e\u0434\u0438\u043d seed \u0443\u043c\u0435\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u043c \u043e\u043f\u044b\u0442 \u043f\u043e 300 \u0440\u0430\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u043c\u0435\u043d\u044f\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0448\u0443\u043c. \u0412\u043e\u0437\u044c\u043c\u0435\u043c seed \u043e\u0442 1000 \u0434\u043e 1299, \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u044b \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439, \u0440\u043e\u0441\u0442 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0430\u0437\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0421\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u043f\u0438\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0430 \u043b\u0430\u0433\u0435 7<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u0448\u0443\u043c 85<\/p>\n<\/td>\n<td>\n<p align=\"left\">284 \u0438\u0437 300<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0422\u043e\u0442 \u0436\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u0448\u0443\u043c 170<\/p>\n<\/td>\n<td>\n<p align=\"left\">192 \u0438\u0437 300<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d \u0432 4 \u0440\u0430\u0437\u0430, \u0448\u0443\u043c 170<\/p>\n<\/td>\n<td>\n<p align=\"left\">70 \u0438\u0437 300<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043d\u0435\u0442, \u0448\u0443\u043c 85<\/p>\n<\/td>\n<td>\n<p align=\"left\">11 \u0438\u0437 300<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 16 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u043b\u0430\u0433\u0435 14. \u041f\u0440\u0438 \u0443\u0434\u0432\u043e\u0435\u043d\u043d\u043e\u043c \u0448\u0443\u043c\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u0438\u0441\u044c \u043d\u0430 14 \u0438 21: \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043f\u0438\u043a\u043e\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c, \u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u0441\u043f\u0443\u0442\u0430\u043b\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0441 \u0435\u0433\u043e \u043a\u0440\u0430\u0442\u043d\u044b\u043c\u0438. \u0417\u0430\u0442\u043e \u0435\u0441\u043b\u0438 <strong>\u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434 7<\/strong>, \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0430\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 300 \u043f\u043e\u0432\u0442\u043e\u0440\u0430\u0445 \u043e\u0431\u043e\u0438\u0445 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u041d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0432\u0430\u043b \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c \u0446\u0438\u043a\u043b.<\/p>\n<p>\u041d\u0430 \u0448\u0443\u043c\u0435 <code>argmax<\/code> \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e. \u0423 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430, \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u0437\u0434\u0435\u0441\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442\u00bb \u043c\u044b \u0435\u043c\u0443 \u043d\u0435 \u0434\u0430\u043b\u0438. \u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430, \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u0441\u0435\u0437\u043e\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0441\u0431\u043e\u0439 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435. \u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435, \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 74, \u0438 \u0441\u043e\u0436\u043c\u0435\u043c \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044e. <code>ACF(7)<\/code> \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0439, \u043e\u043a\u043e\u043b\u043e <code>0,765<\/code>, \u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0430\u0440\u0430 \u0441\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0441 <code>3, 4<\/code> \u043d\u0430 <code>2, 3<\/code>. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430 \u0445\u0432\u043e\u0441\u0442 \u043f\u043e\u043f\u0430\u043b \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0437\u043e\u0432\u044b\u0435 \u044f\u0449\u0438\u043a\u0438. \u041a\u0440\u0430\u0441\u0438\u0432\u0430\u044f ACF \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430.<\/p>\n<h3>\u041a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c<\/h3>\n<p>\u041c\u044b \u043d\u0430\u0448\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u043c\u044c \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u0438 \u0434\u0432\u0435 \u043d\u0438\u0437\u043a\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0444\u0430\u0437\u044b. \u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0434\u043d\u0435\u0439?<\/p>\n<p>\u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0438\u0445\u0430\u0435\u0442 \u0432 \u0441\u0443\u0431\u0431\u043e\u0442\u0443 \u0438 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435, \u0438 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0437\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c, \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043f\u043e \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430\u043c \u0438 \u0432\u0442\u043e\u0440\u043d\u0438\u043a\u0430\u043c. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u0435\u043c\u044c \u0444\u0430\u0437 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e, \u0438 \u043d\u0438 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0438 \u043e\u0434\u043d\u0430 ACF \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u0441\u044f. \u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u044f\u043c\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043d\u0430\u0440\u0443\u0436\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u043b\u0438, \u0447\u0442\u043e \u0434\u0432\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0443\u0431\u0431\u043e\u0442\u0435 \u0438 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044e, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0442\u044c: \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0443\u0431\u0431\u043e\u0442\u043e\u0439, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435\u043c. \u042d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430. \u0421\u0430\u043c\u0438 \u0447\u0438\u0441\u043b\u0430 \u0435\u0435 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442. \u0410 \u0443 \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u044b\u043c\u0438 \u043e\u0436\u0438\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u043d\u044f\u043c\u0438.<\/p>\n<p>\u0414\u0430\u0436\u0435 \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u043e\u0439 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u0430\u044f \u0434\u0430\u0442\u0430 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f. \u041d\u0430\u0447\u0430\u0442\u044c \u0442\u0443 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u043f\u043e\u0437\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u0442\u0435\u043c \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c. \u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u0442\u044c \u043c\u0435\u0441\u044f\u0446 \u0438 \u0433\u043e\u0434, \u0443 150 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439. \u041d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0445 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043d\u0430\u0439\u0442\u0438 \u043c\u043e\u0436\u043d\u043e. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e \u043d\u0438\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u0442\u044b \u043d\u0435\u043b\u044c\u0437\u044f. Python \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043b, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u0439\u0442 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043e\u0442\u0434\u044b\u0445\u0430\u0435\u0442. \u0423\u0437\u043d\u0430\u0442\u044c, \u043a\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u043b \u0435\u043c\u0443 \u043e\u0442\u0434\u044b\u0445\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u0438 \u0434\u043d\u0438, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c &#8212; \u0443\u0436\u0435 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043a\u043e\u0434 \u0432 <code>weekends.py<\/code>. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0435\u0433\u043e:<\/p>\n<pre><code class=\"bash\">python -m pip install numpy==2.5.4 pandas==3.0.6 matplotlib==3.11.2python weekends.py<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 CSV, \u0447\u0435\u0442\u044b\u0440\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 PNG \u0438 SVG, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u0412 <code>data\/generator_truth.csv<\/code> \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0434\u043b\u044f \u0441\u0432\u0435\u0440\u043a\u0438, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0435\u0433\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u0442.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3\"\"\"Find a repeating low pair without giving the analyzer any calendar fields.Python 3.12+. Run: python weekends.py --out .All observations are synthetic. The calendar is used only by the generatorand the final audit, never by analyze(). No network access is needed.\"\"\"from __future__ import annotationsimport argparseimport hashlibimport jsonfrom pathlib import Pathimport platformimport matplotlibmatplotlib.use(\"Agg\")import matplotlib.pyplot as pltfrom matplotlib.ticker import MultipleLocatorimport numpy as npimport pandas as pdN = 150SEED = 42SEARCH_LAGS = np.arange(2, 22)PERMUTATIONS = 4_999BACKGROUND = \"#ffffff\"INK = \"#182d3a\"BLUE = \"#256d85\"TEAL = \"#087e82\"ORANGE = \"#c36a36\"MUTED = \"#71818a\"def generate(seed: int = SEED, noise: float = 85, strength: float = 1) -&gt; pd.DataFrame:    \"\"\"A hypothetical site used mostly for work, not measured web analytics.\"\"\"    rng = np.random.default_rng(seed)    t = np.arange(N)    dates = pd.date_range(\"2025-02-05\", periods=N, freq=\"D\")    shape = np.array([1100, 1180, 1140, 1120, 1060, 650, 610])    profile = shape.mean() + strength * (shape - shape.mean())    level = profile[dates.dayofweek] + 0.9 * t    y = level + rng.normal(0, noise, N)    anomalies = np.array([26, 73, 111])    y[anomalies] += [650, -480, 520]    return pd.DataFrame({        \"date\": dates,        \"weekday\": dates.dayofweek,        \"visits\": np.maximum(0, np.rint(y)).astype(int),        \"anomaly\": np.isin(t, anomalies),    })def detrend(y: np.ndarray) -&gt; np.ndarray:    t = np.arange(len(y))    return y - np.polyval(np.polyfit(t, y, 1), t)def acf(y: np.ndarray, max_lag: int = 28) -&gt; np.ndarray:    \"\"\"Global-mean ACF, denominator sum of squares (NIST convention).\"\"\"    y = np.asarray(y, dtype=float)    if y.ndim != 1 or not np.isfinite(y).all():        raise ValueError(\"Expected one finite numeric series\")    if not 0 &lt;= max_lag &lt; len(y):        raise ValueError(\"Lag must be smaller than the series length\")    z = y - y.mean()    denominator = z @ z    if denominator &lt;= np.finfo(float).eps * max(1, y @ y):        raise ValueError(\"ACF is undefined for an effectively constant series\")    return np.correlate(z, z, mode=\"full\")[len(z) - 1:len(z) + max_lag] \/ denominatordef score(y: np.ndarray) -&gt; float:    \"\"\"Repeat the entire selected-lag procedure on each new ordering.\"\"\"    return float(acf(detrend(y), int(SEARCH_LAGS[-1]))[SEARCH_LAGS].max())def low_pair(z: np.ndarray, period: int, positions: np.ndarray | None = None):    if positions is None:        positions = np.arange(len(z))    profile = pd.Series(z).groupby(positions % period).median().reindex(range(period))    values = profile.to_numpy()    # roll is applied to the periodic PROFILE, not to the finite input series.    pair_scores = (values + np.roll(values, -1)) \/ 2    first = int(np.argmin(pair_scores))    return profile, [first, (first + 1) % period], pair_scoresdef analyze(y: np.ndarray) -&gt; dict:    \"\"\"No dates, weekdays, start offset, or anomaly positions enter this code.\"\"\"    y = np.asarray(y, dtype=float)    z = detrend(y)    correlations = acf(z)    period = int(SEARCH_LAGS[np.argmax(correlations[SEARCH_LAGS])])    profile, pair, pair_scores = low_pair(z, period)    return {\"residuals\": z, \"acf\": correlations, \"period\": period,            \"profile\": profile, \"pair\": pair, \"pair_scores\": pair_scores}def permutation_control(y: np.ndarray, count: int = PERMUTATIONS):    rng = np.random.default_rng(2026)    shuffled = rng.permutation(y)    null = np.array([score(rng.permutation(y)) for _ in range(count)])    observed = score(y)    exceedances = int(np.count_nonzero(null &gt;= observed))    return shuffled, null, (1 + exceedances) \/ (count + 1), exceedancesdef inertia_control(count: int = PERMUTATIONS) -&gt; dict:    \"\"\"An aperiodic AR(1) can also reject the random-order reference.\"\"\"    rng = np.random.default_rng(2027)    innovations = rng.normal(0, 85, N + 200)    process = np.zeros(N + 200)    for i in range(1, len(process)):        process[i] = 0.9 * process[i-1] + innovations[i]    y = process[200:]    a = analyze(y)    _, null, p_value, exceedances = permutation_control(y, count)    return {\"model\": \"AR(1)\", \"phi\": 0.9, \"seed\": 2027, \"burn_in\": 200,            \"selected_lag\": a[\"period\"], \"acf_7\": float(a[\"acf\"][7]),            \"T\": score(y), \"permutations\": count, \"null_exceedances\": exceedances,            \"p_random_order\": p_value, \"null_max\": float(null.max())}def stress_test(repeats: int = 300) -&gt; list[dict]:    \"\"\"Sensitivity inside explicitly synthetic models, not field accuracy.\"\"\"    results = []    scenarios = [(\"base\", 85, 1), (\"double_noise\", 170, 1),                 (\"weak_week\", 170, 0.25), (\"no_week\", 85, 0)]    for name, noise, strength in scenarios:        periods = []        pair_given_seven = 0        joint = 0        for seed in range(1000, 1000 + repeats):            y = generate(seed=seed, noise=noise, strength=strength)[\"visits\"].to_numpy()            a = analyze(y)            periods.append(a[\"period\"])            _, pair, _ = low_pair(detrend(y), 7)            pair_given_seven += pair == [3, 4]            joint += a[\"period\"] == 7 and a[\"pair\"] == [3, 4]        results.append({            \"scenario\": name, \"repeats\": repeats, \"noise_sd\": noise,            \"seasonal_strength\": strength,            \"selected_7\": periods.count(7), \"matches_pair_when_period_fixed_to_7\": pair_given_seven,            \"selected_7_and_pair_3_4\": joint,            \"selected_lag_counts\": {str(p): periods.count(p) for p in sorted(set(periods))},        })    return resultsdef verify(y: np.ndarray, answer: dict) -&gt; dict:    \"\"\"Independent identities and destructive controls for the reported sample.\"\"\"    z = detrend(y)    reference = np.array([np.dot(z[:len(z)-k] - z.mean(), z[k:] - z.mean())                          \/ np.sum((z-z.mean())**2) for k in range(29)])    np.testing.assert_allclose(answer[\"acf\"], reference, atol=1e-12)    np.testing.assert_allclose(answer[\"acf\"][0], 1, atol=1e-12)    np.testing.assert_allclose(analyze(y + 800)[\"acf\"], answer[\"acf\"], atol=1e-12)    np.testing.assert_allclose(analyze(y * 3)[\"acf\"], answer[\"acf\"], atol=1e-12)    half_pairs = []    for start, stop in [(0, 75), (75, 150)]:        _, pair, _ = low_pair(detrend(y[start:stop]), 7, np.arange(start, stop))        half_pairs.append(pair)    # Translation ambiguity: change the external date labels, not the values.    starts = [pd.Timestamp(\"2025-02-05\") + pd.Timedelta(days=k) for k in range(7)]    labelings = [[(start.dayofweek + phase) % 7 for phase in answer[\"pair\"]]                 for start in starts]    no_anomalies = generate()    original = no_anomalies[\"visits\"].to_numpy().copy()    original[[26, 73, 111]] -= [650, -480, 520]    _, no_outlier_pair, _ = low_pair(detrend(original), 7)    dropped = np.delete(y, 74)    gap_result = analyze(dropped)    return {\"direct_acf_matches\": True, \"offset_and_scale_invariant\": True,            \"half_pairs_global_phases\": half_pairs,            \"pair_without_anomaly_offsets\": no_outlier_pair,            \"seven_external_weekday_labelings\": labelings,            \"dropped_observation_74\": {\"selected_lag\": gap_result[\"period\"],                                       \"low_pair\": gap_result[\"pair\"],                                       \"acf_7\": float(gap_result[\"acf\"][7])}}def style():    plt.rcParams.update({        \"font.family\": \"DejaVu Sans\", \"font.size\": 12, \"text.color\": INK,        \"axes.labelcolor\": INK, \"axes.edgecolor\": \"#d4dbdc\",        \"axes.spines.top\": False, \"axes.spines.right\": False,        \"axes.spines.left\": False, \"axes.titleweight\": \"bold\",        \"figure.facecolor\": BACKGROUND, \"axes.facecolor\": BACKGROUND,        \"xtick.color\": MUTED, \"ytick.color\": MUTED,        \"grid.color\": \"#dce2e1\", \"grid.linewidth\": 0.7,        \"savefig.facecolor\": BACKGROUND, \"svg.fonttype\": \"none\", \"svg.hashsalt\": \"weekends-150\",    })def save(fig, directory: Path, name: str):    title = {        \"01_series\": \"150 \u0447\u0438\u0441\u0435\u043b. \u041a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u043d.\",        \"02_acf\": \"\u0423 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0435\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c\",        \"03_phases\": \"\u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u044f\u0434 \u043f\u043e \u0441\u0435\u043c\u044c\",        \"04_permutations\": \"4 999 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a. \u0422\u0435 \u0436\u0435 \u0447\u0438\u0441\u043b\u0430, \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.\",    }[name]    description = (\"\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0441\u043e 150 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u043e\u0441\u0442\u0438. \"                   f\"\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Matplotlib {matplotlib.__version__}.\")    for extension in [\"png\", \"svg\"]:        if extension == \"svg\":            metadata = {\"Creator\": None, \"Title\": title, \"Source\": Path(__file__).name,                        \"Description\": description, \"Date\": None}        else:            metadata = {\"Title\": title, \"Description\": description,                        \"Software\": f\"Matplotlib {matplotlib.__version__}\",                        \"Source\": Path(__file__).name}        fig.savefig(directory \/ f\"{name}.{extension}\", dpi=180, metadata=metadata)    plt.close(fig)def figures(y, answer, shuffled, null, directory: Path):    style()    t = np.arange(len(y))    # Figure 1: the anonymous input, with no labels obtained from the generator.    fig, ax = plt.subplots(figsize=(11, 4.5), layout=\"constrained\")    fig.suptitle(\"150 \u0447\u0438\u0441\u0435\u043b. \u041a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u043d.\", x=.04, ha=\"left\", fontsize=21, weight=\"bold\")    ax.plot(t, y, color=BLUE, lw=1.6)    ax.scatter(t, y, s=11, color=BLUE, zorder=3)    ax.set(xlim=(-1, 150), ylim=(0, 2000), xlabel=\"\u041d\u043e\u043c\u0435\u0440 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 0\", ylabel=\"\u0412\u0438\u0437\u0438\u0442\u044b \u0437\u0430 \u0441\u0443\u0442\u043a\u0438\")    ax.grid(axis=\"y\"); ax.xaxis.set_major_locator(MultipleLocator(25))    ax.text(.99, .95, \"\u0421\u0418\u041d\u0422\u0415\u0422\u0418\u0427\u0415\u0421\u041a\u0418\u0415 \u0414\u0410\u041d\u041d\u042b\u0415\", transform=ax.transAxes, ha=\"right\", color=MUTED, fontsize=10)    save(fig, directory, \"01_series\")    # Figure 2: observed vs shuffled ACF; no unjustified pointwise confidence band.    fig, axes = plt.subplots(1, 2, figsize=(11, 4.7), layout=\"constrained\", sharey=True)    fig.suptitle(\"\u0423 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0435\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c\", x=.04, ha=\"left\", fontsize=21, weight=\"bold\")    for ax, values, title, color in zip(axes, [answer[\"acf\"], acf(detrend(shuffled))],                                       [\"\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a\", \"\u041e\u0434\u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\"], [TEAL, MUTED]):        lags = np.arange(1, 29)        ax.vlines(lags, 0, values[1:], color=color, lw=2)        ax.scatter(lags, values[1:], color=color, s=22, zorder=3)        ax.axhline(0, color=INK, lw=.8)        ax.set(title=title, xlabel=\"\u041b\u0430\u0433, \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439\", xlim=(0, 29), ylim=(-.55, 1))        ax.set_xticks([1, 7, 14, 21, 28]); ax.grid(axis=\"y\")    axes[0].set_ylabel(\"ACF \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u0442\u0440\u0435\u043d\u0434\u0430\")    for k in [7, 14, 21, 28]:        axes[0].annotate(f\"{answer['acf'][k]:.2f}\", (k, answer[\"acf\"][k]),                         xytext=(0, 10), textcoords=\"offset points\", ha=\"center\", fontsize=10, color=TEAL)    save(fig, directory, \"02_acf\")    # Figure 3: fold by the recovered period. Missing cells stay missing.    z = answer[\"residuals\"]    period = answer[\"period\"]    padded = np.full(((len(z) + period - 1) \/\/ period) * period, np.nan)    padded[:len(z)] = z    matrix = padded.reshape(-1, period)    fig, axes = plt.subplots(1, 2, figsize=(11, 5.4), layout=\"constrained\", width_ratios=[1, 1.25])    fig.suptitle(\"\u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u044f\u0434 \u043f\u043e \u0441\u0435\u043c\u044c\", x=.04, ha=\"left\", fontsize=21, weight=\"bold\")    cmap = plt.get_cmap(\"BrBG\").copy(); cmap.set_bad(\"#e4e7e5\")    im = axes[0].imshow(matrix, aspect=\"auto\", cmap=cmap, vmin=-550, vmax=550)    axes[0].set(xlabel=\"\u0424\u0430\u0437\u0430: \u043d\u043e\u043c\u0435\u0440 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 7\", ylabel=\"\u0411\u043b\u043e\u043a \u0438\u0437 \u0441\u0435\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439\")    axes[0].set_xticks(range(period)); axes[0].set_yticks([0, 5, 10, 15, 21])    axes[0].set_yticklabels([1, 6, 11, 16, 22])    cbar = fig.colorbar(im, ax=axes[0], orientation=\"horizontal\", pad=.15, shrink=.95)    cbar.set_label(\"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u0442\u0440\u0435\u043d\u0434\u0430, \u0432\u0438\u0437\u0438\u0442\u043e\u0432\", fontsize=10)    profile = answer[\"profile\"].to_numpy()    colors = [ORANGE if i in answer[\"pair\"] else BLUE for i in range(period)]    axes[1].bar(np.arange(period), profile, color=colors, width=.66, zorder=3)    axes[1].axhline(0, color=INK, lw=.8)    axes[1].set(xlabel=\"\u0424\u0430\u0437\u0430: \u043d\u043e\u043c\u0435\u0440 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 7\", ylabel=\"\u041c\u0435\u0434\u0438\u0430\u043d\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f, \u0432\u0438\u0437\u0438\u0442\u043e\u0432\", ylim=(-500, 330))    axes[1].set_xticks(range(period)); axes[1].grid(axis=\"y\")    for i, value in enumerate(profile):        axes[1].text(i, value + (14 if value &gt;= 0 else -15), f\"{value:+.0f}\",                     ha=\"center\", va=\"bottom\" if value &gt;= 0 else \"top\", color=colors[i], fontsize=11)    axes[1].text(.5, .98, \"\u041d\u0438\u0437\u043a\u0430\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u044f\u044f \u043f\u0430\u0440\u0430: 3 \u0438 4\", transform=axes[1].transAxes,                 ha=\"center\", va=\"top\", color=ORANGE, fontsize=12, weight=\"bold\")    save(fig, directory, \"03_phases\")    # Figure 4: distribution of the SAME selected statistic, not just lag seven.    fig, ax = plt.subplots(figsize=(11, 4.5), layout=\"constrained\")    fig.suptitle(\"4 999 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a. \u0422\u0435 \u0436\u0435 \u0447\u0438\u0441\u043b\u0430, \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.\", x=.04, ha=\"left\", fontsize=20, weight=\"bold\")    ax.hist(null, bins=35, color=BLUE, alpha=.9, edgecolor=BACKGROUND)    observed = score(y)    ax.axvline(observed, color=ORANGE, lw=2.5)    ax.text(observed-.02, ax.get_ylim()[1]*.85, f\"\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0440\u044f\u0434\\nT = {observed:.3f}\", ha=\"right\", color=ORANGE, weight=\"bold\")    ax.set(xlabel=\"T = \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f ACF \u043d\u0430 \u043b\u0430\u0433\u0430\u0445 \u043e\u0442 2 \u0434\u043e 21\", ylabel=\"\u0427\u0438\u0441\u043b\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a\", xlim=(-.02, .88))    ax.grid(axis=\"y\"); ax.set_axisbelow(True)    save(fig, directory, \"04_permutations\")def main():    parser = argparse.ArgumentParser(description=__doc__)    parser.add_argument(\"--out\", type=Path, default=Path(__file__).resolve().parent)    parser.add_argument(\"--permutations\", type=int, default=PERMUTATIONS)    parser.add_argument(\"--repeats\", type=int, default=300)    args = parser.parse_args()    if args.permutations &lt; 1 or args.repeats &lt; 1:        parser.error(\"Counts must be positive\")    for directory in [\"data\", \"figures\", \"results\"]:        (args.out \/ directory).mkdir(parents=True, exist_ok=True)    truth = generate()    values_path = args.out \/ \"data\" \/ \"values.csv\"    truth[[\"visits\"]].to_csv(values_path, index=False)    truth.to_csv(args.out \/ \"data\" \/ \"generator_truth.csv\", index=False)    # Reload only the anonymous column. This is the entire analyzer input.    y = pd.read_csv(values_path)[\"visits\"].to_numpy()    answer = analyze(y)    shuffled, null, p_value, exceedances = permutation_control(y, args.permutations)    stress = stress_test(args.repeats)    verification = verify(y, answer)    np.testing.assert_array_equal(np.sort(y), np.sort(shuffled))    np.testing.assert_allclose(y.mean(), shuffled.mean(), atol=1e-12)    np.testing.assert_allclose(y.var(), shuffled.var(), atol=1e-12)    expected = np.flatnonzero(truth.groupby(np.arange(N) % 7)[\"weekday\"].first().to_numpy() &gt;= 5).tolist()    summary = {        \"data\": \"synthetic daily site visits\", \"seed\": SEED, \"n\": len(y),        \"values_sha256\": hashlib.sha256(values_path.read_bytes()).hexdigest(),        \"search_lags\": SEARCH_LAGS.tolist(), \"selected_lag\": answer[\"period\"],        \"acf\": {str(k): float(answer[\"acf\"][k]) for k in [1, 7, 14, 21, 28]},        \"phase_medians\": answer[\"profile\"].to_list(), \"phase_counts\": np.bincount(np.arange(N) % 7).tolist(),        \"low_pair\": answer[\"pair\"], \"generator_weekend_phases\": expected,        \"matches_generator\": answer[\"pair\"] == expected,        \"permutations\": args.permutations, \"permutation_seed\": 2026,        \"null_exceedances\": exceedances, \"p_random_order\": p_value,        \"null_max\": float(null.max()), \"null_quantiles\": np.quantile(null, [.5, .95, .99]).tolist(),        \"single_shuffle_acf_7\": float(acf(detrend(shuffled))[7]),        \"shuffle_preserves_values_mean_variance\": True,        \"stress\": stress, \"inertia_control\": inertia_control(args.permutations),        \"verification\": verification,        \"versions\": {\"python\": platform.python_version(), \"numpy\": np.__version__,                     \"pandas\": pd.__version__, \"matplotlib\": matplotlib.__version__},    }    (args.out \/ \"results\" \/ \"summary.json\").write_text(json.dumps(summary, ensure_ascii=False, indent=2) + \"\\n\", encoding=\"utf-8\")    pd.DataFrame({\"T\": null}).to_csv(args.out \/ \"results\" \/ \"permutation_scores.csv\", index=False)    pd.DataFrame(stress).drop(columns=\"selected_lag_counts\").to_csv(args.out \/ \"results\" \/ \"stress.csv\", index=False)    figures(y, answer, shuffled, null, args.out \/ \"figures\")    print(json.dumps({k: summary[k] for k in [\"selected_lag\", \"low_pair\", \"acf\", \"p_random_order\", \"matches_generator\"]}, ensure_ascii=False, indent=2))    print(f\"Saved data, figures and checks to {args.out.resolve()}\")if __name__ == \"__main__\":    main()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1109446\/\">https:\/\/habr.com\/ru\/articles\/1109446\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043e\u0434\u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0430: \u0432\u0438\u0437\u0438\u0442\u044b \u0437\u0430 \u0441\u0443\u0442\u043a\u0438. \u0414\u0430\u0442\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438\u0441\u044c, \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0441\u044f. \u0413\u0434\u0435-\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u0442\u0438\u0445 150 \u0447\u0438\u0441\u0435\u043b \u043b\u044e\u0434\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0438 \u0438 \u0443\u0445\u043e\u0434\u0438\u043b\u0438 \u043e\u0442\u0434\u044b\u0445\u0430\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c, \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e?\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e\u0431\u043b\u0430\u0437\u043d: \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u0445 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f\u043c\u0438. \u0422\u043e\u0433\u0434\u0430 \u0434\u0435\u043d\u044c \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u043e\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0437\u0430\u043a\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0440\u0443\u0434\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043a\u043e\u043d\u043e\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430.\u0414\u043b\u044f \u043e\u043f\u044b\u0442\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430: \u043f\u043e \u0431\u0443\u0434\u043d\u044f\u043c \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0447\u0430\u0449\u0435, \u043f\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0440\u0435\u0436\u0435. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u043e\u0441\u0442 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438, \u0448\u0443\u043c, \u0434\u0432\u0430 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u0430 \u0438 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0432\u0430\u043b. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0441 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u0430\u043c\u0438 \u0441\u043f\u0440\u044f\u0442\u0430\u043b\u0438.150 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0431\u0435\u0437 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439\u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043e\u043a. \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u044f.\u0412\u0430\u0436\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435: \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0440\u043e\u0432\u043d\u043e \u0441\u0443\u0442\u043a\u0438, \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432 \u043d\u0435\u0442. \u0414\u0430\u0442\u044b \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043b\u0438, \u0430 \u0437\u043d\u0430\u043d\u0438\u0435 \u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0435 \u0441\u0431\u043e\u0440\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438. \u0411\u0435\u0437 \u043d\u0435\u0433\u043e \u0441\u0435\u043c\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0441\u0435\u043c\u044c \u0447\u0430\u0441\u043e\u0432 \u0438\u043b\u0438 \u0441\u0435\u043c\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0430.\u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0438\u0441\u044c 150 \u0447\u0438\u0441\u0435\u043b\u0414\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u043e\u043f\u044b\u0442\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f Python 3.12+, NumPy, Pandas \u0438 Matplotlib. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.import numpy as npimport pandas as pdrng = np.random.default_rng(42)t = np.arange(150)dates = pd.date_range(&#171;2025-02-05&#8243;, periods=150, freq=&#187;D&#187;)weekly = np.array([1100, 1180, 1140, 1120, 1060, 650, 610])visits = weekly[dates.dayofweek] + 0.9 * t + rng.normal(0, 85, 150)visits[[26, 73, 111]] += [650, -480, 520]truth = pd.DataFrame({&#171;date&#187;: dates,                      &#171;visits&#187;: np.maximum(0, np.rint(visits)).astype(int)})truth[[&#171;visits&#187;]].to_csv(&#171;values.csv&#187;, index=False)# \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u0430. \u041a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.y = pd.read_csv(&#171;values.csv&#187;)[&#171;visits&#187;].to_numpy()\u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 weekly \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0434\u0443\u0442 \u043e\u0442 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430 \u0434\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f. \u0410\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0442 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443, \u0441\u0431\u043e\u0439 \u0438 \u0443\u0434\u0430\u0447\u043d\u0443\u044e \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0441\u0441\u044b\u043b\u043a\u0443. \u041d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0438\u0442\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u043d\u043e \u0432 CSV \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u0430. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043b\u0438 \u0432 \u043d\u0438\u0445 \u0443\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a.\u0420\u044f\u0434 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0440\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u0440\u043e\u0441\u0442. \u0418\u043d\u0430\u0447\u0435 \u0434\u0432\u0430 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u0431\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0441\u0442\u0443\u0449\u0435\u0433\u043e \u0440\u044f\u0434\u0430.\u0417\u0430\u0442\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0440\u044f\u0434 \u0441 \u0435\u0433\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u043e\u0439 \u043a\u043e\u043f\u0438\u0435\u0439. \u0415\u0441\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u043c\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438. \u042d\u0442\u043e \u0438 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, ACF.def detrend(y):    t = np.arange(len(y))    return y &#8212; np.polyval(np.polyfit(t, y, 1), t)def acf(y, max_lag=28):    z = y &#8212; y.mean()    return np.array([z[:len(z)-k] @ z[k:] \/ (z @ z)                     for k in range(max_lag + 1)])z = detrend(y)r = acf(z)lags = np.arange(2, 22)period = int(lags[np.argmax(r[lags])])print(period, r[period])  # 7, 0.782197&#8230;\u0417\u0434\u0435\u0441\u044c \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 k, \u0430 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0434\u0430\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431. \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 ACF \u0441 \u043e\u0431\u0449\u0438\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c. \u0415\u0441\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c Series.autocorr(), \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f: Pandas \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e \u0434\u0432\u0443\u0445 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u043c\u0438.\u041b\u0430\u0433 \u043d\u043e\u043b\u044c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c: \u0440\u044f\u0434 \u0438 \u0431\u0435\u0437 \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0441\u0435\u0431\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0434\u0432\u0438\u0433\u0438 \u043e\u0442 2 \u0434\u043e 21 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f. \u0412 \u043e\u043f\u044b\u0442\u0435 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.ACF \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\u0421\u043b\u0435\u0432\u0430 \u043f\u0438\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 7, 14, 21 \u0438 28 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439. \u0421\u043f\u0440\u0430\u0432\u0430 \u0442\u0435 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f. \u041b\u0430\u0433 28 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0432 \u043f\u043e\u0438\u0441\u043a \u043e\u043d \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442.\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 ACF(7) = 0,782, ACF(14) = 0,762, ACF(21) = 0,738. \u041f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u0438\u0434\u043d\u043e. \u041f\u0438\u043a\u0438 \u043d\u0430 \u043a\u0440\u0430\u0442\u043d\u044b\u0445 \u043b\u0430\u0433\u0430\u0445 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b: \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u0430\u0439\u0442 \u0441\u043d\u043e\u0432\u0430 \u0437\u0430\u043d\u044f\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0435\u043c \u0436\u0435. \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0435\u0437\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0438\u0441\u0430\u043d, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 NIST.\u0412 \u043a\u0430\u043a\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0420\u0430\u0437\u0440\u0435\u0436\u0435\u043c \u0440\u044f\u0434 \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u043f\u043e \u0441\u0435\u043c\u044c \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0434\u0440\u0443\u0433 \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u043c. \u0423 \u043f\u0435\u0440\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0444\u0430\u0437\u0430 0, \u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 1, \u0437\u0430\u0442\u0435\u043c 2 \u0438 \u0442\u0430\u043a \u0434\u043e 6. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u043e\u043f\u044f\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u044f.\u042d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0434\u043d\u0438 \u043d\u0435\u0434\u0435\u043b\u0438. \u041f\u043e\u043a\u0430 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0435\u043c\u044c \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0445 \u044f\u0449\u0438\u043a\u043e\u0432.profile = pd.Series(z).groupby(np.arange(len(y)) % period).median()m = profile.to_numpy()pair_score = (m + np.roll(m, -1)) \/ 2first = int(np.argmin(pair_score))pair = [first, (first + 1) % period]print(pair)  # [3, 4]\u041c\u0435\u0434\u0438\u0430\u043d\u0430 \u043d\u0435 \u0434\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0432\u0441\u044e \u0444\u0430\u0437\u0443 \u0434\u043d\u0435\u043c \u0440\u0435\u043a\u043e\u0440\u0434\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0430\u0437\u044b \u0437\u0434\u0435\u0441\u044c 21 \u0438\u043b\u0438 22 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f. \u0418\u0449\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043e\u0441\u0435\u0434\u043d\u044e\u044e \u043f\u0430\u0440\u0443 \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u0434\u0432\u0443\u0445 \u043c\u0435\u0434\u0438\u0430\u043d, \u043f\u0430\u0440\u0430 6, 0 \u0442\u043e\u0436\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442. np.roll \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u0430 \u043d\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 150 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.\u0420\u044f\u0434, \u0441\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0435\u043c\u044c, \u0438 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0444\u0430\u0437\u0430\u043c\u0414\u0432\u0430 \u0442\u0435\u043c\u043d\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043d\u0430 \u0442\u0435\u043f\u043b\u043e\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u0432 \u0434\u0432\u0430 \u043d\u0438\u0437\u043a\u0438\u0445 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0430 \u0441\u043f\u0440\u0430\u0432\u0430. \u0421\u0435\u0440\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0443\u0441\u0442\u044b\u0435: 150 \u043d\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 7.\u041c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u0442\u0440\u0435\u043d\u0434\u0430 \u0434\u043b\u044f \u0444\u0430\u0437 3 \u0438 4 \u0440\u0430\u0432\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e -331 \u0438 -401 \u0432\u0438\u0437\u0438\u0442\u0443. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0437\u0430\u0445 \u043e\u043d\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435. \u0423\u0431\u0435\u0440\u0435\u043c \u0442\u0440\u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u0430, \u0438 \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0430\u0440\u0430 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0442\u043e\u0439 \u0436\u0435. \u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043f\u043e\u043b\u0430\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439, \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0444\u0430\u0437\u044b 3 \u0438 4.\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0441\u044f \u0441\u043e \u0441\u0440\u0435\u0434\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0437\u044b 3 \u0438 4 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u0443\u0431\u0431\u043e\u0442\u0435 \u0438 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044e. \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043e\u0442\u0432\u0435\u0442.\u0427\u0438\u0441\u043b\u0430 \u0442\u0435 \u0436\u0435, \u043d\u0435\u0434\u0435\u043b\u044f \u0438\u0441\u0447\u0435\u0437\u043b\u0430\u0412 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441\u0440\u0435\u0434\u043d\u0435\u0435, \u043c\u0435\u0434\u0438\u0430\u043d\u0430 \u0438 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u0420\u0430\u0437\u0440\u0443\u0448\u0438\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u0441\u0442\u0432\u043e: \u0431\u044b\u0432\u0448\u0430\u044f \u0441\u0443\u0431\u0431\u043e\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0432\u0442\u043e\u0440\u043d\u0438\u043a\u0430\u043c\u0438. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u043e\u0432\u043e\u0434 \u043d\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u044f\u0434 \u00ab\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430\u00bb.\u041d\u043e \u043e\u0434\u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442. \u0421\u0434\u0435\u043b\u0430\u0435\u043c 4 999. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0437\u0430\u043d\u043e\u0432\u043e \u0443\u0431\u0435\u0440\u0435\u043c \u0442\u0440\u0435\u043d\u0434, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c ACF \u0438 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u043b\u0430\u0433\u0430\u043c \u043e\u0442 2 \u0434\u043e 21. \u041c\u044b \u0432\u0435\u0434\u044c \u0438 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0441\u0430\u043c\u044b\u0439 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043b\u0430\u0433. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044e.\u041a\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043cdef score(y):    return acf(detrend(y))[lags].max()shuffle_rng = np.random.default_rng(2026)shuffled = shuffle_rng.permutation(y)  # \u0414\u043b\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0441 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439null = np.array([score(shuffle_rng.permutation(y)) for _ in range(4999)])observed = score(y)p = (1 + np.count_nonzero(null &gt;= observed)) \/ (len(null) + 1)print(p, null.max())  # 0.0002, 0.364832&#8230;\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 ACF \u043f\u043e\u0441\u043b\u0435 4999 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a\u0421\u0442\u043e\u043b\u0431\u0446\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u044b ACF \u0443 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a. \u041e\u0440\u0430\u043d\u0436\u0435\u0432\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430.\u041d\u0438 \u043e\u0434\u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0435 \u0434\u043e\u0431\u0440\u0430\u043b\u0430\u0441\u044c \u0434\u043e 0,782: \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f 0,365. \u041e\u0446\u0435\u043d\u043a\u0430 \u0441 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u00ab\u043f\u043b\u044e\u0441 \u043e\u0434\u0438\u043d\u00bb \u0440\u0430\u0432\u043d\u0430 1 \/ 5000 = 0,0002. \u041d\u043e\u043b\u044c \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0439 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c.\u042d\u0442\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u044d\u0442\u0438\u0445 \u0447\u0438\u0441\u0435\u043b. \u042d\u0442\u043e \u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435. \u0418\u043d\u0435\u0440\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u043e\u0436\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0445\u043e\u0442\u044f \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0435\u043c\u0443 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0432\u044b\u0434\u0430\u0432\u0430\u043b.\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u041e\u0434\u0438\u043d seed \u0443\u043c\u0435\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u043c \u043e\u043f\u044b\u0442 \u043f\u043e 300 \u0440\u0430\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u043c\u0435\u043d\u044f\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0448\u0443\u043c. \u0412\u043e\u0437\u044c\u043c\u0435\u043c seed \u043e\u0442 1000 \u0434\u043e 1299, \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u044b \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439, \u0440\u043e\u0441\u0442 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0430\u0437\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c.\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439\u0421\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u043f\u0438\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0430 \u043b\u0430\u0433\u0435 7\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u0448\u0443\u043c 85284 \u0438\u0437 300\u0422\u043e\u0442 \u0436\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u0448\u0443\u043c 170192 \u0438\u0437 300\u041d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d \u0432 4 \u0440\u0430\u0437\u0430, \u0448\u0443\u043c 17070 \u0438\u0437 300\u041d\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043d\u0435\u0442, \u0448\u0443\u043c 8511 \u0438\u0437 300\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 16 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u043b\u0430\u0433\u0435 14. \u041f\u0440\u0438 \u0443\u0434\u0432\u043e\u0435\u043d\u043d\u043e\u043c \u0448\u0443\u043c\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u0438\u0441\u044c \u043d\u0430 14 \u0438 21: \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043f\u0438\u043a\u043e\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c, \u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u0441\u043f\u0443\u0442\u0430\u043b\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0441 \u0435\u0433\u043e \u043a\u0440\u0430\u0442\u043d\u044b\u043c\u0438. \u0417\u0430\u0442\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434 7, \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0430\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 300 \u043f\u043e\u0432\u0442\u043e\u0440\u0430\u0445 \u043e\u0431\u043e\u0438\u0445 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u041d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0432\u0430\u043b \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c \u0446\u0438\u043a\u043b.\u041d\u0430 \u0448\u0443\u043c\u0435 argmax \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e. \u0423 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430, \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u0437\u0434\u0435\u0441\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442\u00bb \u043c\u044b \u0435\u043c\u0443 \u043d\u0435 \u0434\u0430\u043b\u0438. \u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430, \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u0441\u0435\u0437\u043e\u043d\u043d\u043e\u0441\u0442\u0438.\u0415\u0441\u0442\u044c \u0441\u0431\u043e\u0439 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435. \u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435, \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 74, \u0438 \u0441\u043e\u0436\u043c\u0435\u043c \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044e. ACF(7) \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0439, \u043e\u043a\u043e\u043b\u043e 0,765, \u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0430\u0440\u0430 \u0441\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0441 3, 4 \u043d\u0430 2, 3. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430 \u0445\u0432\u043e\u0441\u0442 \u043f\u043e\u043f\u0430\u043b \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0437\u043e\u0432\u044b\u0435 \u044f\u0449\u0438\u043a\u0438. \u041a\u0440\u0430\u0441\u0438\u0432\u0430\u044f ACF \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430.\u041a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c\u041c\u044b \u043d\u0430\u0448\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u043c\u044c \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u0438 \u0434\u0432\u0435 \u043d\u0438\u0437\u043a\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0444\u0430\u0437\u044b. \u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0434\u043d\u0435\u0439?\u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0438\u0445\u0430\u0435\u0442 \u0432 \u0441\u0443\u0431\u0431\u043e\u0442\u0443 \u0438 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435, \u0438 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0437\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c, \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043f\u043e \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430\u043c \u0438 \u0432\u0442\u043e\u0440\u043d\u0438\u043a\u0430\u043c. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u0435\u043c\u044c \u0444\u0430\u0437 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e, \u0438 \u043d\u0438 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0438 \u043e\u0434\u043d\u0430 ACF \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u0441\u044f. \u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u044f\u043c\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043d\u0430\u0440\u0443\u0436\u0438.\u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u043b\u0438, \u0447\u0442\u043e \u0434\u0432\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0443\u0431\u0431\u043e\u0442\u0435 \u0438 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044e, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0442\u044c: \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0443\u0431\u0431\u043e\u0442\u043e\u0439, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435\u043c. \u042d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430. \u0421\u0430\u043c\u0438 \u0447\u0438\u0441\u043b\u0430 \u0435\u0435 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442. \u0410 \u0443 \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u044b\u043c\u0438 \u043e\u0436\u0438\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u043d\u044f\u043c\u0438.\u0414\u0430\u0436\u0435 \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u043e\u0439 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u0430\u044f \u0434\u0430\u0442\u0430 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f. \u041d\u0430\u0447\u0430\u0442\u044c \u0442\u0443 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u043f\u043e\u0437\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u0442\u0435\u043c \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c. \u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u0442\u044c \u043c\u0435\u0441\u044f\u0446 \u0438 \u0433\u043e\u0434, \u0443 150 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439. \u041d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0445 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043d\u0430\u0439\u0442\u0438 \u043c\u043e\u0436\u043d\u043e. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e \u043d\u0438\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u0442\u044b \u043d\u0435\u043b\u044c\u0437\u044f. Python \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043b, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u0439\u0442 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043e\u0442\u0434\u044b\u0445\u0430\u0435\u0442. \u0423\u0437\u043d\u0430\u0442\u044c, \u043a\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u043b \u0435\u043c\u0443 \u043e\u0442\u0434\u044b\u0445\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u0438 \u0434\u043d\u0438, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c &#8212; \u0443\u0436\u0435 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043a\u043e\u0434 \u0432 weekends.py. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0435\u0433\u043e:python -m pip install numpy==2.5.4 pandas==3.0.6 matplotlib==3.11.2python weekends.py\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 CSV, \u0447\u0435\u0442\u044b\u0440\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 PNG \u0438 SVG, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u0412 data\/generator_truth.csv \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0434\u043b\u044f \u0441\u0432\u0435\u0440\u043a\u0438, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0435\u0433\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u0442.#!\/usr\/bin\/env python3&#8243;&#187;&#187;Find a repeating low pair without giving the analyzer any calendar fields.Python 3.12+. Run: python weekends.py &#8212;out .All observations are synthetic. The calendar is used only by the generatorand the final audit, never by analyze(). No network access is needed.&#187;&#187;&#187;from __future__ import annotationsimport argparseimport hashlibimport jsonfrom pathlib import Pathimport platformimport matplotlibmatplotlib.use(&#171;Agg&#187;)import matplotlib.pyplot as pltfrom matplotlib.ticker import MultipleLocatorimport numpy as npimport pandas as pdN = &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-503789","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/503789","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=503789"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/503789\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=503789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=503789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=503789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}