愉快的学习就从翻译开始吧_Multi-step Time Series Forecasting_5_Persistence Model_Make Forecasts
Make Forecasts/进行预测
The next step is to make persistence forecasts.下一步是进行持续预测We can implement the persistence forecast easily in a function named persistence() that takes the last observation and the number of forecast steps to persist. This function returns an array containing the forecast.我们可以用一个叫persistence()的函数来容易的实现持续预测,他接受最后一个观测值和预测步数来持续(预测)。
123 | # make a persistence forecastdef persistence(last_ob, n_seq): return [last_ob for i in range(n_seq)] |
We can then call this function for each time step in the test dataset from December in year 2 to September in year 3.我们可以为从第二年12月到第三年9月的测试数据集中的每一个时间步调用这个函数Below is a function make_forecasts() that does this and takes the train, test, and configuration for the dataset as arguments and returns a list of forecasts.下面是一个函数 make_forecasts(),它来执行此操作,并且它接受train,test,和 configuration for the dataset 作为参数,并且返回一个预测列表
12345678910 | # evaluate the persistence modeldef make_forecasts(train, test, n_lag, n_seq): forecasts = list() for i in range(len(test)): X, y = test[i, 0:n_lag], test[i, n_lag:] # make forecast forecast = persistence(X[-1], n_seq) # store the forecast forecasts.append(forecast) return forecasts |
We can call this function as follows:我们可以像下面这样调用这个函数:
1 | forecasts = make_forecasts(train, test, 1, 3) |
- 愉快的学习就从翻译开始吧_Multi-step Time Series Forecasting_8_Multi-Step LSTM Network_Prepare Data
- 愉快的学习就从翻译开始吧_Multi-step Time Series Forecasting_13_Multi-Step LSTM Network_Extensions&Summary
- 愉快的学习就从翻译开始吧_Multi-step Time Series Forecasting_9_Multi-Step LSTM Network_Fit LSTM Network
- 愉快的学习就从翻译开始吧_Multi-step Time Series Forecasting_11_Multi-Step LSTM Network_Invert Transforms
- 愉快的学习就从翻译开始吧_Multi-step Time Series Forecasting_12_Multi-Step LSTM Network_Complete Example
- 愉快的学习就从翻译开始吧_Multi-step Time Series Forecasting_7_Persistence Model_Complete Example
- 愉快的学习就从翻译开始吧_Multi-Step or Sequence Forecasting
- 愉快的学习就从翻译开始吧_How to Convert a Time Series to a Supervised Learning Problem in Python_0
- 愉快的学习就从翻译开始吧_How to Convert a Time Series to a Supervised Learning Problem in Python_2
- 愉快的学习就从翻译开始吧_How to Convert a Time Series to a Supervised Learning Problem in Python_3
- 愉快的学习就从翻译开始吧_traces_A Python library for unevenly-spaced time series analysis.
- 【翻译】从头开始写一个时间序列数据库-Writing a Time Series Database from Scratch
- 愉快的学习就从翻译开始吧_Multivariate Forecasting
- 愉快的学习就从翻译开始吧_A Gentle Introduction to RNN Unrolling
- 开始学习 limodou 的 Django step by step 了
- Time Series Forecasting
- 开始学习 limodou 的 Django step by step 了
- 学习Windows 编程,从MSDN翻译开始--2
- [翻译]无论什么时候开始学习都不会太迟
- 需要优化软件UI,so 沉寂许久之后开始学习界面的课程,把文档直接贴过来自己试着翻译