TensorFlow函數(shù):tf.metrics.recall

2018-10-16 14:21 更新

tf.metrics.recall函數(shù)

tf.metrics.recall(
    labels,
    predictions,
    weights=None,
    metrics_collections=None,
    updates_collections=None,
    name=None
)

定義在:tensorflow/python/ops/metrics_impl.py.

計(jì)算有關(guān)labels的predictions的recall.

該recall函數(shù)創(chuàng)建兩個(gè)局部變量,true_positives和false_negatives,它們被用于計(jì)算recall.這個(gè)值最終返回為recall,這是一個(gè)冪等操作,true_positives除以true_positives和false_negatives的和.

為了估計(jì)數(shù)據(jù)流上的度量,該函數(shù)創(chuàng)建一個(gè)update_op操作來(lái)更新這些變量并返回變量recall.update_op通過(guò)weights中相應(yīng)的值對(duì)每個(gè)預(yù)測(cè)進(jìn)行加權(quán).

如果weights是None,則權(quán)重默認(rèn)為1,使用權(quán)重0來(lái)屏蔽值.

參數(shù):

  • labels:正確標(biāo)記(ground truth),Tensor的維度必須匹配predictions,將被轉(zhuǎn)換為bool.
  • predictions:預(yù)測(cè)值,任意維度的Tensor,將被轉(zhuǎn)換為bool.
  • weights:可選的Tensor,其秩為0或與labels具有相同的秩,并且必須可廣播到labels(即,所有維度必須為1或者相應(yīng)的labels維度相同).
  • metrics_collections:recall應(yīng)添加到的集合的可選列表.
  • updates_collections:update_op應(yīng)添加到的集合的可選列表.
  • name:可選的variable_scope名稱.

返回:

  • recall:標(biāo)量浮點(diǎn)Tensor值,true_positives除以true_positives和false_negatives的和.
  • update_op:適當(dāng)增加true_positives和false_negatives變量的操作,其值匹配recall.

可能引發(fā)的異常:

  • ValueError:如果predictions和labels有不匹配的形狀,或者weights不是None,并且它的形狀不匹配predictions,或者如果metrics_collections或updates_collections中任意一個(gè)不是一個(gè)列表或元組.
  • RuntimeError:如果啟用了急切執(zhí)行.
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)