perphyyoung
3/18/2019 - 12:59 PM

keras metrics

# ref: https://stackoverflow.com/questions/43076609/how-to-calculate-precision-and-recall-in-keras

import keras
import keras_metrics

model = models.Sequential()
model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2))
model.add(keras.layers.Dense(1, activation="softmax"))

model.compile(optimizer="sgd",
              loss="binary_crossentropy",
              metrics=[keras_metrics.precision(), keras_metrics.recall()])