quantlab.tracking.base.Tracker#
- class quantlab.tracking.base.Tracker(*, project=None)[source]#
-
Where tracking runs are sent; the root of every tracker.
A tracker is a frozen dataclass of its settings, so it compares by value and serialises by its fields plus its class path. Credentials never appear among them: adapters read those from environment variables.
- Attributes:
- projectstr, optional
The project every run goes to; when
Nonethe caller’s default project is used (the model class name,{Class}_backtestfor a backtest).
Examples
>>> tracker = NullTracker(project="momentum_research") >>> with tracker.start_run( ... project="XGBoostRegressor", ... group="XGBoostRegressor_trial_20261001", ... name="XGBoostRegressor_total", ... config={"max_depth": 6}, ... ) as run: ... run.log({"val_rmse": 0.02}, step=0)
- property config#
The tracker itself: its fields are its config.
Examples
>>> NullTracker(project="p").config NullTracker(project='p')
- classmethod from_config(config, run_dir=None)[source]#
Rebuild the tracker from the dict
get_config()returned.A tracker is constructed from its fields, not from a config object; an unknown key is refused (see
quantlab.core.component).- Parameters:
- configMapping[str, Any]
The dict
get_config()returned, for example read back from a run’sconfig.json.- run_dirstr or os.PathLike, optional
Unused: a tracker holds no dataset.
- Raises:
- ValueError
If
configholds a key the tracker does not have.
Examples
>>> NullTracker.from_config({"project": "p", "name": "quantlab.tracking.base.NullTracker"}) NullTracker(project='p')
- start_run(*, project, group, name, config)[source]#
Open a tracking run, yield it and finish it when the block is left.
The run is finished also when the block raises, and the block’s exception propagates; an error while finishing that run is logged instead of replacing it.
- Parameters:
- projectstr
The caller’s default project, replaced by the tracker’s own
projectwhen that is set.- groupstr or None
The group the run belongs to, such as a trial directory’s name.
- namestr
The run’s name.
- configMapping[str, Any]
The run’s config, made JSON-safe before it is sent.
- Yields:
- TrackingRun
The open run.
Examples
>>> with NullTracker().start_run( ... project="XGBoostRegressor", group=None, name="XGBoostRegressor_total", config={} ... ) as run: ... run.summarize({"test_ic": 0.03})