def init_cov_matrix_tf(predictions, correct_predictions):
true_pred = tf.boolean_mask(predictions, correct_predictions)
false_pred = tf.boolean_mask(predictions, tf.logical_not(correct_predictions))
truePos = tf.reduce_sum(tf.cast(tf.equal(true_pred, 1), tf.float32))
falsePos = tf.reduce_sum(tf.cast(tf.equal(false_pred, 1), tf.float32))
trueNeg = tf.reduce_sum(tf.cast(tf.equal(true_pred, 0), tf.float32))
falseNeg = tf.reduce_sum(tf.cast(tf.equal(false_pred, 0), tf.float32))
return (truePos, falsePos, trueNeg, falseNeg)
评论列表
文章目录