{"id":301358,"date":"2020-04-06T15:00:26","date_gmt":"2020-04-06T15:00:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301358"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301358","title":{"rendered":"\u041f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/495884\/\">\u0423\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u0444\u043e\u043d\u0435 \u0432\u0441\u0435\u043e\u0431\u0449\u0435\u0439 \u0441\u0430\u043c\u043e\u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u0435\u0441\u044c\u043c\u0430 \u0434\u0443\u0440\u043d\u044b\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c. \u0418 \u044d\u043c\u043e\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0433\u043e\u0440\u0430\u043d\u0438\u0435 \u2013 \u044d\u0442\u043e \u0435\u0449\u0451 \u043a\u0443\u0434\u0430 \u043d\u0438 \u0448\u043b\u043e: \u0442\u0430\u043c \u0432\u0435\u0434\u044c \u0438 \u0434\u043e \u043a\u0440\u044b\u0448\u0438 \u043d\u0435\u0434\u0430\u043b\u0435\u043a\u043e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0438, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0435, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u00ab\u0443\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u00bb \u0441\u0435\u0431\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u044f \u2013 \u0438 \u043d\u0430\u0447\u0430\u043b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439: \u00ab\u0414\u0430\u0451\u0448\u044c <i>\u043c\u0430\u0448\u0438\u043d\u043b\u0451\u0440\u043d\u0438\u043d\u0433 <\/i>\u0432 \u043c\u0430\u0441\u0441\u044b!\u00bb.) \u041d\u0443\u0436\u043d\u043e \u0432\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u043e\u0435: \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0435\u0442. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u043e\u0432\u043e\u043c\u0443 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e, \u0442\u0430\u043a \u0438 \u043f\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f, \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e.<br \/>  <a name=\"habracut\"><\/a><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3d7\/fe4\/946\/3d7fe49466cad76814b37e73ec1bc49a.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u0418\u0442\u0430\u043a, \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b <i>Time series forecasting<\/i> \u0438\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432 tensorflow: <a href=\"https:\/\/www.tensorflow.org\/tutorials\/structured_data\/time_series?hl=ru#part_1_forecast_a_univariate_time_series\" rel=\"nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>. \u041c\u043e\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043a \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0443 \u043d\u0430\u0446\u0435\u043b\u0435\u043d\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u0441 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0438\u0434\u0435\u0439 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439 ML \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u2013 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432.<br \/>  <cut><\/cut><br \/>  \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c. <br \/>  <cut><\/cut><br \/>  \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 <i>(univariate time-series)<\/i> \u0438 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 <i>(multivariate time-series)<\/i>. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 <i>(input data)<\/i> \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0421 \u0443\u0447\u0451\u0442\u043e\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0435\u043e\u0440\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<br \/>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8fa\/31a\/a75\/8fa31aa7531d8589dcee2ae93454a430.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u041d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u0440\u0430\u0442\u044c \u0437\u0430 <i>\u0425<\/i> \u0430 \u0447\u0442\u043e \u0437\u0430 <i>Y<\/i>, \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0441\u0442\u0430\u043d\u0435\u0442 \u044f\u0441\u043d\u043e \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0439. \u041e\u0442\u043c\u0435\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 (Y) \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u043a \u0441 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u043c, \u0442\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0440\u044f\u0434\u043e\u043c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435: \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 <i>\u0422(degC)<\/i> (\u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432\u043e\u0437\u0434\u0443\u0445\u0430). \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u00ab\u0437\u0430\u0440\u044b\u0442\u0430\u00bb \u0432 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043f\u043e\u0434\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438: \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0440\u044f\u0434\u043e\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 (X) \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430: \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432\u043e\u0437\u0434\u0443\u0445\u0430; \u0430 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u2013 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e: \u043f\u043e\u043c\u0438\u043c\u043e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <i>p(mbar)<\/i> (\u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u043d\u043e\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435) \u0438 <i>rho(g\/m**3)<\/i> (\u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c).<br \/>  <cut><\/cut><br \/>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439, \u0434\u0430\u043b\u0435\u043a\u043e-\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u044b\u0439, \u0432\u0437\u0433\u043b\u044f\u0434 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u0443\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430: \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0442\u0430\u043a: \u0434\u043b\u044f \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u0432, \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u0442\u0440\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u043e \u0437\u0435\u043c\u043d\u0443\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0438 \u0442.\u043f. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0435\u0449\u0438 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b, \u0434\u0430 \u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0442\u043e\u0439 \u0435\u0449\u0451 \u0441\u043e\u043b\u044f\u043d\u043a\u0438 (\u0438\u043b\u0438 \u0431\u043e\u0440\u0449\u0430). \u0412 \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u0440\u0430\u0437\u0432\u0435\u0434\u043e\u0447\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c.<br \/>  <cut><\/cut><br \/>  \u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d <i>\u043a\u0443\u0440\u0441\u0438\u0432\u043e\u043c<\/i>.<br \/>  <cut><\/cut><br \/>  <cut><\/cut>  <\/p>\n<h2>\u041f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432<\/h2>\n<p>  \u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 (\u0420\u041d\u0421, \u043e\u0442 \u0430\u043d\u0433\u043b. <i>Recurrent Neural Network, RNN<\/i>). \u041e\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">import tensorflow as tf  import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import os import pandas as pd  mpl.rcParams['figure.figsize'] = (8, 6) mpl.rcParams['axes.grid'] = False <\/code><\/pre>\n<p>  <b>\u041d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u0435\u043e\u0440\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/b><br \/>  <cut><\/cut><br \/>  \u0412\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <a href=\"https:\/\/www.bgc-jena.mpg.de\/wetter\/\" rel=\"nofollow\">\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u0433\u043e\u0434\u0435<\/a>, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0433\u0438\u0434\u0440\u043e\u043c\u0435\u0442\u0435\u043e\u0440\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u0432 <a href=\"https:\/\/www.bgc-jena.mpg.de\/index.php\/Main\/HomePage\" rel=\"nofollow\">\u0418\u043d\u0441\u0442\u0438\u0442\u0443\u0442\u0435 \u0431\u0438\u043e\u0433\u0435\u043e\u0445\u0438\u043c\u0438\u0438 \u0438\u043c. \u041c\u0430\u043a\u0441\u0430 \u041f\u043b\u0430\u043d\u043a\u0430<\/a>.<br \/>  <cut><\/cut><br \/>  \u0412 \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0437\u0430\u043c\u0435\u0440\u044b 14 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u0435\u043e\u0440\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 (\u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432\u043e\u0437\u0434\u0443\u0445\u0430, \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u043d\u043e\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c), \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0435 10 \u043c\u0438\u043d\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 2003 \u0433\u043e\u0434\u0430. \u0414\u043b\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043f\u0435\u0440\u0438\u043e\u0434 \u0441 2009 \u043f\u043e 2016 \u0433\u043e\u0434. \u042d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u044b\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0424\u0440\u0430\u043d\u0441\u0443\u0430 \u0428\u043e\u043b\u043b\u0435 (Fran\u00e7ois Chollet) \u0434\u043b\u044f \u0435\u0433\u043e \u043a\u043d\u0438\u0433\u0438 \u00ab\u0413\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 Python\u00bb (<a href=\"https:\/\/www.manning.com\/books\/deep-learning-with-python\" rel=\"nofollow\">Deep Learning with Python<\/a>).<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">zip_path = tf.keras.utils.get_file(     origin='https:\/\/storage.googleapis.com\/tensorflow\/tf-keras-datasets\/jena_climate_2009_2016.csv.zip',     fname='jena_climate_2009_2016.csv.zip',     extract=True) csv_path, _ = os.path.splitext(zip_path) <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">df = pd.read_csv(csv_path) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">df.head() <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d5d\/bfa\/539\/d5dbfa539de3da5ca04103b2db380a70.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u0412 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0438\u043e\u0434 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 10 \u043c\u0438\u043d\u0443\u0442, \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0430\u0441\u0430 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 6 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439. \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f 144 (6&#215;24) \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f.<br \/>  <cut><\/cut><br \/>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 c\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 6 \u0447\u0430\u0441\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0433\u043d\u043e\u0437 \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0443 \u0432\u0430\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 5 \u0434\u043d\u0435\u0439 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 720 (5&#215;144) \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 (\u0432 \u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0434\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432).<br \/>  <cut><\/cut><br \/>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0430\u044f \u043d\u0438\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>history_size<\/code> \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430, <code>target_size<\/code> \u2013 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, <code>target_size<\/code> \u2013 \u044d\u0442\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">def univariate_data(dataset, start_index, end_index, history_size, target_size):   data = []   labels = []    start_index = start_index + history_size   if end_index is None:     end_index = len(dataset) - target_size    for i in range(start_index, end_index):     indices = range(i-history_size, i)     # Reshape data from (history_size,) to (history_size, 1)     data.append(np.reshape(dataset[indices], (history_size, 1)))     labels.append(dataset[i+target_size])   return np.array(data), np.array(labels) <\/code><\/pre>\n<p>  \u0412 \u043e\u0431\u0435\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0432\u044b\u0435 300 000 \u0441\u0442\u0440\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u2013 \u0434\u043b\u044f \u0435\u0451 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 (\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438). \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u044a\u0451\u043c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 2100 \u0434\u043d\u0435\u0439.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">TRAIN_SPLIT = 300000 <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f seed.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">tf.random.set_seed(13) <\/code><\/pre>\n<p>  <cut><\/cut>  <\/p>\n<h4>\u0427\u0430\u0441\u0442\u044c 1. \u041f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430<\/h4>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u2013 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443; \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b.<br \/>  <cut><\/cut><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">uni_data = df['T (degC)'] uni_data.index = df['Date Time'] uni_data.head() <\/code><\/pre>\n<p>  <code>Date Time<br \/>  01.01.2009 00:10:00 -8.02<br \/>  01.01.2009 00:20:00 -8.41<br \/>  01.01.2009 00:30:00 -8.51<br \/>  01.01.2009 00:40:00 -8.31<br \/>  01.01.2009 00:50:00 -8.27<br \/>  Name: T (degC), dtype: float64<br \/>  <\/code><br \/>  <cut><\/cut><br \/>  \u0418 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">uni_data.plot(subplots=True) <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/208\/b35\/242\/208b35242d3ce1ed30bd25d12d956703.jpg\" alt=\"image\"><br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">uni_data = uni_data.values <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 (\u0434\u0430\u043b\u0435\u0435 \u2013 \u0418\u041d\u0421) \u0432\u0430\u0436\u043d\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f (<i>standardization<\/i>), \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0430\u044f \u043f\u0443\u0442\u0451\u043c \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/utils\/normalize?hl=ru\" rel=\"nofollow\">tf.keras.utils.normalize<\/a><\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d [0,1].<br \/>  <cut><\/cut><br \/>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/b>: \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">uni_train_mean = uni_data[:TRAIN_SPLIT].mean() uni_train_std = uni_data[:TRAIN_SPLIT].std() <\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">uni_data = (uni_data-uni_train_mean)\/uni_train_std <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u0432\u0445\u043e\u0434\u043e\u043c. \u041d\u0430 \u0432\u0445\u043e\u0434 \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 20 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u0437\u0430 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043e\u0439, \u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">univariate_past_history = 20 univariate_future_target = 0  x_train_uni, y_train_uni = univariate_data(uni_data, 0, TRAIN_SPLIT,                                            univariate_past_history,                                            univariate_future_target) x_val_uni, y_val_uni = univariate_data(uni_data, TRAIN_SPLIT, None,                                        univariate_past_history,                                        univariate_future_target) <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>univariate_data<\/code>.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">print ('Single window of past history') print (x_train_uni[0]) print ('\\n Target temperature to predict') print (y_train_uni[0]) <\/code><\/pre>\n<p>  <code> [-2.04513467]<br \/>   [-2.08334362]<br \/>   [-2.09723778]<br \/>   [-2.09376424]<br \/>   [-2.09144854]<br \/>   [-2.07176515]<br \/>   [-2.07176515]<br \/>   [-2.07639653]<br \/>   [-2.08913285]<br \/>   [-2.09260639]<br \/>   [-2.10418486]]<\/p>\n<p>  Target temperature to predict<br \/>  -2.1041848598100876<br \/>  <\/code><br \/>  <cut><\/cut><br \/>  <i>\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435: \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u0432\u0445\u043e\u0434\u043e\u043c \u0441\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435 (\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043d\u0430 \u044d\u0442\u043e\u043c \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0440\u0438\u0441\u0443\u043d\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u00ab\u0441\u044b\u0440\u043e\u043c\u00bb \u0432\u0438\u0434\u0435, \u0434\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0437 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u2018Date time\u2019 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430):<\/i><br \/>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/fa0\/d0f\/530\/fa0d0f530b3496324425eeb5e52baff7.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u041f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u0430\u044f \u0432 \u0418\u041d\u0421 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430 \u0441\u0438\u043d\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u043c, \u043a\u0440\u0430\u0441\u043d\u044b\u043c \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u043e\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0418\u041d\u0421 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">def create_time_steps(length):   return list(range(-length, 0)) <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">def show_plot(plot_data, delta, title):   labels = ['History', 'True Future', 'Model Prediction']   marker = ['.-', 'rx', 'go']   time_steps = create_time_steps(plot_data[0].shape[0])   if delta:     future = delta   else:     future = 0    plt.title(title)   for i, x in enumerate(plot_data):     if i:       plt.plot(future, plot_data[i], marker[i], markersize=10,                label=labels[i])     else:       plt.plot(time_steps, plot_data[i].flatten(), marker[i], label=labels[i])   plt.legend()   plt.xlim([time_steps[0], (future+5)*2])   plt.xlabel('Time-Step')   return plt <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">show_plot([x_train_uni[0], y_train_uni[0]], 0, 'Sample Example') <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/589\/38c\/574\/58938c5740abfb08ed0074a1233f512f.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  <b>\u0411\u0430\u0437\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 (\u0431\u0435\u0437 \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f)<\/b><br \/>  <cut><\/cut><br \/>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 (<i>baseline<\/i>). \u041e\u043d\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043c\u0435\u0442\u043e\u0434 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u00ab\u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u00bb \u0432\u0441\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 20 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">def baseline(history):   return np.mean(history) <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">show_plot([x_train_uni[0], y_train_uni[0], baseline(x_train_uni[0])], 0,            'Baseline Prediction Example') <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bed\/941\/0ef\/bed9410ef6b96ad25ab68a0a3ebac05a.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043f\u0440\u0435\u0432\u0437\u043e\u0439\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u00ab\u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u044f\u00bb, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c.<br \/>  <cut><\/cut><br \/>  <b>\u0420\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c<\/b><br \/>  <cut><\/cut><br \/>  \u0420\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c (\u0420\u041d\u0421) \u2014 \u044d\u0442\u043e \u0442\u0438\u043f \u0418\u041d\u0421, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0440\u044f\u0434\u0430\u043c\u0438. \u0420\u041d\u0421 \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u044f \u0435\u0451 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0420\u041d\u0421 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c <a href=\"https:\/\/www.tensorflow.org\/tutorials\/text\/text_generation?hl=ru\" rel=\"nofollow\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435<\/a>. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u0420\u041d\u0421, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u0414\u043e\u043b\u0433\u0430\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0440\u043e\u0447\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u00bb (\u0430\u043d\u0433\u043b. <i>Long Short-Term Memory, <a href=\"https:\/\/www.tensorflow.org\/versions\/r2.0\/api_docs\/python\/tf\/keras\/layers\/LSTM?hl=ru\" rel=\"nofollow\">LSTM<\/a><\/i>).<br \/>  <cut><\/cut><br \/>  \u0414\u0430\u043b\u0435\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/data?hl=ru\" rel=\"nofollow\">tf.data<\/a><\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435 (shuffle), \u043f\u0430\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (batch) \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (cache) \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <cut><\/cut><br \/>  <i>\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435: <br \/>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043c\u0435\u0442\u043e\u0434\u044b shuffle, batch \u0438 cache \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/data\/Dataset?hl\" rel=\"nofollow\">tensorflow<\/a>:<\/i><br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">BATCH_SIZE = 256 BUFFER_SIZE = 10000  train_univariate = tf.data.Dataset.from_tensor_slices((x_train_uni, y_train_uni)) train_univariate = train_univariate.cache().shuffle(BUFFER_SIZE).batch(BATCH_SIZE).repeat()  val_univariate = tf.data.Dataset.from_tensor_slices((x_val_uni, y_val_uni)) val_univariate = val_univariate.batch(BATCH_SIZE).repeat() <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<br \/>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/002\/e4b\/3ed\/002e4b3ed48fa5d17f34ccee2cbfc40d.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e LSTM \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">simple_lstm_model = tf.keras.models.Sequential([     tf.keras.layers.LSTM(8, input_shape=x_train_uni.shape[-2:]),     tf.keras.layers.Dense(1) ])  simple_lstm_model.compile(optimizer='adam', loss='mae') <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u044b\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">for x, y in val_univariate.take(1):     print(simple_lstm_model.predict(x).shape) <\/code><\/pre>\n<p>  <code>(256, 1)<br \/>  <\/code><br \/>  <cut><\/cut><br \/>  <i>\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435:<br \/>  \u0412 \u043e\u0431\u0449\u0435\u043c \u043f\u043b\u0430\u043d\u0435 \u0420\u041d\u0421 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438 (sequences). \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u043e\u0440\u043c\u0443:<\/p>\n<p>  <code>[\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b, \u043a\u043e\u043b-\u0432\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432]<\/code><\/p>\n<p>  \u0424\u043e\u0440\u043c\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u0432\u0445\u043e\u0434\u043e\u043c \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/i><\/p>\n<p>  <code>print(x_train_uni.shape)<br \/>  (299980, 20, 1)<\/code><br \/>  <cut><\/cut><br \/>  <cut><\/cut><br \/>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438. \u0418\u0437-\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432 \u0446\u0435\u043b\u044f\u0445 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u044d\u043f\u043e\u0445\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 200 \u0448\u0430\u0433\u043e\u0432 (<i>steps_per_epoch=200<\/i>) \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u043b\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">EVALUATION_INTERVAL = 200 EPOCHS = 10  simple_lstm_model.fit(train_univariate, epochs=EPOCHS,                       steps_per_epoch=EVALUATION_INTERVAL,                       validation_data=val_univariate, validation_steps=50) <\/code><\/pre>\n<p>  <code>Train for 200 steps, validate for 50 steps<br \/>  Epoch 1\/10<br \/>  200\/200 [==============================] - 2s 11ms\/step - loss: 0.4075 - val_loss: 0.1351<br \/>  Epoch 2\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.1118 - val_loss: 0.0360<br \/>  Epoch 3\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0490 - val_loss: 0.0289<br \/>  Epoch 4\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0444 - val_loss: 0.0257<br \/>  Epoch 5\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0299 - val_loss: 0.0235<br \/>  Epoch 6\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0317 - val_loss: 0.0224<br \/>  Epoch 7\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0287 - val_loss: 0.0206<br \/>  Epoch 8\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0263 - val_loss: 0.0200<br \/>  Epoch 9\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0254 - val_loss: 0.0182<br \/>  Epoch 10\/10<br \/>  200\/200 [==============================] - 1s 4ms\/step - loss: 0.0228 - val_loss: 0.0174<br \/>  <\/code><br \/>  <cut><\/cut><br \/>  <b>\u041f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 LSTM<\/b><br \/>  <cut><\/cut><br \/>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 LSTM-\u043c\u043e\u0434\u0435\u043b\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u043e\u0432.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">for x, y in val_univariate.take(3):   plot = show_plot([x[0].numpy(), y[0].numpy(),                     simple_lstm_model.predict(x)[0]], 0, 'Simple LSTM model')   plot.show() <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cf8\/0f6\/810\/cf80f681038da62889884ae5de86722d.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c.<br \/>  <cut><\/cut><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043c\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0440\u044f\u0434\u043e\u043c.<br \/>  <cut><\/cut>  <\/p>\n<h4>\u0427\u0430\u0441\u0442\u044c 2: \u041f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430<\/h4>\n<p>  \u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 14 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u0435\u043e\u0440\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432\u043e\u0437\u0434\u0443\u0445\u0430, \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u043d\u043e\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u0434\u0443\u0445\u0430.<br \/>  <cut><\/cut><br \/>  \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a <i>feature_considered<\/i>.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">features_considered = ['p (mbar)', 'T (degC)', 'rho (g\/m**3)'] <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">features = df[features_considered] features.index = df['Date Time'] features.head() <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1f8\/589\/b51\/1f8589b51d64dcd9ba10e5f072df503e.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">features.plot(subplots=True) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7be\/266\/b59\/7be266b59f38be1e4c365ee8562dffcd.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u041a\u0430\u043a \u0438 \u0440\u0430\u043d\u0435\u0435, \u043f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">dataset = features.values data_mean = dataset[:TRAIN_SPLIT].mean(axis=0) data_std = dataset[:TRAIN_SPLIT].std(axis=0) <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">dataset = (dataset-data_mean)\/data_std <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <i>\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435:<br \/>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<br \/>  \u0421\u0443\u0442\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0447\u0435\u0440\u0435\u0437 12 \u0447\u0430\u0441\u043e\u0432) (one-step\/single step model), \u0442\u043e \u0438 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u0415\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0436\u0435\u0447\u0430\u0441\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 12 \u0447\u0430\u0441\u043e\u0432) (multi-step model), \u0442\u043e \u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/i><br \/>  <cut><\/cut><br \/>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/906\/953\/08e\/90695308e69c21c37e772d98553209a4.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  <b>\u0422\u043e\u0447\u0435\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/b><br \/>  <cut><\/cut><br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0435\u043a\u043e\u0439 \u0438\u043c\u0435\u044e\u0449\u0435\u0439\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438.<br \/>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0430\u044f \u043d\u0438\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u043b\u0438\u0448\u044c \u0441 \u0442\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043e\u043d\u0430 \u043e\u0442\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0448\u0430\u0433\u0430.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">def multivariate_data(dataset, target, start_index, end_index, history_size,                       target_size, step, single_step=False):   data = []   labels = []    start_index = start_index + history_size   if end_index is None:     end_index = len(dataset) - target_size    for i in range(start_index, end_index):     indices = range(i-history_size, i, step)     data.append(dataset[indices])      if single_step:       labels.append(target[i+target_size])     else:       labels.append(target[i:i+target_size])    return np.array(data), np.array(labels) <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0418\u041d\u0421 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u044f\u0442\u044c (5) \u0434\u043d\u0435\u0439, \u0442\u043e \u0435\u0441\u0442\u044c 720 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 (6\u044524\u04455). \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0442\u043e \u043e\u0442\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u043a\u0430\u0436\u0434\u044b\u0435 10 \u043c\u0438\u043d\u0443\u0442, \u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441: \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 60 \u043c\u0438\u043d\u0443\u0442 \u0440\u0435\u0437\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u044e\u0442\u0441\u044f. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043f\u044f\u0442\u0438 \u0434\u043d\u0435\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 120 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 (720\/6). \u0414\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0446\u0435\u043b\u044c\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0447\u0435\u0440\u0435\u0437 12 \u0447\u0430\u0441\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043f\u043e\u0441\u043b\u0435 72 (12\u04456) \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 (<i>\u0441\u043c. \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u2013 \u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/i>).<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">past_history = 720 future_target = 72 STEP = 6  x_train_single, y_train_single = multivariate_data(dataset, dataset[:, 1], 0,                                                    TRAIN_SPLIT, past_history,                                                    future_target, STEP,                                                    single_step=True) x_val_single, y_val_single = multivariate_data(dataset, dataset[:, 1],                                                TRAIN_SPLIT, None, past_history,                                                future_target, STEP,                                                single_step=True) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">print ('Single window of past history : {}'.format(x_train_single[0].shape)) <\/code><\/pre>\n<p>  <code>Single window of past history : (120, 3)<br \/>  <\/code>  <\/p>\n<pre><code class=\"python\">train_data_single = tf.data.Dataset.from_tensor_slices((x_train_single, y_train_single)) train_data_single = train_data_single.cache().shuffle(BUFFER_SIZE).batch(BATCH_SIZE).repeat()  val_data_single = tf.data.Dataset.from_tensor_slices((x_val_single, y_val_single)) val_data_single = val_data_single.batch(BATCH_SIZE).repeat() <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">single_step_model = tf.keras.models.Sequential() single_step_model.add(tf.keras.layers.LSTM(32,                                            input_shape=x_train_single.shape[-2:])) single_step_model.add(tf.keras.layers.Dense(1))  single_step_model.compile(optimizer=tf.keras.optimizers.RMSprop(), loss='mae') <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0430\u0448\u0443 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043a\u0440\u0438\u0432\u044b\u0435 \u043f\u043e\u0442\u0435\u0440\u044c \u043d\u0430 \u044d\u0442\u0430\u043f\u0430\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">for x, y in val_data_single.take(1):   print(single_step_model.predict(x).shape) <\/code><\/pre>\n<p>  <code>(256, 1)<br \/>  <\/code>  <\/p>\n<pre><code class=\"python\">single_step_history = single_step_model.fit(train_data_single, epochs=EPOCHS,                                             steps_per_epoch=EVALUATION_INTERVAL,                                             validation_data=val_data_single,                                             validation_steps=50) <\/code><\/pre>\n<p>  <code>Train for 200 steps, validate for 50 steps<br \/>  Epoch 1\/10<br \/>  200\/200 [==============================] - 4s 18ms\/step - loss: 0.3090 - val_loss: 0.2646<br \/>  Epoch 2\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2624 - val_loss: 0.2435<br \/>  Epoch 3\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2616 - val_loss: 0.2472<br \/>  Epoch 4\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2567 - val_loss: 0.2442<br \/>  Epoch 5\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2263 - val_loss: 0.2346<br \/>  Epoch 6\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2416 - val_loss: 0.2643<br \/>  Epoch 7\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2411 - val_loss: 0.2577<br \/>  Epoch 8\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2410 - val_loss: 0.2388<br \/>  Epoch 9\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2447 - val_loss: 0.2485<br \/>  Epoch 10\/10<br \/>  200\/200 [==============================] - 2s 9ms\/step - loss: 0.2388 - val_loss: 0.2422<br \/>  <\/code>  <\/p>\n<pre><code class=\"python\">def plot_train_history(history, title):   loss = history.history['loss']   val_loss = history.history['val_loss']    epochs = range(len(loss))    plt.figure()    plt.plot(epochs, loss, 'b', label='Training loss')   plt.plot(epochs, val_loss, 'r', label='Validation loss')   plt.title(title)   plt.legend()    plt.show() <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">plot_train_history(single_step_history,                    'Single Step Training and validation loss') <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/baa\/481\/4df\/baa4814df5d278c7be5a4daf629ec8e0.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  <cut><\/cut><br \/>  <i>\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435:<br \/>  \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u0432\u0445\u043e\u0434\u043e\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>STEP<\/code> \u0440\u0430\u0432\u0435\u043d 1. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u0445 <u>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>STEP <\/code>\u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/u>, \u0430 \u043d\u0435 \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430.<\/i><br \/>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bfd\/c0b\/ef1\/bfdc0bef1203da6840adcb4311455645.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  <i>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>x_train_single<\/code> \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 <code>(299280, 720, 3)<\/code>.<br \/>  \u041f\u0440\u0438 <code>STEP=6<\/code>, \u0444\u043e\u0440\u043c\u0430 \u043f\u0440\u0438\u043c\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434: <code>(299280, 120, 3)<\/code> \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0437\u044b. \u0412\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0434\u0430\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443: \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0436\u043e\u0440\u043b\u0438\u0432\u044b\u0435 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<\/i><br \/>  <cut><\/cut><br \/>  <b>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430<\/b><br \/>  <cut><\/cut><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u043e\u0432. \u041d\u0430 \u0432\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 3-\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u044f\u0442\u044c \u0434\u043d\u0435\u0439, \u043e\u0442\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441 (\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b = 120). \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b, \u0442\u043e \u0441\u0438\u043d\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u043c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044b \u043f\u0440\u043e\u0448\u043b\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b (<i>\u0438\u0441\u0442\u043e\u0440\u0438\u044f<\/i>). \u041f\u0440\u043e\u0433\u043d\u043e\u0437 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043d\u0430 \u043f\u043e\u043b\u0434\u043d\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u0435 (\u043e\u0442\u0441\u044e\u0434\u0430 \u0438 \u0440\u0430\u0437\u0440\u044b\u0432 \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0438 \u0441\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c).<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">for x, y in val_data_single.take(3):   plot = show_plot([x[0][:, 1].numpy(), y[0].numpy(),                     single_step_model.predict(x)[0]], 12,                    'Single Step Prediction')   plot.show() <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6ac\/a5b\/ce3\/6aca5bce3fef9de56f1fac299da5527c.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  <b>\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/b><br \/>  <cut><\/cut><br \/>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0435\u043a\u043e\u0439 \u0438\u043c\u0435\u044e\u0449\u0435\u0439\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u0434\u0430\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<br \/>  <cut><\/cut><br \/>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0447\u0430\u0441\u043e\u0432\u044b\u0435 \u0437\u0430\u043c\u0435\u0440\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043f\u044f\u0442\u0438 \u0434\u043d\u0435\u0439 (720\/6). \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 12 \u0447\u0430\u0441\u043e\u0432. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0435 10 \u043c\u0438\u043d\u0443\u0442, \u0432\u044b\u0445\u043e\u0434 (output) \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 72 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u043e\u0432. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043d\u043e\u0432\u043e, \u043d\u043e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0446\u0435\u043b\u0435\u0432\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">future_target = 72 x_train_multi, y_train_multi = multivariate_data(dataset, dataset[:, 1], 0,                                                  TRAIN_SPLIT, past_history,                                                  future_target, STEP) x_val_multi, y_val_multi = multivariate_data(dataset, dataset[:, 1],                                              TRAIN_SPLIT, None, past_history,                                              future_target, STEP) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">print ('Single window of past history : {}'.format(x_train_multi[0].shape)) print ('\\n Target temperature to predict : {}'.format(y_train_multi[0].shape)) <\/code><\/pre>\n<p>  <code>Single window of past history : (120, 3)<\/p>\n<p>  Target temperature to predict : (72,)<br \/>  <\/code>  <\/p>\n<pre><code class=\"python\">train_data_multi = tf.data.Dataset.from_tensor_slices((x_train_multi, y_train_multi)) train_data_multi = train_data_multi.cache().shuffle(BUFFER_SIZE).batch(BATCH_SIZE).repeat()  val_data_multi = tf.data.Dataset.from_tensor_slices((x_val_multi, y_val_multi)) val_data_multi = val_data_multi.batch(BATCH_SIZE).repeat() <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <i>\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435: \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0432 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u00ab\u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438\u00bb \u043e\u0442 \u00ab\u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438\u00bb \u0432\u0438\u0434\u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/i><br \/>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/190\/5c6\/845\/1905c6845d2746a1f0bc6ae88f913b99.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">def multi_step_plot(history, true_future, prediction):   plt.figure(figsize=(12, 6))   num_in = create_time_steps(len(history))   num_out = len(true_future)    plt.plot(num_in, np.array(history[:, 1]), label='History')   plt.plot(np.arange(num_out)\/STEP, np.array(true_future), 'bo',            label='True Future')   if prediction.any():     plt.plot(np.arange(num_out)\/STEP, np.array(prediction), 'ro',              label='Predicted Future')   plt.legend(loc='upper left')   plt.show() <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0438 \u0431\u0443\u0434\u0443\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u0436\u0435\u0447\u0430\u0441\u043d\u044b\u0435.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">for x, y in train_data_multi.take(1):   multi_step_plot(x[0], y[0], np.array([0])) <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/245\/beb\/236\/245beb236bc1f87f2d611ce8d2c0bc81.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f, \u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0451\u0432 LSTM. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 72 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430, \u0432\u044b\u0445\u043e\u0434 \u0441\u043b\u043e\u0439 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 72 \u043d\u0435\u0439\u0440\u043e\u043d\u0430.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">multi_step_model = tf.keras.models.Sequential() multi_step_model.add(tf.keras.layers.LSTM(32,                                           return_sequences=True,                                           input_shape=x_train_multi.shape[-2:])) multi_step_model.add(tf.keras.layers.LSTM(16, activation='relu')) multi_step_model.add(tf.keras.layers.Dense(72))  multi_step_model.compile(optimizer=tf.keras.optimizers.RMSprop(clipvalue=1.0), loss='mae') <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0430\u0448\u0443 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043a\u0440\u0438\u0432\u044b\u0435 \u043f\u043e\u0442\u0435\u0440\u044c \u043d\u0430 \u044d\u0442\u0430\u043f\u0430\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">for x, y in val_data_multi.take(1):   print (multi_step_model.predict(x).shape) <\/code><\/pre>\n<p>  <code>(256, 72)<br \/>  <\/code>  <\/p>\n<pre><code class=\"python\">multi_step_history = multi_step_model.fit(train_data_multi, epochs=EPOCHS,                                           steps_per_epoch=EVALUATION_INTERVAL,                                           validation_data=val_data_multi,                                           validation_steps=50) <\/code><\/pre>\n<p>  <code>Train for 200 steps, validate for 50 steps<br \/>  Epoch 1\/10<br \/>  200\/200 [==============================] - 21s 103ms\/step - loss: 0.4952 - val_loss: 0.3008<br \/>  Epoch 2\/10<br \/>  200\/200 [==============================] - 18s 89ms\/step - loss: 0.3474 - val_loss: 0.2898<br \/>  Epoch 3\/10<br \/>  200\/200 [==============================] - 18s 89ms\/step - loss: 0.3325 - val_loss: 0.2541<br \/>  Epoch 4\/10<br \/>  200\/200 [==============================] - 18s 89ms\/step - loss: 0.2425 - val_loss: 0.2066<br \/>  Epoch 5\/10<br \/>  200\/200 [==============================] - 18s 89ms\/step - loss: 0.1963 - val_loss: 0.1995<br \/>  Epoch 6\/10<br \/>  200\/200 [==============================] - 18s 90ms\/step - loss: 0.2056 - val_loss: 0.2119<br \/>  Epoch 7\/10<br \/>  200\/200 [==============================] - 18s 91ms\/step - loss: 0.1978 - val_loss: 0.2079<br \/>  Epoch 8\/10<br \/>  200\/200 [==============================] - 18s 89ms\/step - loss: 0.1957 - val_loss: 0.2033<br \/>  Epoch 9\/10<br \/>  200\/200 [==============================] - 18s 90ms\/step - loss: 0.1977 - val_loss: 0.1860<br \/>  Epoch 10\/10<br \/>  200\/200 [==============================] - 18s 88ms\/step - loss: 0.1904 - val_loss: 0.1863<br \/>  <\/code>  <\/p>\n<pre><code class=\"python\">plot_train_history(multi_step_history, 'Multi-Step Training and validation loss') <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/479\/600\/430\/4796004305bd5b839ead7c35120ddc69.png\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  <b>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430<\/b><br \/>  <cut><\/cut><br \/>  \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0418\u041d\u0421 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b.<br \/>  <cut><\/cut>  <\/p>\n<pre><code class=\"python\">for x, y in val_data_multi.take(3):   multi_step_plot(x[0], y[0], multi_step_model.predict(x)[0]) <\/code><\/pre>\n<p>  <cut><\/cut><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a3a\/2fa\/3cd\/a3a2fa3cd17ec79c04d9ab44a3d3ad2c.jpg\" alt=\"image\"><br \/>  <cut><\/cut><br \/>  <cut><\/cut>  <\/p>\n<h4>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438<\/h4>\n<p>  \u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0420\u041d\u0421. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0444\u043e\u043d\u0434\u043e\u0432\u044b\u0439 \u0440\u044b\u043d\u043e\u043a \u0438 \u0441\u0442\u0430\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0435\u0440\u043e\u043c <i>(\u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a:). \u2013 \u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430)<\/i>.<br \/>  <cut><\/cut><br \/>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043c\u0435\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>uni\/multivariate_data<\/i> \u0441 \u0446\u0435\u043b\u044c\u044e \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u00ab<a href=\"https:\/\/www.tensorflow.org\/guide\/data?hl=ru#time_series_windowing\" rel=\"nofollow\">time series windowing<\/a>\u00bb \u0438 \u043f\u0440\u0438\u0432\u043d\u0435\u0441\u0442\u0438 \u0435\u0451 \u0438\u0434\u0435\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e.<br \/>  <cut><\/cut><br \/>  \u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0433\u043b\u0430\u0432\u0443 15 \u043a\u043d\u0438\u0433\u0438 <a href=\"https:\/\/www.oreilly.com\/library\/view\/hands-on-machine-learning\/9781492032632\/\" rel=\"nofollow\">\u00ab\u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0435 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Scikit-Learn, Keras \u0438 TensorFlow\u00bb<\/a> (\u041e\u0440\u0435\u043b\u044c\u0435\u043d \u0416\u0435\u0440\u043e\u043d, 2-\u0435 \u0438\u0437\u0434\u0430\u043d\u0438\u0435) \u0438 \u0433\u043b\u0430\u0432\u0443 6 \u043a\u043d\u0438\u0433\u0438 <a href=\"https:\/\/www.manning.com\/books\/deep-learning-with-python\" rel=\"nofollow\">\u00ab\u0413\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 Python\u00bb<\/a> (\u0424\u0440\u0430\u043d\u0441\u0443\u0430 \u0428\u043e\u043b\u043b\u0435).<br \/>  <cut><\/cut><br \/>  <cut><\/cut><br \/>  <i>\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<br \/>  \u041e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c \u0434\u043e\u043c\u0430, \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u044c\u0442\u0435\u0441\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0441\u0432\u043e\u0451\u043c \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435, \u043d\u043e \u0438 \u043f\u043e\u0436\u0430\u043b\u0435\u0439\u0442\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043f\u0443\u0442\u0451\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043d\u0430 \u0443\u0441\u0435\u0447\u0451\u043d\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438 70\u044530 (\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430\/\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430), \u043c\u043e\u0436\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/i><\/p>\n<pre><code class=\"python\">dataset = features[300000:].values TRAIN_SPLIT = 85000<\/code><\/pre>\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\/post\/495884\/\"> https:\/\/habr.com\/ru\/post\/495884\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/495884\/\">\u0423\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u0444\u043e\u043d\u0435 \u0432\u0441\u0435\u043e\u0431\u0449\u0435\u0439 \u0441\u0430\u043c\u043e\u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u0435\u0441\u044c\u043c\u0430 \u0434\u0443\u0440\u043d\u044b\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c. \u0418 \u044d\u043c\u043e\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0433\u043e\u0440\u0430\u043d\u0438\u0435 \u2013 \u044d\u0442\u043e \u0435\u0449\u0451 \u043a\u0443\u0434\u0430 \u043d\u0438 \u0448\u043b\u043e: \u0442\u0430\u043c \u0432\u0435\u0434\u044c \u0438 \u0434\u043e \u043a\u0440\u044b\u0448\u0438 \u043d\u0435\u0434\u0430\u043b\u0435\u043a\u043e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0438, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0435, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u00ab\u0443\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u00bb \u0441\u0435\u0431\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u044f \u2013 \u0438 \u043d\u0430\u0447\u0430\u043b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439: \u00ab\u0414\u0430\u0451\u0448\u044c <i>\u043c\u0430\u0448\u0438\u043d\u043b\u0451\u0440\u043d\u0438\u043d\u0433 <\/i>\u0432 \u043c\u0430\u0441\u0441\u044b!\u00bb.) \u041d\u0443\u0436\u043d\u043e \u0432\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u043e\u0435: \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0435\u0442. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u043e\u0432\u043e\u043c\u0443 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e, \u0442\u0430\u043a \u0438 \u043f\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f, \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-301358","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301358","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=301358"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301358\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}