CertLumen

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?

  1. A5
  2. B4
  3. C1
  4. 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.

Get one question a day by email

Each morning at 7 am your time, with the day before's answer. One click stops it.

We send a link to confirm the address first. See privacy.

Want ten more now?

The free readiness check asks ten questions weighted like the real exam and shows your score by section.

Take the free check

About the course · More practice questions · Other exams