2017-06-21 71 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

非常感謝! –