Functional
Reference information for the trainers Functional
API.
eva.core.trainers.functional.run_evaluation_session
Runs a downstream evaluation session out-of-place.
It performs an evaluation run (fit and evaluate) on the model
multiple times. Note that as the input base_trainer
and
base_model
would be cloned, the input object would not
be modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_trainer |
Trainer
|
The base trainer module to use. |
required |
base_model |
ModelModule
|
The base model module to use. |
required |
datamodule |
DataModule
|
The data module. |
required |
n_runs |
int
|
The amount of runs (fit and evaluate) to perform. |
1
|
verbose |
bool
|
Whether to verbose the session metrics instead of these of each individual runs and vice-versa. |
True
|
Source code in src/eva/core/trainers/functional.py
eva.core.trainers.functional.run_evaluation
Fits and evaluates a model out-of-place.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_trainer |
Trainer
|
The base trainer to use but not modify. |
required |
base_model |
ModelModule
|
The model module to use but not modify. |
required |
datamodule |
DataModule
|
The data module. |
required |
run_id |
str | None
|
The run id to be appended to the output log directory.
If |
None
|
verbose |
bool
|
Whether to print the validation and test metrics in the end of the training. |
True
|
Returns:
Type | Description |
---|---|
Tuple[_EVALUATE_OUTPUT, _EVALUATE_OUTPUT | None]
|
A tuple of with the validation and the test metrics (if exists). |
Source code in src/eva/core/trainers/functional.py
eva.core.trainers.functional.fit_and_validate
Fits and evaluates a model in-place.
If the test set is set in the datamodule, it will evaluate the model on the test set as well.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer |
Trainer
|
The trainer module to use and update in-place. |
required |
model |
ModelModule
|
The model module to use and update in-place. |
required |
datamodule |
DataModule
|
The data module. |
required |
verbose |
bool
|
Whether to print the validation and test metrics in the end of the training. |
True
|
Returns:
Type | Description |
---|---|
Tuple[_EVALUATE_OUTPUT, _EVALUATE_OUTPUT | None]
|
A tuple of with the validation and the test metrics (if exists). |
Source code in src/eva/core/trainers/functional.py
eva.core.trainers.functional.infer_model
Performs model inference out-of-place.
Note that the input base_model
and base_trainer
would
not be modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_trainer |
Trainer
|
The base trainer to use but not modify. |
required |
base_model |
ModelModule
|
The model module to use but not modify. |
required |
datamodule |
DataModule
|
The data module. |
required |
return_predictions |
bool
|
Whether to return the model predictions. |
False
|