-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"FailedPreconditionError" upon using precision and recall metrics #21
Comments
FailedPreconditionError
upon using precision()
and recall()
as metrics
Hi @michael-ziedalski, thank you for the question. I can't reproduce an error with In the provided code I don't see any incorrect usages of the metrics, everything is just fine. |
Just wanted to say that I'm running into the same error on
I've attached a requirements.txt. I was running Python Here's the code:
|
I had the same issue. The problem is that you are using the TensorFlow version of Keras ( I need to use the TensorFlow version, so I got past the error by tricking from tensorflow.python import keras
import sys
sys.modules['keras'] = keras
sys.modules['keras.backend'] = keras.backend
import keras_metrics Still, all of the metrics are 0.0 when I run them, the variables are possibly not updated for some reason. |
Ah, you are all using with tf.Session() as s:
s.run(tf.global_variables_initializer())
model.fit(x=x, y=y, epochs=300) |
And I get non-zero metrics in the result: ...
Epoch 297/300
2000/2000 [==============================] - 0s 29us/sample - loss: 0.2461 - recall: 0.5432 - precision: 0.6111
Epoch 298/300
2000/2000 [==============================] - 0s 31us/sample - loss: 0.2461 - recall: 0.5369 - precision: 0.6035
Epoch 299/300
2000/2000 [==============================] - 0s 29us/sample - loss: 0.2461 - recall: 0.5329 - precision: 0.6066
Epoch 300/300 |
That works for me too. I realised that it gave me 0.0 because my label tensor was sparse (as opposed to one-hot) |
I wanted to run a simple model with precision and recall reported using
keras-metrics
, sincekeras
itself had removed them, but I get a pretty drastic error because of them. This is the code I am using. I hope I am not using precision and recall in a wrong way somehow?The text was updated successfully, but these errors were encountered: