CSVResultTracker

class CSVResultTracker(path: None | str | Path = None, name: str | None = None, **kwargs)[source]

Bases: FileResultTracker

Tracking results to a CSV file.

Also allows monitoring experiments, e.g. by

tail -f results.txt | grep "hits_at_10"

Initialize the tracker.

Parameters:
  • path (None | str | Path) – The path of the log file.

  • name (str | None) – The default file name for a file if no path is given. If no default is given, the current time is used.

  • kwargs – Additional keyword based arguments forwarded to csv.writer.

Attributes Summary

HEADER

The column names

extension

The file extension for this writer (do not include dot)

Methods Summary

log_metrics(metrics[, step, prefix])

Log metrics to result store.

log_params(params[, prefix])

Log parameters to result store.

start_run([run_name])

Start a run with an optional name.

Attributes Documentation

HEADER = ('type', 'step', 'key', 'value')

The column names

extension: ClassVar[str] = 'csv'

The file extension for this writer (do not include dot)

Methods Documentation

log_metrics(metrics: Mapping[str, float], step: int | None = None, prefix: str | None = None) None[source]

Log metrics to result store.

Parameters:
  • metrics (Mapping[str, float]) – The metrics to log.

  • step (int | None) – An optional step to attach the metrics to (e.g. the epoch).

  • prefix (str | None) – An optional prefix to prepend to every key in metrics.

Return type:

None

log_params(params: Mapping[str, Any], prefix: str | None = None) None[source]

Log parameters to result store.

Parameters:
Return type:

None

start_run(run_name: str | None = None) None[source]

Start a run with an optional name.

Parameters:

run_name (str | None)

Return type:

None