Azure ML Experiment Tracking Verification: MLflow Integration

AI-300 By islever Editorial Last updated

Orchestrate model training Implement model registration and versioning

Short answer

The experiment is associated with 'classification-experiment' (Yes). The accuracy metric is NOT logged because the code lacks an mlflow.log_metric call (No). The model IS registered as an artifact via mlflow.sklearn.log_model (Yes).

Question

HOTSPOT
You train a model in Azure Machine Learning.
You plan to capture experiment details for later comparison. The training code must log parameters and metrics for each run.
You review the following training script.
Exhibit: Azure ML Experiment Tracking Verification: MLflow Integration
You need to verify whether the training script meets the experiment tracking requirement. For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Exhibit: Azure ML Experiment Tracking Verification: MLflow Integration

Key Takeaways

The main trap is assuming variable assignment equals metric logging; you must look for explicit mlflow.log_metric() calls to confirm data persistence.

Verify Azure Machine Learning experiment tracking by checking MLflow integration. The correct answer identifies that the experiment name is set correctly, but metrics must be explicitly logged, while models are logged as artifacts.

Common mistake: Learners often select 'Yes' for metric logging simply because the metric variable is calculated in the code. However, calculation does not equal logging; without the specific MLflow API call, the data is lost when the run ends.

Expert Analysis

The question requires verifying if the provided Azure Machine Learning training script meets three specific experiment tracking requirements. The analysis hinges on interpreting standard MLflow API calls within the context of Azure ML.

Statement 1: "The experiment is associated with 'classification-experiment'." The script contains mlflow.set_experiment("classification-experiment"). In MLflow, this function explicitly sets the active experiment for subsequent logging operations. Therefore, any metrics or parameters logged after this call are automatically associated with that named experiment. This statement is Yes.

Statement 2: "The accuracy metric is logged to the experiment." While the script calculates an accuracy variable (likely from a scikit-learn model evaluation), there is no corresponding mlflow.log_metric('accuracy', accuracy) or similar call in the visible code snippet. Logging the variable itself does not persist it to the experiment tracking system; an explicit logging function is required. Without this line, the metric is not captured. This statement is No.

Statement 3: "The model is registered as an artifact." The script includes mlflow.sklearn.log_model(model, "model"). This function logs the trained sklearn model object as an artifact under the name "model" within the current run. This satisfies the requirement to capture the model as an artifact for later comparison or deployment. This statement is Yes.

Thus, the correct selections are Yes, No, Yes.

Official Reference

Exam Strategy

When analyzing code snippets for MLflow compliance, scan specifically for three distinct API families: set_experiment, log_metric/log_param, and log_model. Do not assume implicit behavior; if a function call is missing, the capability is absent. For HOTSPOT questions, treat each bullet as an independent verification of code syntax against documentation standards.

Frequently Asked Questions

Does calculating a metric in Python code automatically log it to Azure ML?

No. Calculating a value like accuracy only stores it in a local variable. You must explicitly call mlflow.log_metric() to send that data to the experiment tracking service.

What is the difference between setting an experiment and logging a model?

mlflow.set_experiment defines the container (the experiment name) where data will go. mlflow.sklearn.log_model saves the actual model binary/artifact into the current run's history.

More AI-300 FAQ →

Discussion 4 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 4

  1. uncledana 👍 5
    YNY - makes sense, no experiment name is classification-experiment but artefact name is 'model'
  2. 03f65a8 👍 3
    Yes No Yes: mlflow.set_experiment("classification-experiment") --> experiment association, not artefact path definition mlflow.sklearn.log_model(model, "model") --> "model" is the artefact path.
  3. f5f9d28 👍 1
    NNY as you have not imported the accuracy metric at all log_model is hard coded to model so, it has no reference to classification- experiment
  4. exam_upskill 👍 1
    1. YES ✅ 2. NO ✅ 3. YES ✅ YES → NO → YES.

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

← Back to AI-300 Study Guide