tf.metrics.average_precision_at_k如何在TensorFlow中运行?

时间:2018-04-24 14:19:50

标签: tensorflow

我有以下声明:

labels = tf.constant([1, 2, 5, 7, 3], dtype=tf.int64)
pred = tf.constant([1, 8, 2, 11, 3], dtype=tf.int64)

当我跑步时

metric = tf.metrics.average_precision_at_k(labels, pred, 5)
sess = tf.Session()
sess.run(tf.local_variables_initializer())
sess.run(metric)

我得到mean_average_precision 0.55

但是如果我创建以下常量

labels = tf.constant([80354115, 60265163, 10138163, 90299492, 10197671], dtype=tf.int64)
pred = tf.constant([80354115, 30297014, 60265163, 60296843, 10197671], dtype=tf.int64)

我得到mean_average_precision 0.0。那是为什么?

0 个答案:

没有答案