drytorch.trackers.base_classes
Module containing abstract classes for trackers.
Classes
|
Abstract class for plotting trajectory from sources. |
|
Tracker with a standard folder structure. |
|
Keep all metrics in memory. |
Interface for trackers that load metrics. |
- class Dumper(par_dir: Path | None = None)[source]
Bases:
TrackerTracker with a standard folder structure.
- user_par_dir
parent directory for the tracker data.
- Type:
pathlib.Path | None
- _par_dir
parent directory set by experiment.
- Type:
pathlib.Path | None
Initialize.
- Parameters:
par_dir (Path | None) – the parent directory for the tracker data. Default uses the same of the current experiment.
- property par_dir: Path
Return the parent directory for the experiments.
- Raises:
AccessOutsideScopeError – when the default folder is not available.
- property run_id: str
Return the identifier for the experiment run.
- Raises:
AccessOutsideScopeError – when the id of the run is not available.
- property exp_name: str
Return the name of the experiment.
- Raises:
AccessOutsideScopeError – when the name id not available.
- notify(event: Event) None[source]
- notify(event: StartExperimentEvent) None
- notify(event: StopExperimentEvent) None
Notify the tracker of an event.
- Parameters:
event (Event) – the event to notify about.
- Return type:
None
- class MetricLoader[source]
-
Interface for trackers that load metrics.
- class MemoryMetrics(metric_loader: MetricLoader | None = None)[source]
Bases:
TrackerKeep all metrics in memory.
- model_dict
all metrics recorded in this session.
Initialize.
- Parameters:
metric_loader (MetricLoader | None) – object to load the metrics.
- notify(event: Event) None[source]
- notify(event: MetricEvent) None
- notify(event: LoadModelEvent) None
Notify the tracker of an event.
- Parameters:
event (Event) – the event to notify about.
- Return type:
None
- class BasePlotter(model_names: Iterable[str] = (), source_names: Iterable[str] = (), metric_names: Iterable[str] = (), start: int = 1, metric_loader: MetricLoader | None = None)[source]
Bases:
MemoryMetrics,ABC,Generic[Plot]Abstract class for plotting trajectory from sources.
- _model_names
names of the models to plot.
- Type:
- _source_names
names of the sources to plot.
- Type:
- _metric_names
names of the metrics to plot.
- Type:
Initialize.
- Parameters:
model_names (Iterable[str]) – the names of the models to plot. Defaults to all.
source_names (Iterable[str]) – the names of the sources to plot. Defaults to all.
metric_names (Iterable[str]) – the names of the metrics to plot. Defaults to all.
start (int) – if positive, the epoch from which to start plotting; if negative, the last number of epochs. Defaults to all.
metric_loader (MetricLoader | None) – a tracker that can load metrics from a previous run.
Note
start_epoch allows you to exclude the initial epochs from the graph. During the first 2 * start_epoch epochs, the graph is shown in its entirety.
- notify(event: Event) None[source]
- notify(event: EndEpochEvent) None
- notify(event: EndTestEvent) None
Notify the tracker of an event.
- Parameters:
event (Event) – the event to notify about.
- Return type:
None
- plot(model_name: str, source_names: Iterable[str] = (), metric_names: Iterable[str] = (), start_epoch: int = 1) list[Plot][source]
Plot the learning curves.
- Parameters:
- Returns:
References to the plot objects or windows depending on the backend.
- Raises:
ValueError – if start_epoch is less than 1.
ValueError – if the model is not found.
- Return type:
list[Plot]