Additional metrics integrated with the TensorFlow and Keras Neural Network libraries.
As usual, just download it using pip:
pip install extra_keras_metrics
In addition to importing individual metrics, sets of metrics are also available.
To retrieve an instance of the set of multi-class metrics, use:
from extra_keras_metrics import get_minimal_multiclass_metrics
model = my_keras_model()
model.compile(
optimizer="nadam",
loss="categorical_crossentropy",
metrics=get_minimal_multiclass_metrics()
)
To retrieve an instance of the set of sparse multi-class metrics, use:
from extra_keras_metrics import get_sparse_multiclass_metrics
model = my_keras_model()
model.compile(
optimizer="nadam",
loss="sparse_categorical_crossentropy",
metrics=get_sparse_multiclass_metrics()
)
Note that currently, this only includes categorical accuracy, as it is the only one provided out-of-the-box by TensorFlow. More metrics are planned.
To retrieve an instance of the set of binary metrics, use:
from extra_keras_metrics import get_standard_binary_metrics
model = my_keras_model()
model.compile(
optimizer="nadam",
loss="binary_crossentropy",
metrics=get_standard_binary_metrics()
)
We have implemented a wide range of binary metrics, including some lesser-known ones. To include all available binary metrics, use:
from extra_keras_metrics import get_complete_binary_metrics
model = my_keras_model()
model.compile(
optimizer="nadam",
loss="binary_crossentropy",
metrics=get_complete_binary_metrics()
)
You might also enjoy these related packages: