【发布时间】:2022-08-02 23:23:49
【问题描述】:
我使用了 4057 个样本的股票数据,将其分为 28 个时间步长,具有 25 个特征。
TrainX shape: (4057, 28, 25)
Target由5类整数组成
[0,1,2,3,4]
并重塑为:
trainX_reshape= trainX.reshape(4057,1, 28,25,1)
testX_reshape= testX.reshape(1334,1, 28,25,1)
试图拟合模型:
seq =Sequential([
ConvLSTM2D(filters=40, kernel_size=(3, 3),input_shape=(1, 28, 25, 1),padding=\'same\', return_sequences=True),
BatchNormalization(),
ConvLSTM2D(filters=40, kernel_size=(3, 3),padding=\'same\', return_sequences=True),
BatchNormalization(),
ConvLSTM2D(filters=40, kernel_size=(3, 3),padding=\'same\', return_sequences=True),
BatchNormalization(),
ConvLSTM2D(filters=40, kernel_size=(3, 3),padding=\'same\', return_sequences=True),
BatchNormalization(),
Conv3D(filters=5, kernel_size=(3, 3, 3),activation=\'sigmoid\',padding=\'same\', data_format=\'channels_last\')
])
编译
seq.compile(loss=\'sparse_categorical_crossentropy\', optimizer=\'rmsprop\')
history = seq.fit(trainX_reshape, trainY, epochs=10,
batch_size= 128, shuffle=False, verbose = 1,
validation_data=(testX_reshape, testY),
# validation_split=0.2)
它给出了错误:
InvalidArgumentError: Graph execution error:
如何解决?我尝试了很多方法,但没有任何线索。
代码和数据位于: https://drive.google.com/drive/folders/1WDa_CUO1Mr7wZTqE3wHsR0Tp_3NRMcZ6?usp=sharing
在 colab 上工作
标签: python tensorflow keras