PyTorch-Ignite PyTorch-Ignite

Metrics

Ignite provides a list of out-of-the-box metrics for various Machine Learning tasks. Two way of computing metrics are supported :

  1. online
  2. storing the entire output history

Metrics can be attached to Engine:

from ignite.metrics import Accuracy

accuracy = Accuracy()

accuracy.attach(evaluator, "accuracy")

state = evaluator.run(validation_data)

print("Result:", state.metrics)
# > {"accuracy": 0.12345}

or can be used as stand-alone objects:

from ignite.metrics import Accuracy

accuracy = Accuracy()

accuracy.reset()

for y_pred, y in get_prediction_target():
    accuracy.update((y_pred, y))

print("Result:", accuracy.compute())

Complete list of metrics and the API can be found in ignite.metrics module.