API reference
mlflow_autogluon.autolog
Autologging support for AutoGluon.
Patches TabularPredictor.fit so that a single call to
:func:mlflow_autogluon.autolog records parameters, leaderboard metrics,
artifacts, and (optionally) the fitted predictor itself to MLflow, mirroring
the behavior of MLflow's built-in autologging integrations.
Because this is a community flavor, mlflow.autolog() does not enable it;
call mlflow_autogluon.autolog() explicitly before fitting.
autolog(log_models=True, log_model_signatures=True, log_input_examples=False, log_datasets=True, log_leaderboard=True, log_fit_summary=False, registered_model_name=None, extra_tags=None, disable=False, exclusive=False, disable_for_unsupported_versions=False, silent=False)
Enable automatic logging for AutoGluon TabularPredictor.fit calls.
After calling this function, every fit call logs to the active MLflow
run (a run is created automatically when none is active):
- Parameters: predictor configuration (label, problem type, eval metric) and fit arguments (presets, time_limit, hyperparameters, bagging and stacking settings, and so on).
- Metrics: validation score and fit time per trained model from the leaderboard, plus the best model's validation score and total fit time.
- Tags: AutoGluon version and best model name.
- Artifacts: the leaderboard as CSV, optionally the fit summary as JSON,
and the fitted predictor logged with the
autogluonflavor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_models
|
bool
|
If |
True
|
log_model_signatures
|
bool
|
If |
True
|
log_input_examples
|
bool
|
If |
False
|
log_datasets
|
bool
|
If |
True
|
log_leaderboard
|
bool
|
If |
True
|
log_fit_summary
|
bool
|
If |
False
|
registered_model_name
|
str | None
|
If given, logged models are also registered under this name in the model registry. |
None
|
extra_tags
|
dict[str, Any] | None
|
Dict of extra tags to set on autologged runs. |
None
|
disable
|
bool
|
If |
False
|
exclusive
|
bool
|
If |
False
|
disable_for_unsupported_versions
|
bool
|
If |
False
|
silent
|
bool
|
If |
False
|
Source code in mlflow_autogluon/autolog.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
mlflow_autogluon.flavor.save_model(ag_model, path, conda_env=None, code_paths=None, mlflow_model=None, signature=None, input_example=None, pip_requirements=None, extra_pip_requirements=None, metadata=None)
Save a fitted AutoGluon predictor to a local path in MLflow model format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ag_model
|
Any
|
Fitted |
required |
path
|
str
|
Local filesystem destination for the MLflow model. |
required |
conda_env
|
dict[str, Any] | str | None
|
Conda environment dict or path to a conda YAML file. |
None
|
code_paths
|
list[str] | None
|
Local code paths to package with the model. |
None
|
mlflow_model
|
Model | None
|
Existing :class: |
None
|
signature
|
ModelSignature | None
|
:class: |
None
|
input_example
|
Any | None
|
Example model input, saved alongside the model. |
None
|
pip_requirements
|
list[str] | str | None
|
Override for the default pip requirements. |
None
|
extra_pip_requirements
|
list[str] | str | None
|
Additional pip requirements. |
None
|
metadata
|
dict[str, Any] | None
|
Custom metadata dict stored in the MLmodel file. |
None
|
Source code in mlflow_autogluon/flavor.py
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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
mlflow_autogluon.flavor.log_model(ag_model, artifact_path=None, conda_env=None, code_paths=None, registered_model_name=None, signature=None, input_example=None, await_registration_for=DEFAULT_AWAIT_MAX_SLEEP_SECONDS, pip_requirements=None, extra_pip_requirements=None, metadata=None, name=None, **kwargs)
Log a fitted AutoGluon predictor as an MLflow artifact for the current run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ag_model
|
Any
|
Fitted |
required |
artifact_path
|
str | None
|
Run-relative artifact path (MLflow 2.x convention). |
None
|
name
|
str | None
|
Model name (MLflow 3.x convention). Falls back to |
None
|
registered_model_name
|
str | None
|
If given, register the model under this name. |
None
|
kwargs
|
Any
|
Remaining arguments are forwarded to :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
ModelInfo
|
class: |
Source code in mlflow_autogluon/flavor.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
mlflow_autogluon.flavor.load_model(model_uri, dst_path=None)
Load a native AutoGluon predictor from an MLflow model URI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_uri
|
str
|
URI of the MLflow model, e.g. |
required |
dst_path
|
str | None
|
Optional local destination for downloaded artifacts. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The restored AutoGluon predictor ( |
Any
|
|
Source code in mlflow_autogluon/flavor.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
mlflow_autogluon.flavor.get_default_pip_requirements(model_type=_MODEL_TYPE_TABULAR)
Return the default pip requirements for models produced by this flavor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_type
|
str
|
One of |
_MODEL_TYPE_TABULAR
|
Source code in mlflow_autogluon/flavor.py
104 105 106 107 108 109 110 111 | |
mlflow_autogluon.flavor.get_default_conda_env(model_type=_MODEL_TYPE_TABULAR)
Return the default conda environment for models produced by this flavor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_type
|
str
|
One of |
_MODEL_TYPE_TABULAR
|
Source code in mlflow_autogluon/flavor.py
114 115 116 117 118 119 120 | |