🔥 3-day streak
Databricks Certified Machine Learning Associate106 / 137
Question 106 of 137

A data scientist is building a Spark ML pipeline. They apply a StringIndexer to a categorical column, then feed the resulting index column into a OneHotEncoder before assembling features. During code review, a colleague asks why the OneHotEncoder must be called with .fit() on the training data rather than simply transforming rows directly. What is the correct explanation of OneHotEncoder's behavior in Spark ML?

Reviewed for accuracy · Report an issueNext question