-
-
Save amankharwal/738eccc746a8599c7655afcec27464b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.preprocessing import MinMaxScaler | |
values = df_resample.values | |
scaler = MinMaxScaler(feature_range=(0, 1)) | |
scaled = scaler.fit_transform(values) | |
reframed = series_to_supervised(scaled, 1, 1) | |
r = list(range(df_resample.shape[1]+1, 2*df_resample.shape[1])) | |
reframed.drop(reframed.columns[r], axis=1, inplace=True) | |
reframed.head() | |
# Data spliting into train and test data series. Only 4000 first data points are selected for traing purpose. | |
values = reframed.values | |
n_train_time = 4000 | |
train = values[:n_train_time, :] | |
test = values[n_train_time:, :] | |
train_x, train_y = train[:, :-1], train[:, -1] | |
test_x, test_y = test[:, :-1], test[:, -1] | |
train_x = train_x.reshape((train_x.shape[0], 1, train_x.shape[1])) | |
test_x = test_x.reshape((test_x.shape[0], 1, test_x.shape[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment