QuestionQ129

VerifiedModel Development

A machine learning engineer wants to parallelize training group-specific models with the Pandas Function API. They developed the train_model function and want to apply it to every group in DataFrame df.

They have written the following incomplete code block:

Question Image

Which of the following code pieces can fill the blank above to complete the task?

Explanation

GroupedData.applyInPandas(func, schema) runs a native Python function for each DataFrame group and requires the schema of the returned pandas DataFrame. Thus it supports applying train_model to each device_id group with train_return_schema.

Learn more

Community Discussion

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