QuestionQ40

VerifiedCost & Performance Optimisation

The data science team has created and logged a production model with MLflow. The following code correctly imports and applies the production model, producing predictions in a new DataFrame named preds with the schema "customer_id LONG, predictions DOUBLE, date DATE".

Question Image

The data science team wants the predictions stored in a Delta Lake table so that all predictions can be compared over time. Churn predictions will be generated no more than once each day.

Which code block achieves this while minimizing potential compute costs?

Explanation

Appending preserves each daily prediction batch for comparison over time. Databricks uses Delta Lake as the default format for tables, so saveAsTable("churn_preds") creates or targets a Delta table, and mode("append") adds new predictions on later runs. A path-based save() without append mode defaults to failing when the destination already exists.

Learn more

Community Discussion

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