QuestionQ22

Custom Model Serving

A Machine Learning Engineer is developing a script to score a large batch of customer data with a SparkML RandomForestClassificationModel registered in Unity Catalog. They want to follow commonly accepted coding best practices for this model.

Which approach best meets their needs?

  • A Load the model using MLflow’s mlflow.spark.load_model method, then perform batch predictions with RandomForestClassificationModel.transform().
  • B Provide the URI of the registered Unity Catalog model to Spark’s DataFrame predict method to perform batch predictions.
  • C Load the model using MLflow’s mlflow.pyfunc.spark_udf method, then perform batch predictions with RandomForestClassificationModel.transform().
  • D Provide the URI of the registered Unity Catalog model to the Databricks ai_query function to perform batch predictions.
Explanation

MLflow’s Spark flavor loads a registered Spark MLlib model as a Spark transformer, which performs distributed batch scoring by calling transform() on a Spark DataFrame. This is the native inference pattern for a SparkML classification model.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!