问题描述
这是我的代码:
for it in range(EPOCH*24410//BATCH_SIZE):
tr_pa, tr_sp = sess.run([tr_para, tr_spec])
train_loss, _ = sess.run([loss, fw_op], feed_dict={x: tr_pa, y: tr_sp})
train_loss_.append(train_loss)
it_tr.append(it)
va_pa, va_sp = sess.run([va_para, va_spec])
validate_loss = sess.run(loss, feed_dict={x: va_pa, y: va_sp})
validate_loss_.append(validate_loss)
这是训练损失和验证损失:
This is the training loss and validation loss:
我的问题是我的验证码是否正确.这个模型适合吗?
My question is whether my validation code right or not. And does this model overfit?
推荐答案
过拟合的特征签名是指验证损失开始增加,而训练损失则继续减少,即:
The telltale signature of overfitting is when your validation loss starts increasing, while your training loss continues decreasing, i.e.:
(图片摘自Wikipedia上的过度拟合)
(Image adapted from Wikipedia entry on overfitting)
还有其他一些图表明过度拟合(源):
Here are some other plots indicating overfitting (source):
另请参见SO线程如何知道是否拟合不足还是过度拟合?.
很明显,您的绘图没有这种行为,因此您没有过拟合.
Clearly, your plot does not exhibit such behavior, hence you are not overfitting.
您的代码看起来还不错,请记住,您没有显示会话sess
中到底发生了什么.
Your code looks OK, keeping in mind that you don't show what exactly goes on inside your session sess
.
这篇关于我的训练和验证代码(tensorflow)是否正确,模型是否过拟合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!