tf.metrics.accuracy(
labels,
predictions,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None
返回:
accuracy:A Tensor,表示准确性,值total除以count。
update_op:适当增加total和count变量并且使其值匹配accuracy的操作。
labels,
predictions,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None
)
定义于:tensorflow/python/ops/metrics_impl.py。
计算predictions匹配labels的情况。
该accuracy函数创建两个局部变量,total和count用于计算predictions匹配labels的情况。这个频率被最终返回为accuracy:total/count。
为了估计一连串的数据,该函数创建一个 update_op操作更新这些变量并返回accuracy。在内部,一个is_correct操作计算一个Tensor,当predictions和labels匹配时其中相应的元素为1.0,否则为0.0。然后update_op更新total和count的值。
如果weights是None,则权重默认为1.使用权重0来作为mask值。
参数:
labels:ground truth值,Tensor,其形状匹配 predictions。
predictions:预测值,任何形状的Tensor。
weights:可选,Tensor,其秩为0或与labels的秩相同,并且必须可广播到labels(即,所有维度必须1或者与相应的labels维度相同)。
metrics_collections:accuracy应添加到的可选集合列表。
updates_collections:update_op应添加到的可选集合列表。
name:可选的,variable_scope名称。返回:
accuracy:A Tensor,表示准确性,值total除以count。
update_op:适当增加total和count变量并且使其值匹配accuracy的操作。