QuestionQ247

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 to produce predictions in a new DataFrame named preds, with the schema customer_id LONG, predictions DOUBLE, date DATE.

Question Image

The data science team wants predictions saved to a Delta Lake table so that all predictions can be compared over time. Churn predictions will be generated no more than once per day.

Which code block fulfills this task while minimizing potential compute costs?

Explanation

Appending preds to a named table retains each daily prediction run, including its date, so predictions can be compared over time without rewriting existing data. saveAsTable creates or writes to a managed table; in Databricks, Delta Lake is the default table format. A path-based save call does not create a named table and does not specify append behavior for subsequent daily writes.

Learn more

Community Discussion

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