DatabricksAssociate levelPage 2 of 7

Databricks Machine Learning Associate exam dumps: questions 101 to 200 of 655

Page 2 of the free Databricks Machine Learning Associate question bank for the Databricks Certified Machine Learning Associate exam. Questions 101 to 200 are listed below, the first 5 in full with answers and explanations. Back to page 1 for the exam overview and FAQ.

Question bank last updated January 2025

Free Databricks Machine Learning Associate practice questions

Questions 101 to 105 of 655

Pick an answer before you open the explanation. Each question also has its own page with a permalink.

Databricks Machine Learning Associate Question 101

Single answer

You are training a machine learning model and want to manually log metrics, artifacts, and the trained model to MLflow using a single run. Which of the following code snippets correctly logs these components to an MLflow run?

  1. A

    mlflow.start_run(); mlflow.log_metric('accuracy', 0.95); mlflow.log_artifact('model_description.txt'); mlflow.sklearn.log_model(model, 'model'); mlflow.end_run()

  2. B

    with mlflow.start_run(): mlflow.log_metric('accuracy', 0.95); mlflow.log_artifact('model_description.txt'); mlflow.sklearn.log_model(model, 'model')

  3. C

    mlflow.start_run(): mlflow.log_metric('accuracy', 0.95); mlflow.log_artifact('model_description.txt'); mlflow.sklearn.log_model(model, 'model')

  4. D

    mlflow.start_run(); mlflow.log_metric('accuracy', 0.95); mlflow.log_artifact('model_description.txt'); mlflow.sklearn.log_model(model, 'model')

Show answer and explanation

Correct answer: B

Explanation

The with mlflow.start_run() context manager is the recommended and simplest way to manage an MLflow run. It ensures that the run is properly started and ended, avoiding any potential issues with forgetting to end the run manually. Within the with block, you can log metrics, artifacts, and models to the MLflow tracking server. Other approaches either have syntax errors or require additional steps to manage the run lifecycle.

  • A. Incorrect.

    This option is invalid because mlflow.end_run() is not required when using the with statement. Additionally, using mlflow.start_run() without the with statement requires additional management of ending the run.

  • B. Correct.

    This option is correct because it uses the with mlflow.start_run() context manager, which automatically starts and ends the MLflow run. It correctly logs the metric, artifact, and model within the same run.

  • C. Incorrect.

    This option is invalid because the syntax mlflow.start_run(): is incorrect. A colon cannot be used with a function call.

  • D. Incorrect.

    This option is invalid because it does not use the with statement or call mlflow.end_run() to properly manage the lifecycle of the MLflow run.

Databricks Machine Learning Associate Question 102

Select 4

You are training a machine learning model using Databricks and want to use MLflow to manually track your experiment's performance. Which of the following steps should you take to log metrics, artifacts, and the trained model within an MLflow run?

  1. A

    Use mlflow.start_run() to initiate a run and log metrics using mlflow.log_metric().

  2. B

    Use mlflow.log_param() to log hyperparameters used in the training process.

  3. C

    Save the trained model locally and manually upload it to the MLflow tracking server.

  4. D

    Log artifacts such as confusion matrices or feature importance plots using mlflow.log_artifacts().

  5. E

    Log the model using mlflow.log_model() to save it with the run for reproducibility.

Show answer and explanation

Correct answers: A, B, D, E

Explanation

To manually log metrics, parameters, artifacts, and models in MLflow, you must first start a run using mlflow.start_run(). Metrics are logged using mlflow.log_metric(), parameters with mlflow.log_param(), and artifacts with mlflow.log_artifacts(). The model should be logged using mlflow.log_model() to ensure it is associated with the run and available for later use. Saving the model locally without logging it with MLflow does not meet the requirement for manual tracking in MLflow.

  • A. Correct.

    Correct: mlflow.start_run() initializes an MLflow run, and mlflow.log_metric() is used to log metrics such as accuracy or loss.

  • B. Correct.

    Correct: mlflow.log_param() is used to record hyperparameters, such as learning rates or batch sizes, which are crucial for experiment tracking.

  • C. Incorrect.

    Incorrect: While you can save the model locally, it must be logged into MLflow using mlflow.log_model() to properly associate it with the run.

  • D. Correct.

    Correct: mlflow.log_artifacts() is used to log artifacts like plots or datasets, which are valuable for model evaluation and debugging.

  • E. Correct.

    Correct: mlflow.log_model() allows you to log and save the trained model with the MLflow run, enabling versioning and deployment capabilities.

Databricks Machine Learning Associate Question 103

Single answer

You are training a machine learning model and want to manually log the model’s accuracy, the training data as an artifact, and the trained model itself in an MLflow Run. Which sequence of actions is the most appropriate to achieve this?

  1. A

    Start an MLflow run, use mlflow.log_metric to log the accuracy, mlflow.log_artifact to log the training data, and mlflow.sklearn.log_model to log the trained model.

  2. B

    Start an MLflow run, use mlflow.log_param to log the accuracy, mlflow.log_artifacts to log the training data, and mlflow.pyfunc.log_model to log the trained model.

  3. C

    Start an MLflow run, use mlflow.log_metric to log the accuracy, mlflow.log_artifacts to log the training data, and mlflow.log_model to log the trained model.

  4. D

    Start an MLflow run, use mlflow.log_metric to log the accuracy, mlflow.log_artifact to log the training data, and mlflow.log_params to log the trained model.

Show answer and explanation

Correct answer: A

Explanation

To manually log metrics, artifacts, and models in MLflow, you need to use the correct functions for each task. mlflow.log_metric is used for logging numerical metrics, mlflow.log_artifact is for logging single files, and mlflow.sklearn.log_model is specifically designed for logging scikit-learn models. Ensuring that each function is used appropriately is essential for effectively tracking your machine learning experiments.

  • A. Correct.

    This is the correct option. mlflow.log_metric is used to log numerical metrics like accuracy, mlflow.log_artifact is for logging a single file (e.g., the training data), and mlflow.sklearn.log_model is appropriate for logging models trained using scikit-learn.

  • B. Incorrect.

    mlflow.log_param is used for logging parameters (key-value pairs), not metrics like accuracy, making this option incorrect.

  • C. Incorrect.

    mlflow.log_artifacts is used to log multiple files or a directory, not a single file like the training data in this scenario, making this option incorrect.

  • D. Incorrect.

    mlflow.log_params is used for logging parameters (key-value pairs), not models, making this option incorrect.

Databricks Machine Learning Associate Question 104

Select 4

You are training a machine learning model using Databricks and want to manually log the model's metrics, artifacts, and the final model to MLflow. Which of the following actions must you take to ensure proper logging within an MLflow Run?

  1. A

    Start an MLflow run using mlflow.start_run() before logging metrics, artifacts, or models.

  2. B

    Use mlflow.log_metric() to log key performance metrics such as accuracy or loss.

  3. C

    Call mlflow.end_run() immediately after logging metrics to ensure they are saved.

  4. D

    Use mlflow.log_artifact() to log files such as plots, datasets, or model-related files.

  5. E

    Call mlflow.log_model() to log the trained machine learning model into MLflow.

Show answer and explanation

Correct answers: A, B, D, E

Explanation

To manually log metrics, artifacts, and models in an MLflow Run, you need to start an MLflow run using mlflow.start_run(), then log metrics, artifacts, and models using the appropriate MLflow logging functions. Calling mlflow.end_run() is not required immediately after any logging operation, it can be invoked after all logging is complete. Each logging function serves a specific purpose: metrics for performance tracking, artifacts for file storage, and models for saving the trained model.

  • A. Correct.

    This is correct. An MLflow run must be started using mlflow.start_run() to create a context for logging metrics, artifacts, and models.

  • B. Correct.

    This is correct. The mlflow.log_metric() function is used to log metrics like accuracy or loss during an MLflow run.

  • C. Incorrect.

    This is incorrect. Calling mlflow.end_run() is optional and can be done after all logging is complete. You do not need to call it immediately after logging metrics.

  • D. Correct.

    This is correct. The mlflow.log_artifact() function allows you to log files such as plots, datasets, or model-related files during an MLflow run.

  • E. Correct.

    This is correct. The mlflow.log_model() function is used to save the trained machine learning model to MLflow for reproducibility and deployment.

Databricks Machine Learning Associate Question 105

Select 3

You are developing a machine learning pipeline in Databricks and want to track the performance of multiple models trained within a single pipeline execution. You decide to use nested MLflow runs to organize the tracking data. Which of the following steps are required to correctly create and log nested runs in MLflow?

  1. A

    Start a parent MLflow run using mlflow.start_run() and set 'nested=True'.

  2. B

    Start the parent MLflow run without any arguments using mlflow.start_run().

  3. C

    Start a child MLflow run using mlflow.start_run(nested=True) within the context of an active parent run.

  4. D

    Log metrics and parameters for the child runs only after calling mlflow.end_run() on the parent run.

  5. E

    Ensure that mlflow.end_run() is called for each child run before ending the parent run.

Show answer and explanation

Correct answers: B, C, E

Explanation

To create nested MLflow runs, the parent run must first be started using mlflow.start_run() without the 'nested=True' argument. Within the active parent run, nested child runs can be created by calling mlflow.start_run(nested=True). Each child run should be ended with mlflow.end_run() before ending the parent run to ensure proper tracking and organization of metrics and parameters across all runs.

  • A. Incorrect.

    This is incorrect because the 'nested=True' argument is only applicable when creating child runs and not for parent runs.

  • B. Correct.

    This is correct because the parent MLflow run must be started without the 'nested=True' argument, as it is a standalone run.

  • C. Correct.

    This is correct because nested child runs are created by passing 'nested=True' when calling mlflow.start_run() within the context of an active parent run.

  • D. Incorrect.

    This is incorrect because metrics and parameters can be logged to child runs while the parent run is still active. Ending the parent run is not a prerequisite for logging child run data.

  • E. Correct.

    This is correct because each child run must be properly ended by calling mlflow.end_run() before ending the parent run to maintain proper organization and avoid tracking errors.

Timed practice exam

Take a Databricks Machine Learning Associate practice test under exam conditions

48 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam

Databricks Machine Learning Associate practice questions 101 to 200 of 655

Every question has a page with the answer and explanation. Numbers are stable, so you can bookmark or share them. The bank is split into 7 pages of up to 100 questions.

  1. 101.You are training a machine learning model and want to manually log metrics, artifacts, and the trained model...
  2. 102.You are training a machine learning model using Databricks and want to use MLflow to manually track your...
  3. 103.You are training a machine learning model and want to manually log the model’s accuracy, the training data as...
  4. 104.You are training a machine learning model using Databricks and want to manually log the model's metrics,...
  5. 105.You are developing a machine learning pipeline in Databricks and want to track the performance of multiple...
  6. 106.You are training a machine learning model in Databricks and want to track separate stages of your experiment,...
  7. 107.You are working on a machine learning project in Databricks and want to organize your MLflow tracking runs...
  8. 108.You are training a machine learning model in Databricks and decide to log metrics and parameters for multiple...
  9. 109.You are training a machine learning model in Databricks and want to track different components of your...
  10. 110.While using the MLflow UI to analyze a recently completed model training run, how can you locate the time the...
  11. 111.You are reviewing the MLflow UI for a completed experiment run in Databricks. You need to locate the exact...
  12. 112.You are working on a Databricks project and have logged several MLflow runs to track the performance of your...
  13. 113.You are using MLflow to track experiments in Databricks. You need to locate the exact time a specific run was...
  14. 114.You are using Databricks and have logged multiple runs of your machine learning experiments in the MLflow UI....
  15. 115.You are using MLflow Tracking in Databricks and need to locate the code that was executed for a specific run...
  16. 116.You are working on a machine learning project in Databricks using MLflow, and you want to locate the code...
  17. 117.You are using MLflow to track experiments in a Databricks workspace. After running several experiments, you...
  18. 118.You are managing machine learning experiment runs in Databricks, and you want to locate the code that was...
  19. 119.You have trained a machine learning model using Databricks and logged the training run using MLflow. You want...
  20. 120.You are working on a machine learning project in Databricks and have successfully trained a model. You now...
  21. 121.You are working on a machine learning project using Databricks and have trained a model that you want to...
  22. 122.You are working on a machine learning project in Databricks and have trained a model that you want to...
  23. 123.You have trained a machine learning model in Databricks and logged its artifacts using MLflow. Now, you want...
  24. 124.You are training a machine learning model in Databricks and want to register the model using the MLflow...
  25. 125.You are a data scientist working on a machine learning project in Databricks. After successfully training and...
  26. 126.You are managing a machine learning model in Databricks and have registered it in the Model Registry. The...
  27. 127.You are managing a machine learning model in Databricks Model Registry. The model has completed testing in...
  28. 128.A data scientist has trained a model and registered it in the Databricks Model Registry. The team now wants...
  29. 129.You are managing a machine learning model in Databricks Model Registry. You have registered a new model...
  30. 130.You are managing an ML model lifecycle using MLflow in Databricks. You have just registered a model version...
  31. 131.You are managing a machine learning model lifecycle using MLflow in Databricks. You need to transition a...
  32. 132.You are managing models in a Databricks MLflow registry and need to programmatically transition a specific...
  33. 133.You are managing the lifecycle of a machine learning model registered in the MLflow Model Registry. Using the...
  34. 134.You are using the MLflow Client API to transition a machine learning model from the 'Staging' stage to the...
  35. 135.You are a data scientist working on a machine learning project in Databricks. You have just registered a new...
  36. 136.You are managing a machine learning model using the Databricks MLflow Model Registry. You want to transition...
  37. 137.You are working on transitioning a registered model to the 'Production' stage in the MLflow Model Registry...
  38. 138.You are managing a machine learning model in the Databricks MLflow Model Registry. You want to transition a...
  39. 139.You are working with a registered machine learning model in Databricks and want to transition its stage from...
  40. 140.You are analyzing a dataset in Databricks to prepare it for a machine learning model. During exploratory data...
  41. 141.You are working on a machine learning project in Databricks and have loaded a dataset containing customer...
  42. 142.You are working on a machine learning project in Databricks where you aim to predict customer churn. During...
  43. 143.You are working on a dataset in Databricks and performing exploratory data analysis (EDA). The dataset...
  44. 144.You are working on a dataset in Databricks to predict customer churn for a subscription service. During...
  45. 145.You are working with a Spark DataFrame df containing numeric data. You want to compute summary statistics...
  46. 146.You are working with a Spark DataFrame named salesdata containing columns productid, salesamount, and...
  47. 147.You are working with a large dataset in Databricks and need to compute summary statistics such as mean,...
  48. 148.You are working with a Spark DataFrame named salesdata that contains numerical columns revenue, profit, and...
  49. 149.You are working with a Spark DataFrame named salesdf that contains information about monthly sales, including...
  50. 150.You are working on a Databricks notebook and need to compute summary statistics (like mean, min, max, and...
  51. 151.You are working with a Spark DataFrame in Databricks and want to compute summary statistics, such as mean,...
  52. 152.You are working on a Databricks notebook and need to compute summary statistics (e.g., mean, variance, min,...
  53. 153.You are working with a Spark DataFrame in Databricks containing customer purchase data. You want to compute...
  54. 154.You are working with a Spark DataFrame in Databricks that contains data about customer transactions. You want...
  55. 155.You are using Databricks to train a machine learning model and want to analyze the distribution of features...
  56. 156.You are using Databricks to train a machine learning model and want to monitor key metrics such as mean...
  57. 157.You are working on a machine learning experiment in Databricks and need to evaluate the distribution of a...
  58. 158.You are using Databricks to train a machine learning model and want to analyze summary statistics for your...
  59. 159.You are training a machine learning model on Databricks and want to track metrics such as loss, accuracy, and...
  60. 160.You are working with a Spark DataFrame df in Databricks that contains a column value. You need to remove rows...
  61. 161.You are working with a Spark DataFrame containing a column named 'featurevalue'. You need to remove outliers...
  62. 162.You are working with a Spark DataFrame named df that contains a column feature with numerical values. You...
  63. 163.You are working with a Spark DataFrame containing numerical data in a column named 'value'. You want to...
  64. 164.You are tasked with building a binary classification model in Databricks to predict whether a customer will...
  65. 165.You are working on a binary classification model in Databricks. The model outputs probabilities for the...
  66. 166.You are working with a classification model in Databricks and need to evaluate its performance. The business...
  67. 167.You are building a binary classification model in Databricks for detecting fraudulent transactions. After...
  68. 168.You are tasked with building a binary classification model using Databricks. The model predicts whether a...
  69. 169.During a machine learning project, you have identified several features with missing values. You decide to...
  70. 170.A data scientist is building a predictive model using a dataset that contains missing values in several...
  71. 171.You are training a machine learning model in Databricks, and your dataset contains several features with...
  72. 172.You are building a machine learning model using a dataset that contains missing values in several columns....
  73. 173.When preparing a dataset for machine learning, why is it important to add indicator variables for missing...
  74. 174.In which of the following scenarios is it most appropriate to replace missing values with the mode value in a...
  75. 175.In which of the following scenarios is replacing missing values with the mode most appropriate in a machine...
  76. 176.You are building a machine learning model to predict the category of customer feedback based on survey data....
  77. 177.You are working with a dataset for a classification problem, and one of the categorical features has missing...
  78. 178.In which of the following scenarios is replacing missing values with the mode an appropriate approach?
  79. 179.You are working on a dataset in Databricks with several missing values in a numerical column. You are...
  80. 180.You are building a machine learning model in Databricks and encounter missing values in a numeric feature....
  81. 181.You are working on a machine learning project using a dataset with missing numerical values. You are deciding...
  82. 182.You are working with a dataset that contains a numerical feature with missing values. You are deciding...
  83. 183.A data scientist is working with a dataset containing numerical features that have missing values. The...
  84. 184.You are working on a machine learning project in Databricks where your dataset contains several numerical...
  85. 185.You are working on a machine learning project in Databricks where the dataset contains several numerical...
  86. 186.You are working on a dataset in Databricks that includes multiple numerical columns with missing values. Your...
  87. 187.You are working with a dataset on Databricks that contains missing values in a numeric column 'age'. You...
  88. 188.You are working on a dataset in Databricks that contains missing values in a numerical column called age. You...
  89. 189.You are working on a machine learning pipeline in Databricks. Your dataset contains a categorical feature...
  90. 190.You are tasked with preparing a dataset for a machine learning model in Databricks. The dataset contains a...
  91. 191.You are working on a machine learning project in Databricks and need to preprocess a categorical feature...
  92. 192.You are training a machine learning model in Databricks using a dataset that contains a categorical feature...
  93. 193.You are working on a machine learning project in Databricks where you need to preprocess a dataset containing...
  94. 194.Why is one-hot encoding categorical features often inefficient for tree-based models?
  95. 195.Why can one-hot encoding categorical features be inefficient when used with tree-based models?
  96. 196.Why can one-hot encoding categorical features be considered inefficient when training tree-based models such...
  97. 197.Why might one-hot encoding categorical features be inefficient when training tree-based models?
  98. 198.Why is one-hot encoding categorical features often inefficient when used with tree-based models in machine...
  99. 199.You are using Databricks to train a machine learning model and want to tune hyperparameters efficiently. You...
  100. 200.You are training a machine learning model in Databricks and want to tune its hyperparameters using random...