tf.metrics.precision函数tf.metrics.precision(
labels,
predictions,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None
)
定义在:tensorflow/python/ops/metrics_impl.py.
计算与labels相关的predictions的精度.
该precision函数创建两个局部变量,true_positives和false_positives,它们被用来计算精度.这个值最终返回为precision,这是一种幂等运算,简单的用true_positives除以true_positives和false_positives的和.
为了估计数据流上的度量,该函数创建一个update_op操作来更新这些变量并返回precision.update_op通过weights中相应的值对每个prediction进行加权.
如果weights是None,则权重默认为1,使用权重0来屏蔽值.
参数:
labels:正确标记(ground truth)的值,该Tensor的维度必须与predictions匹配,将被转换为bool.
predictions:预测值,任意维度的Tensor,将被转换为bool.
weights:可选的Tensor,其秩为0或与labels具有相同的秩,并且必须可广播到labels(即,所有维度必须为1或与相应的labels维度相同).
metrics_collections:precision应添加到的集合的可选列表.
updates_collections:upd