Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam Certified Machine Learning Associate topic 1 question 18 discussion

Actual exam question from Databricks's Certified Machine Learning Associate
Question #: 18
Topic #: 1
[All Certified Machine Learning Associate Questions]

A data scientist has defined a Pandas UDF function predict to parallelize the inference process for a single-node model:

They have written the following incomplete code block to use predict to score each record of Spark DataFrame spark_df:

Which of the following lines of code can be used to complete the code block to successfully complete the task?

  • A. predict(*spark_df.columns)
  • B. mapInPandas(predict)
  • C. predict(Iterator(spark_df))
  • D. mapInPandas(predict(spark_df.columns))
  • E. predict(spark_df.columns)
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
rajneesharora
3 days, 6 hours ago
correct answer is A, Scalar Pandas UDFs work with column names or expressions and return a column that gets added to the DataFrame. In this particular case, the use of *spark_df.columns unpacks the column names, which allows the UDF to operate on all these columns. No other option provides all column names
upvoted 1 times
...
souarav
1 month ago
Selected Answer: A
mapInPandas is used in pandas api functions and syntax is mapInPandas(predict,schema)
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
ex Want to SAVE BIG on Certification Exam Prep?
close
ex Unlock All Exams with ExamTopics Pro 75% Off
  • arrow Choose From 1000+ Exams
  • arrow Access to 10 Exams per Month
  • arrow PDF Format Available
  • arrow Inline Discussions
  • arrow No Captcha/Robot Checks
Limited Time Offer
Ends in