In this example, tf.losses.mean_squared_error
is used for the loss
parameter of EstimatorSpec
, while tf.metrics.root_mean_squared_error
is used for eval_metric_ops
parameter.
Does anyone have ideas what is the main difference between tf.loss
and tf.metrics
?
A metric is a function that is used to judge the performance of your model. Metric functions are similar to loss functions, except that the results from evaluating a metric are not used when training the model. Note that you may use any loss function as a metric.
The accuracy function tf. metrics. accuracy calculates how often predictions matches labels based on two local variables it creates: total and count , that are used to compute the frequency with which logits matches labels .
A tf.loss
('s derivative) is used to update the model during backpropagation. tf.metric
s are for evaluating the model.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With