Databricks Machine Learning Associate exam dumps

Databricks Machine Learning Associate practice question 531 of 656

Databricks Certified Machine Learning Associate. Associate level, Databricks. Free question with the correct answer and a full explanation.

Databricks Machine Learning Associate Question 531

Select 2

In which of the following scenarios is one-hot encoding an appropriate choice for preprocessing categorical data?

  1. A

    When the categorical feature contains a large number of unique values, such as user IDs or high-cardinality features.

  2. B

    When the categorical feature has a small number of unique categories, such as colors ('red', 'blue', 'green').

  3. C

    When using a linear regression model that assumes numerical input features.

  4. D

    When the categorical values have an inherent ordinal relationship, such as 'low', 'medium', 'high'.

  5. E

    When applying tree-based models that can inherently handle categorical features without requiring one-hot encoding.

Show answer and explanation

Correct answers: B, C

Explanation

One-hot encoding is suitable when converting categorical features with a small number of unique values into numerical input for models like linear regression, which require numerical data. However, it is not appropriate for high-cardinality features due to inefficiency or for ordinal features, where the order of categories is important. Additionally, tree-based models can handle categorical features natively, making one-hot encoding unnecessary in such cases.

  • A. Incorrect.

    One-hot encoding is not appropriate for categorical features with a large number of unique values (high cardinality), as it creates a large number of sparse features, leading to increased memory usage and computational inefficiency.

  • B. Correct.

    One-hot encoding is suitable for categorical features with a small number of unique categories because it effectively transforms them into a format that can be used by machine learning models while maintaining computational efficiency.

  • C. Correct.

    Linear regression models assume numerical input features, and one-hot encoding is a common way to convert categorical features into numerical values that the model can process.

  • D. Incorrect.

    One-hot encoding is not appropriate for ordinal features, as it discards the inherent order of the categories. Instead, techniques like label encoding or ordinal encoding are more suitable for such features.

  • E. Incorrect.

    Tree-based models, such as decision trees or gradient-boosted trees, can handle categorical features directly by splitting on categorical values. One-hot encoding is often unnecessary and can even degrade performance in such cases.

Timed practice exam

Take a Databricks Machine Learning Associate practice test under exam conditions

48 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam