1.5.7 深度学习模型
1. 预处理
将训练和测试数据重新调整形状,以符合[LSTM的样本,时间步长,特征]的格式。这是因为LSTM模型需要输入数据的三维形状。重新调整后的形状为(X_train的样本数,时间步长,1)和(X_test的样本数,时间步长,1)。
X_train =X_train.reshape(X_train.shape[0],X_train.shape[1] , 1)
X_test = X_test.reshape(X_test.shape[0],X_test.shape[1] , 1)
print("X_train: ", X_train.shape)
print("X_test: ", X_test.shape)