drytorch.lib.evaluations
Module containing classes for the evaluation of a model.
Classes
|
Evaluate the model on inference mode without logging the metrics. |
|
Mixin for running inference in eval mode without gradients. |
|
Evaluate model performance on a test dataset. |
|
Evaluate model on inference mode. |
- class Diagnostic(model: ModelProtocol[Input, Output], name: str = '', *, loader: LoaderProtocol[tuple[Input, Target]], objective: _Objective_co)[source]
Bases:
EvaluationMixin,ModelRunnerWithLogs[Input,Target,Output,Any]Evaluate the model on inference mode without logging the metrics.
- model
the model containing the weights to evaluate.
- Type:
drytorch.core.protocols.ModelProtocol[drytorch.lib.runners.Input, drytorch.lib.runners.Output]
- loader
provides inputs and targets in batches.
- Type:
drytorch.core.protocols.LoaderProtocol[tuple[drytorch.lib.runners.Input, drytorch.lib.runners.Target]]
- objective
processes the model outputs and targets.
- Type:
drytorch.lib.runners._Objective_co
Initialize.
- Parameters:
model (ModelProtocol[Input, Output]) – the model containing the weights to evaluate.
name (str) – the name for the object for logging purposes. Defaults to class name plus eventual counter.
loader (LoaderProtocol[tuple[Input, Target]]) – provides inputs and targets in batches.
objective (_Objective_co) – processes the model outputs and targets.
- class EvaluationMixin(*args, **kwargs)[source]
Bases:
MonitorProtocolMixin for running inference in eval mode without gradients.
- class Test(model: ModelProtocol[Input, Output], name: str = '', *, loader: LoaderProtocol[tuple[Input, Target]], metric: ObjectiveProtocol[Output, Target])[source]
Bases:
Validation[Input,Target,Output]Evaluate model performance on a test dataset.
- model
the model containing the weights to evaluate.
- Type:
drytorch.core.protocols.ModelProtocol[drytorch.lib.runners.Input, drytorch.lib.runners.Output]
- loader
provides inputs and targets in batches.
- Type:
drytorch.core.protocols.LoaderProtocol[tuple[drytorch.lib.runners.Input, drytorch.lib.runners.Target]]
- objective
processes the model outputs and targets.
- Type:
drytorch.lib.runners._Objective_co
Initialize.
- Parameters:
model (ModelProtocol[Input, Output]) – the model containing the weights to evaluate.
name (str) – the name for the object for logging purposes. Defaults to class name plus eventual counter.
loader (LoaderProtocol[tuple[Input, Target]]) – provides inputs and targets in batches.
metric (ObjectiveProtocol[Output, Target]) – metric to evaluate the model.
- class Validation(model: ModelProtocol[Input, Output], name: str = '', *, loader: LoaderProtocol[tuple[Input, Target]], metric: ObjectiveProtocol[Output, Target])[source]
Bases:
EvaluationMixin,ModelRunnerWithLogs[Input,Target,Output,Any]Evaluate model on inference mode.
It could be used for testing (see subclass) or validating a model.
- model
the model containing the weights to evaluate.
- Type:
drytorch.core.protocols.ModelProtocol[drytorch.lib.runners.Input, drytorch.lib.runners.Output]
- loader
provides inputs and targets in batches.
- Type:
drytorch.core.protocols.LoaderProtocol[tuple[drytorch.lib.runners.Input, drytorch.lib.runners.Target]]
- objective
processes the model outputs and targets.
- Type:
drytorch.lib.runners._Objective_co
Initialize.
- Parameters:
model (ModelProtocol[Input, Output]) – the model containing the weights to evaluate.
name (str) – the name for the object for logging purposes. Defaults to class name plus eventual counter.
loader (LoaderProtocol[tuple[Input, Target]]) – provides inputs and targets in batches.
metric (ObjectiveProtocol[Output, Target]) – metric to evaluate the model.