QuestionQ61

VerifiedModel Deployment

A data scientist developed a machine-learning model with scikit-learn. The scientist must now perform batch inference on a large, 100-GB dataset. To process this large data volume efficiently, they plan to use an available 10-node Spark cluster. They want to complete the processing in the shortest possible time.

Which set of steps will accomplish this?

Explanation

A Pandas UDF applies vectorized Python processing to batches of records from a Spark DataFrame, so Spark can execute inference across the DataFrame’s distributed partitions on cluster executors. Serializing the scikit-learn model for the UDF makes it available to those workers, while batch-oriented Pandas UDF execution avoids the row-at-a-time overhead of a standard Python UDF. PySpark documents Pandas UDFs as operating block by block, and its batch-prediction API returns a Pandas UDF for inference over a Spark DataFrame.

Learn more

Community Discussion

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