A machine learning engineer has developed a random forest model using scikit-learn, logged the model using MLflow as random_forest_model, and stored its run ID in the run_id Python variable. They now want to deploy that model by performing batch inference on a Spark DataFrame spark_df.
Which of the following code blocks can they use to create a function called predict that they can use to complete the task?
A)

B)
It is not possible to deploy a scikit-learn model on a Spark DataFrame.
C)

D)

E)

Suggested Answer: D
Get Premium Databricks Machine Learning Professional Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
17 comments · newest first
MY
Myra
10 months ago
Not sure about D, looks a bit complicated for this task.
LE
Leeann
11 months ago
I prefer Option C, seems more straightforward.
VA
Val
11 months ago
Surprised to see B as an option, that can't be right!
JO
Joni
11 months ago
I think Option B is incorrect, scikit-learn models can work with Spark.
AL
Alva
11 months ago
Option A looks solid for batch inference!
KI
Kirk
12 months ago
I’m a bit confused about the images in options C, D, and E. I wish I could recall what they contained!
AN
Antonio
12 months ago
I practiced a similar question where we had to load a model from MLflow. I feel like option A might be the right choice here.
AU
Audrie
12 months ago
I think option B is wrong because we can deploy scikit-learn models on Spark DataFrames, right?
RO
Royal
1 year ago
I remember we discussed how to deploy scikit-learn models with Spark, but I’m not sure if it was specifically about random forests.
CE
Celestine
1 year ago
I'm leaning towards Option D, but I want to make sure I understand the process of converting the scikit-learn model to a Spark UDF. That might be the key to solving this problem.
DE
Denny
1 year ago
I'm a bit confused here. Option B says it's not possible, but the question seems to imply that we can deploy the scikit-learn model on Spark. I'll need to think this through carefully.
KR
Kristal
1 year ago
Okay, let's see. Option A looks promising, but I'm not sure if that's the right way to do it. I'll need to double-check the syntax and make sure it's compatible with the given setup.
GA
Gail
1 year ago
Hmm, this looks like a tricky one. I'll need to carefully read through the options and think about how to deploy a scikit-learn model on a Spark DataFrame.
RE
Renay
1 year ago
Aha, Option C looks like it might be the solution! I'll need to verify that the MLflow integration and the Spark DataFrame usage are correct, but this seems like the most straightforward approach.
DA
Daron
1 year ago
I'm not sure about this one. I'll need to eliminate the options that don't sound right and then make an educated guess.
SH
Shawna
1 year ago
I'm leaning towards option B being the wrong one. My notes mentioned that HDHPs might actually have lower premiums compared to traditional plans!
NO
Nobuko
1 year ago
Okay, I think I've got this. Assigning to the OU is the recommended method because it saves the admin a ton of time and effort compared to manually adding the app to each user.