On machinelearningmastery there is a post about how to create a supervised learning regression type dataset from one time series variable.
For example this:
time, measure
1, 100
2, 110
3, 108
4, 115
5, 120
Can be turned into this below after passing the data through a function series_to_supervised
X, y
?, 100
100, 110
110, 108
108, 115
115, 120
120, ?
In the Multi-Step or Sequence Forecasting section of the machinelearningmastery post, the series_to_supervised can output this below:
var1(t-2) var1(t-1) var1(t) var1(t+1)
2 0.0 1.0 2 3.0
3 1.0 2.0 3 4.0
4 2.0 3.0 4 5.0
5 3.0 4.0 5 6.0
6 4.0 5.0 6 7.0
7 5.0 6.0 7 8.0
8 6.0 7.0 8 9.0
My question is how would I define the X & y train test split? I am assuming the var1(t) would be the defined as y, right? For example would this be correct below for trainX & trainy? I am experimenting with
#function for time series X,y breakdown
train = series_to_supervised(need_to_train,11,14)
#split data sets
trainX = np.array(train.drop(['var1(t)'],1))
trainy = np.array(train['var1(t)'])
model = XGBRegressor(objective='reg:squarederror', n_estimators=100)