这是我在Keras中构建的神经网络。模型已经编译并训练过。当我尝试绘制历史记录的学习曲线时,只显示了一个空白窗口。
model = Sequential() model.add(Dense(64, input_dim=30, activity_regularizer=regularizers.l2(0.01))) model.add(BatchNormalization()) model.add(LeakyReLU()) model.add(Dropout(0.5)) model.add(Dense(16, activity_regularizer=regularizers.l2(0.01))) model.add(BatchNormalization()) model.add(LeakyReLU()) model.add(Dense(2)) model.add(Activation('softmax')) opt = Nadam(lr=0.001) reduce_lr = ReduceLROnPlateau(monitor='val_acc', factor=0.9, patience=25, min_lr=0.000001, verbose=1) checkpointer = ModelCheckpoint(filepath="test.hdf5", verbose=1, save_best_only=False) model.compile(optimizer=opt, loss='categorical_crossentropy', metrics=['accuracy']) history = model.fit(X_train, Y_train, nb_epoch = 1, batch_size = 128, verbose=1, validation_data=(X_test, Y_test), callbacks=[reduce_lr, checkpointer], shuffle=True) plt.plot(history.history['acc'])
当我打印history.history[‘acc’]时,它只是一个数字,而不是一个列表。如果你能帮我解决这个问题,我会很高兴的
回答:
尝试增加训练轮数