:py:mod:`mipcandy.evaluation`
=============================

.. py:module:: mipcandy.evaluation

.. autodoc2-docstring:: mipcandy.evaluation
   :allowtitles:

Module Contents
---------------

Classes
~~~~~~~

.. list-table::
   :class: autosummary longtable
   :align: left

   * - :py:obj:`EvalCase <mipcandy.evaluation.EvalCase>`
     - .. autodoc2-docstring:: mipcandy.evaluation.EvalCase
          :summary:
   * - :py:obj:`EvalResult <mipcandy.evaluation.EvalResult>`
     -
   * - :py:obj:`Evaluator <mipcandy.evaluation.Evaluator>`
     - .. autodoc2-docstring:: mipcandy.evaluation.Evaluator
          :summary:

API
~~~

.. py:class:: EvalCase
   :canonical: mipcandy.evaluation.EvalCase

   Bases: :py:obj:`object`

   .. autodoc2-docstring:: mipcandy.evaluation.EvalCase

   .. py:attribute:: metrics
      :canonical: mipcandy.evaluation.EvalCase.metrics
      :type: dict[str, float]
      :value: None

      .. autodoc2-docstring:: mipcandy.evaluation.EvalCase.metrics

   .. py:attribute:: output
      :canonical: mipcandy.evaluation.EvalCase.output
      :type: torch.Tensor
      :value: None

      .. autodoc2-docstring:: mipcandy.evaluation.EvalCase.output

   .. py:attribute:: label
      :canonical: mipcandy.evaluation.EvalCase.label
      :type: torch.Tensor
      :value: None

      .. autodoc2-docstring:: mipcandy.evaluation.EvalCase.label

   .. py:attribute:: image
      :canonical: mipcandy.evaluation.EvalCase.image
      :type: torch.Tensor | None
      :value: None

      .. autodoc2-docstring:: mipcandy.evaluation.EvalCase.image

   .. py:attribute:: filename
      :canonical: mipcandy.evaluation.EvalCase.filename
      :type: str | None
      :value: None

      .. autodoc2-docstring:: mipcandy.evaluation.EvalCase.filename

.. py:class:: EvalResult(metrics: dict[str, list[float]], outputs: list[torch.Tensor], labels: list[torch.Tensor], *, images: list[torch.Tensor] | None = None, filenames: list[str] | None = None)
   :canonical: mipcandy.evaluation.EvalResult

   Bases: :py:obj:`typing.Sequence`\ [\ :py:obj:`mipcandy.evaluation.EvalCase`\ ]

   .. py:method:: __len__() -> int
      :canonical: mipcandy.evaluation.EvalResult.__len__

      .. autodoc2-docstring:: mipcandy.evaluation.EvalResult.__len__

   .. py:method:: __getitem__(item: int) -> mipcandy.evaluation.EvalCase
      :canonical: mipcandy.evaluation.EvalResult.__getitem__

      .. autodoc2-docstring:: mipcandy.evaluation.EvalResult.__getitem__

   .. py:method:: _select(metric: str, n: int, descending: bool) -> typing.Generator[mipcandy.evaluation.EvalCase, None, None]
      :canonical: mipcandy.evaluation.EvalResult._select

      .. autodoc2-docstring:: mipcandy.evaluation.EvalResult._select

   .. py:method:: min(metric: str) -> mipcandy.evaluation.EvalCase
      :canonical: mipcandy.evaluation.EvalResult.min

      .. autodoc2-docstring:: mipcandy.evaluation.EvalResult.min

   .. py:method:: min_n(metric: str, n: int) -> tuple[mipcandy.evaluation.EvalCase, ...]
      :canonical: mipcandy.evaluation.EvalResult.min_n

      .. autodoc2-docstring:: mipcandy.evaluation.EvalResult.min_n

   .. py:method:: max(metric: str) -> mipcandy.evaluation.EvalCase
      :canonical: mipcandy.evaluation.EvalResult.max

      .. autodoc2-docstring:: mipcandy.evaluation.EvalResult.max

   .. py:method:: max_n(metric: str, n: int) -> tuple[mipcandy.evaluation.EvalCase, ...]
      :canonical: mipcandy.evaluation.EvalResult.max_n

      .. autodoc2-docstring:: mipcandy.evaluation.EvalResult.max_n

.. py:class:: Evaluator(*metrics: typing.Callable[[torch.Tensor, torch.Tensor], torch.Tensor])
   :canonical: mipcandy.evaluation.Evaluator

   Bases: :py:obj:`object`

   .. autodoc2-docstring:: mipcandy.evaluation.Evaluator

   .. rubric:: Initialization

   .. autodoc2-docstring:: mipcandy.evaluation.Evaluator.__init__

   .. py:method:: _evaluate_dataset(x: mipcandy.data.SupervisedDataset, *, prefilled_outputs: list[torch.Tensor] | None = None, prefilled_labels: list[torch.Tensor] | None = None) -> mipcandy.evaluation.EvalResult
      :canonical: mipcandy.evaluation.Evaluator._evaluate_dataset

      .. autodoc2-docstring:: mipcandy.evaluation.Evaluator._evaluate_dataset

   .. py:method:: evaluate_dataset(x: mipcandy.data.SupervisedDataset) -> mipcandy.evaluation.EvalResult
      :canonical: mipcandy.evaluation.Evaluator.evaluate_dataset

      .. autodoc2-docstring:: mipcandy.evaluation.Evaluator.evaluate_dataset

   .. py:method:: evaluate(outputs: mipcandy.types.SupportedPredictant, labels: mipcandy.types.SupportedPredictant) -> mipcandy.evaluation.EvalResult
      :canonical: mipcandy.evaluation.Evaluator.evaluate

      .. autodoc2-docstring:: mipcandy.evaluation.Evaluator.evaluate

   .. py:method:: predict_and_evaluate(x: mipcandy.types.SupportedPredictant, labels: mipcandy.types.SupportedPredictant, predictor: mipcandy.inference.Predictor) -> mipcandy.evaluation.EvalResult
      :canonical: mipcandy.evaluation.Evaluator.predict_and_evaluate

      .. autodoc2-docstring:: mipcandy.evaluation.Evaluator.predict_and_evaluate
