Question of the day · Databricks
Databricks Certified Machine Learning Associate: today's question
Today · Data Processing
The column device has five distinct values and no missing values. It is passed through StringIndexer and then OneHotEncoder, both with default settings. What is the length of each encoded vector?
- A5
- B4
- C1
- D6
Show the answer
B. OneHotEncoder has dropLast=True by default, so a feature with k levels becomes a sparse vector of length k - 1. The last index, which StringIndexer gives to the least frequent level under its default frequency ordering, is encoded as the all-zeros vector. This avoids the perfect collinearity of keeping all k dummy columns.
Written for practice in the style of the exam: never a question from the real exam. A new one every day.
Want ten more now?
The free readiness check asks ten questions weighted like the real exam and shows your score by section.