The current tf.contrib.metrics.streaming_accuracyis able to calculate only the upper accuracy, and not the upper k. As a workaround, this is what I used:
tf.reduce_mean(tf.cast(tf.nn.in_top_k(predictions=predictions, targets=labels, k=5), tf.float32))
However, this does not allow me to calculate the accuracy of the streaming transmission averaged over each batch, which would be useful for obtaining a stable accuracy of the estimate. I am currently manually calculating this 5 streaming accuracy using its numpy output, but this means that I cannot visualize this metric on the tensor panel.
Is there a way to have a simpler implementation by creating a precision_update function, or is there an existing function that already does this?
Thank.
source
share