当我使用传统的BP神经网络进行深度学习时,我总是得到误差曲线的平坦曲线。我使用的是Keras序列模型和Adam optimiser。神经网络在训练和测试中提供了80%的总体准确率。谁能解释为什么误差曲线是平坦的(见附图)?另外,有什么方法可以提高我的成绩吗?
def build_model():
model = keras.Sequential()
model.add(layers.Dense(128, activation=tf.nn.relu, input_shape=len(normed_train_data.keys())]))
model.add(layers.Dense(128,activation=tf.nn.relu, input_shape=(1,)))
model.add(layers.Dense(4))
model.compile(loss='mean_squared_error', optimizer='Adam',metrics=['mae', 'mse','accuracy'])
return model
def plot_history(history):
hist = pd.DataFrame(history.history)
hist['epoch'] = history.epoch
plt.figure()
plt.xlabel('Epoch')
plt.ylabel('Mean Abs Error [per]')
plt.plot(hist['epoch'], hist['mean_absolute_error'],label='Train Error')
plt.plot(hist['epoch'], hist['val_mean_absolute_error'],label = 'Val Error')
plt.legend()
plt.ylim([0,200])
plt.show()在main函数中,
model = build_model()
model.summary()
history = model.fit(normed_train_data, train_labels,epochs=EPOCHS,validation_split = 0.2, verbose=0,callbacks=[PrintDot()])
hist = pd.DataFrame(history.history)
hist['epoch'] = history.epoch
plot_history(history)错误图:

发布于 2019-02-27 17:47:48
如果没有更多关于你的数据的信息,很难评估你能分享一个样本吗?但我敢说你的模型很快就不适合了。你可以尝试的东西:
学习优化器模型简化--尝试移除一个层,或者为starters
https://stackoverflow.com/questions/54898795
复制相似问题