You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/how-to-log-view-metrics.md
+15-12Lines changed: 15 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,13 +49,11 @@ Logs can help you diagnose errors and warnings, or track performance metrics lik
49
49
```
50
50
* If you are doing remote tracking (tracking experiments running outside Azure Machine Learning), configure MLflow to track experiments using Azure Machine Learning. See [Configure MLflow for Azure Machine Learning](how-to-use-mlflow-configure-tracking.md) for more details.
51
51
52
-
## Getting started
52
+
* To log metrics, parameters, artifacts and models in your experiments in Azure Machine Learning using MLflow, just import MLflow in your script:
53
53
54
-
To log metrics, parameters, artifacts and models in your experiments in Azure Machine Learning using MLflow, just import MLflow in your training script:
55
-
56
-
```python
57
-
import mlflow
58
-
```
54
+
```python
55
+
import mlflow
56
+
```
59
57
60
58
### Configuring experiments
61
59
@@ -150,9 +148,6 @@ params = {
150
148
mlflow.log_params(params)
151
149
```
152
150
153
-
> [!NOTE]
154
-
> Azure Machine Learning SDK v1 logging can't log parameters. We recommend the use of MLflow for tracking experiments as it offers a superior set of features.
155
-
156
151
## Logging metrics
157
152
158
153
Metrics, as opposite to parameters, are always numeric. The following table describes how to log specific numeric types:
MLflow supports two ways of logging images. Both of them persists the given image as an artifact inside of the run.
187
182
188
183
|Logged Value|Example code| Notes|
189
184
|----|----|----|
190
185
|Log numpy metrics or PIL image objects|`mlflow.log_image(img, "figure.png")`|`img` should be an instance of `numpy.ndarray` or `PIL.Image.Image`. `figure.png` is the name of the artifact that will be generated inside of the run. It doesn't have to be an existing file.|
191
186
|Log matlotlib plot or image file|` mlflow.log_figure(fig, "figure.png")`|`figure.png` is the name of the artifact that will be generated inside of the run. It doesn't have to be an existing file. |
192
187
193
-
## Logging other types of data
188
+
## Logging files
189
+
190
+
In general, files in MLflow are called artifacts. You can log artifacts in multiple ways in Mlflow:
194
191
195
192
|Logged Value|Example code| Notes|
196
193
|----|----|----|
@@ -199,12 +196,18 @@ MLflow supports two ways of logging images:
199
196
|Log a trivial file already existing |`mlflow.log_artifact("path/to/file.pkl")`| Files are always logged in the root of the run. If `artifact_path` is provided, then the file is logged in a folder as indicated in that parameter. |
200
197
|Log all the artifacts in an existing folder |`mlflow.log_artifacts("path/to/folder")`| Folder structure is copied to the run, but the root folder indicated is not included. |
201
198
199
+
> [!TIP]
200
+
> When __loggiging large files__, you may encounter the error `Failed to flush the queue within 300 seconds`. Usually, it means the operation is timing out before the upload of the file is completed. Consider increasing the timeout value by adjusting the environment variable `AZUREML_ARTIFACTS_DEFAULT_VALUE`.
201
+
202
202
## Logging models
203
203
204
204
MLflow introduces the concept of "models" as a way to package all the artifacts required for a given model to function. Models in MLflow are always a folder with an arbitrary number of files, depending on the framework used to generate the model. Logging models has the advantage of tracking all the elements of the model as a single entity that can be __registered__ and then __deployed__. On top of that, MLflow models enjoy the benefit of [no-code deployment](how-to-deploy-mlflow-models.md) and can be used with the [Responsible AI dashboard](how-to-responsible-ai-dashboard.md) in studio. Read the article [From artifacts to models in MLflow](concept-mlflow-models.md) for more information.
205
205
206
206
To save the model from a training run, use the `log_model()` API for the framework you're working with. For example, [mlflow.sklearn.log_model()](https://mlflow.org/docs/latest/python_api/mlflow.sklearn.html#mlflow.sklearn.log_model). For more details about how to log MLflow models see [Logging MLflow models](how-to-log-mlflow-models.md) For migrating existing models to MLflow, see [Convert custom models to MLflow](how-to-convert-custom-model-to-mlflow.md).
207
207
208
+
> [!TIP]
209
+
> When __loggiging large models__, you may encounter the error `Failed to flush the queue within 300 seconds`. Usually, it means the operation is timing out before the upload of the model artifacts is completed. Consider increasing the timeout value by adjusting the environment variable `AZUREML_ARTIFACTS_DEFAULT_VALUE`.
210
+
208
211
## Automatic logging
209
212
210
213
With Azure Machine Learning and MLflow, users can log metrics, model parameters and model artifacts automatically when training a model. Each framework decides what to track automatically for you. A [variety of popular machine learning libraries](https://mlflow.org/docs/latest/tracking.html#automatic-logging) are supported. [Learn more about Automatic logging with MLflow](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.autolog).
@@ -216,7 +219,7 @@ mlflow.autolog()
216
219
```
217
220
218
221
> [!TIP]
219
-
> You can control what gets automatically logged wit autolog. For instance, if you indicate `mlflow.autolog(log_models=False)`, MLflow will log everything but models for you. Such control is useful in cases where you want to log models manually but still enjoy automatic logging of metrics and parameters. Also notice that some frameworks may disable automatic logging of models if the trained model goes behond specific boundaries. Such behavior depends on the flavor used and we recommend you to view they documentation if this is your case.
222
+
> You can control what gets automatically logged with autolog. For instance, if you indicate `mlflow.autolog(log_models=False)`, MLflow will log everything but models for you. Such control is useful in cases where you want to log models manually but still enjoy automatic logging of metrics and parameters. Also notice that some frameworks may disable automatic logging of models if the trained model goes behond specific boundaries. Such behavior depends on the flavor used and we recommend you to view they documentation if this is your case.
0 commit comments