Skip to content

Instantly share code, notes, and snippets.

@lylayang
Created March 15, 2020 07:27
Show Gist options
  • Save lylayang/c592aafd18175751e13a0f09766b362f to your computer and use it in GitHub Desktop.
Save lylayang/c592aafd18175751e13a0f09766b362f to your computer and use it in GitHub Desktop.
train_size = 900
train,test = df1.values[0:train_size,:], df1.values[train_size:len(df1.values),:]
look_back = 30 #create window size as look_back=30
test = np.append(test,np.repeat(test[-1,], look_back))
train = np.append(train,np.repeat(train[-1,],look_back))
trainX,trainY =convert2matrix(train,look_back)
testX,testY =convert2matrix(test, look_back)
# reshape input to be [samples, window size, features]
trainX = np.reshape(trainX, (trainX.shape[0], 1, trainX.shape[1]))
testX = np.reshape(testX, (testX.shape[0], 1, testX.shape[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment