save_model¶
yohou_mlflow.save_model(forecaster, path, *, extra_trusted_types=None, extra_trusted_prefixes=None, extra_version_rules=None, signature=None, conda_env=None, mlflow_model=None, pip_requirements=None, extra_pip_requirements=None, metadata=None)
¶
Save a fitted yohou forecaster as an MLflow model directory.
The forecaster is written with skops, never pickle. Before anything is kept, the written file is checked against the trust policy and loaded back, and its predictions are compared with the original's. Any failure removes the directory.
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
forecaster
|
yohou forecaster
|
A fitted yohou forecaster, including the state it accumulated through
|
required |
path
|
str or path - like
|
Directory to create. It must not exist, or must be empty. |
required |
extra_trusted_types
|
iterable of str or None
|
Exact type names to trust in addition to the built-in policy, for example a third-party regressor inside the forecaster. They are not stored: pass the same names every time the model is loaded. |
None
|
extra_trusted_prefixes
|
iterable of str or None
|
Module prefixes to trust, each ending in |
None
|
extra_version_rules
|
mapping of str to str or None
|
Distribution name to |
None
|
signature
|
ModelSignature or None
|
Optional signature. It may carry outputs and extra params, but no inputs. The flavour's four params are always added. |
None
|
conda_env
|
(dict, str or None)
|
Conda environment, as for MLflow's built-in flavours. |
None
|
mlflow_model
|
Model or None
|
Model configuration to add the flavour to. Used by |
None
|
pip_requirements
|
iterable of str, str or None
|
Replaces the default pip requirements. |
None
|
extra_pip_requirements
|
iterable of str, str or None
|
Added to the default pip requirements. |
None
|
metadata
|
dict or None
|
Custom metadata stored in the |
None
|
Raises ¶
| Type | Description |
|---|---|
TypeError
|
If |
NotFittedError
|
If |
ValueError
|
If |
UntrustedTypesError
|
If the forecaster holds types outside the trust policy and the caller's additions. |
SaveVerificationError
|
If the written model cannot be loaded back, fails to predict once reloaded, or loads back with different predictions. |
See Also ¶
log_model: Save the forecaster into an MLflow run and optionally register it.load_model: Load a saved forecaster.
Source Code ¶
Source code in src/yohou_mlflow/_persistence.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |