'how to predict the future with keras model
I want to predict the next 6 hours using timeseriessplit from the scikit-learn library. How can I use timestamp with timeseriessplit ?
ts_cv = TimeSeriesSplit(
n_splits=5,
gap=48,
max_train_size=len(dataset) - 96,
test_size=96,
)
for trainIndex, testIndex in ts_cv.split(dataset_scaled):
Xtrain = dataset_scaled[trainIndex]
Xtest = dataset_scaled[testIndex]
Ytrain = dataset_scaled[trainIndex]
Ytest = dataset_scaled[testIndex]
For example, I cannot predict the future because timestamp cannot be determined here.
X_samples = list()
y_samples = list()
NumerOfRows = len(dataset)
TimeSteps=10
FutureTimeSteps=6
for i in range(TimeSteps , NumerOfRows-FutureTimeSteps , 1):
x_sample = dataset[i-TimeSteps:i]
y_sample = dataset[i:i+FutureTimeSteps]
X_samples.append(x_sample)
y_samples.append(y_sample)
TestingRecords=6
X_train=X_data[:-TestingRecords]
X_test=X_data[-TestingRecords:]
y_train=y_data[:-TestingRecords]
y_test=y_data[-TestingRecords:]
Normally it can be done by splitting it like this and giving the output 6. But I want to use it together with timeseriessplit
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
