Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def run(self):
from ignite.handlers import *
from ignite.metrics import *
from ignite.utils import *
from ignite.contrib.metrics.regression import *

manual_seed(666)

Expand Down
12 changes: 12 additions & 0 deletions ignite/contrib/metrics/regression/canberra_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ class CanberraMetric(_BaseRegression):
.. _`Botchkarev 2018`:
https://arxiv.org/ftp/arxiv/papers/1809/1809.03006.pdf

.. testcode::

metric = CanberraMetric()
metric.attach(default_evaluator, 'canberra')
y_pred = torch.Tensor([[3.8], [9.9], [-5.4], [2.1]])
y_true = y_pred * 1.5
state = default_evaluator.run([[y_pred, y_true]])
print(state.metrics['canberra'])

.. testoutput::

0.8000...
.. versionchanged:: 0.4.3

- Fixed implementation: ``abs`` in denominator.
Expand Down
12 changes: 12 additions & 0 deletions ignite/contrib/metrics/regression/fractional_absolute_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ class FractionalAbsoluteError(_BaseRegression):
metric's device to be the same as your ``update`` arguments ensures the ``update`` method is
non-blocking. By default, CPU.

.. testcode::

metric = FractionalAbsoluteError()
metric.attach(default_evaluator, 'fractional_abs_error')
y_pred = torch.Tensor([[3.8], [9.9], [-5.4], [2.1]])
y_true = y_pred * 0.8
state = default_evaluator.run([[y_pred, y_true]])
print(state.metrics['fractional_abs_error'])

.. testoutput::

0.2222...
.. versionchanged:: 0.4.5
- Works with DDP.
"""
Expand Down
13 changes: 13 additions & 0 deletions ignite/contrib/metrics/regression/fractional_bias.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ class FractionalBias(_BaseRegression):
metric's device to be the same as your ``update`` arguments ensures the ``update`` method is
non-blocking. By default, CPU.

.. testcode::

metric = FractionalBias()
metric.attach(default_evaluator, 'fractional_bias')
y_pred = torch.Tensor([[3.8], [9.9], [5.4], [2.1]])
y_true = y_pred * 1.5
state = default_evaluator.run([[y_pred, y_true]])
print(state.metrics['fractional_bias'])

.. testoutput::

0.4000...

.. versionchanged:: 0.4.5
- Works with DDP.
"""
Expand Down
12 changes: 12 additions & 0 deletions ignite/contrib/metrics/regression/geometric_mean_absolute_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ class GeometricMeanAbsoluteError(_BaseRegression):
metric's device to be the same as your ``update`` arguments ensures the ``update`` method is
non-blocking. By default, CPU.

.. testcode::

metric = GeometricMeanAbsoluteError()
metric.attach(default_evaluator, 'gmae')
y_pred = torch.Tensor([[3.8], [9.9], [-5.4], [2.1]])
y_true = y_pred * 1.5
state = default_evaluator.run([[y_pred, y_true]])
print(state.metrics['gmae'])

.. testoutput::

2.2723...
.. versionchanged:: 0.4.5
- Works with DDP.
"""
Expand Down