假设我们想要改变Abalone regression example,这样就有了一个额外的求值度量。称为pctWrong
的度量等于误差大于1%的预测百分比:
=== pseudocode ===
pctWrong = countTrue(if (|y-y_hat|/y > 1%) True else False) / countTotal
=== Python ===
105 # Calculate additional eval metrics
106 eval_metric_ops = {
107 "rmse": tf.metrics.root_mean_squared_error(
108 tf.cast(labels, tf.float64), predictions),
109 "pctWrong": ???
110 }
你将如何定义这样的度量?我找到了tf.metrics.percentage_below(),这可能会有帮助,但我不知道如何使用它。尤其是我不知道如何获得它的values
参数。你知道吗
更新:毕竟没那么难。下面的代码有点粗糙,但很有效。你知道吗
相关问题 更多 >
编程相关推荐