Skip to content

Instantly share code, notes, and snippets.

@susanli2016
Created February 12, 2019 03:35
Show Gist options
  • Save susanli2016/9fe872017209b66c9da34313934e6467 to your computer and use it in GitHub Desktop.
Save susanli2016/9fe872017209b66c9da34313934e6467 to your computer and use it in GitHub Desktop.
train_sc_df = pd.DataFrame(train_sc, columns=['Y'], index=train.index)
test_sc_df = pd.DataFrame(test_sc, columns=['Y'], index=test.index)
for s in range(1,2):
train_sc_df['X_{}'.format(s)] = train_sc_df['Y'].shift(s)
test_sc_df['X_{}'.format(s)] = test_sc_df['Y'].shift(s)
X_train = train_sc_df.dropna().drop('Y', axis=1)
y_train = train_sc_df.dropna().drop('X_1', axis=1)
X_test = test_sc_df.dropna().drop('Y', axis=1)
y_test = test_sc_df.dropna().drop('X_1', axis=1)
X_train = X_train.as_matrix()
y_train = y_train.as_matrix()
X_test = X_test.as_matrix()
y_test = y_test.as_matrix()
X_train_lmse = X_train.reshape(X_train.shape[0], X_train.shape[1], 1)
X_test_lmse = X_test.reshape(X_test.shape[0], X_test.shape[1], 1)
print('Train shape: ', X_train_lmse.shape)
print('Test shape: ', X_test_lmse.shape)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment