manager.trainer.get_path_model
manager.trainer.get_path_model(name, iteration, model_dir=None)
Yield the path to a model file for a given iteration and model name.
Parameters
| name |
str |
Model name (e.g. "lgbm", "xgb"). |
required |
| iteration |
int |
Iteration of the model. |
required |
| model_dir |
Optional[Union[str, Path]] |
Directory where models are stored. If None, defaults to :func:get_cache_home. |
None |
Returns
| Path |
Path |
Full path where the model file should be stored. |
Examples
>>> import tempfile
>>> from pathlib import Path
>>> from spotforecast2_safe.manager.trainer import get_path_model
>>> with tempfile.TemporaryDirectory() as tmpdir:
... p = get_path_model("lgbm", 3, model_dir=tmpdir)
... p.name
'lgbm_forecaster_3.joblib'