2017-06-21 76 views
1

我在tensorflow网站上发现了一些示例代码,如下所示。机器学习中的“培训损失”是什么意思?

input_fn = tf.contrib.learn.io.numpy_input_fn({"x":x_train}, y_train, batch_size=4, num_epochs=1000) 
eval_input_fn = tf.contrib.learn.io.numpy_input_fn({"x":x_eval}, y_eval, batch_size=4, num_epochs=1000) 

# We can invoke 1000 training steps by invoking the method and passing the 
# training data set. 
estimator.fit(input_fn=input_fn, steps=1000) 

# Here we evaluate how well our model did. 
train_loss = estimator.evaluate(input_fn=input_fn) 
eval_loss = estimator.evaluate(input_fn=eval_input_fn) 

print("train loss: %r"% train_loss) 
print("eval loss: %r"% eval_loss) 

你能告诉我'培训损失'是什么意思吗?

回答

2

训练损失是训练数据的损失。损失是一个函数,它接受正确的输出和模型输出并计算它们之间的误差。然后根据错误的大小以及哪些元素对它贡献最大来使用损失来调整权重。

+1

非常感谢! –