Tensorflow: Evaluation of Binary Classifier with Unbalanced Data with metric tf.metrics.recall_at_thresholds
I am trying to evaluate a binary classifier trained on unbalanced data, in Tensorflow, and have problems using tf.metrics.recall_at_thresholds
one_hot_targets=tf.reshape(tf.one_hot(tf.cast(Y,tf.int32),2),[1,2]) #Y are labels
weights=tf.reshape(tf.transpose(tf.matmul(one_hot_targets,tf.transpose([[ratio,1.0ratio]]))),[1,1])
recalls=tf.metrics.recall_at_thresholds(labels=Y,predictions=func_8,thresholds=[0.2,0.3,0.4,0.6,0.7],weights=weights)
but this gives me the following error in Session.run()
:
Attempting to use uninitialized value recall_at_thresholds/true_positives
[[Node: recall_at_thresholds/true_positives/read = Identity[T=DT_FLOAT, _class=["loc:@recall_at_thresholds/true_positives"], _device="/job:localhost/replica:0/task:0/cpu:0"](recall_at_thresholds/true_positives)]]
Pleas note that both ratio and Y are passed using the feed dict in session.
1 answer

It seems you dint initialized the local and global variables associated
sess.run([tf.global_variables_initializer(), tf.local_variables_initializer()])