Source From Here
Question
I am building a multi-class classifier with Keras 2.02 (with Tensorflow backend),and I do not know how to calculate precision and recall in Keras. Please help me.
How-To
Python package keras-metrics could be useful for this:
I am building a multi-class classifier with Keras 2.02 (with Tensorflow backend),and I do not know how to calculate precision and recall in Keras. Please help me.
How-To
Python package keras-metrics could be useful for this:
- import keras
- model = models.Sequential()
- model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2))
- model.add(keras.layers.Dense(1, activation="softmax"))
- m_preccision = keras.metrics.Precision()
- m_recall = keras.metrics.Recall()
- model.compile(optimizer="sgd",
- loss="binary_crossentropy",
- metrics = [m_preccision, m_recall])
沒有留言:
張貼留言