AIP-210 practice question 7 of 15

Which two encodes can be used to transform categories data into numerical features? (Select two.)

Full set: 90 questions
Answer options
A: Count Encoder Correct answer
B: Log Encoder
C: Mean Encoder
D: Median Encoder
E: One-Hot Encoder Correct answer
Correct Answer:
A. Count Encoder; E. One-Hot Encoder
Explanation

Machine learning algorithms require numerical input, so categorical data must be encoded. One-Hot Encoding is a standard technique that converts a categorical feature into several new binary columns (one for each unique category). This is ideal for nominal categories where no ordinal relationship exists, as it prevents the model from assuming a false order. Count Encoding (also known as Frequency Encoding) is another method that replaces each category with the number of times it appears in the dataset. This can be a useful feature if the frequency of a category is correlated with the target variable.

Why Incorrect

B: Log Encoder is not a standard categorical encoding method. Log transformation is a mathematical function applied to existing numerical data, typically to manage skewness. C: Mean Encoder is a valid method (also called Target Encoding), but the question requires selecting two from the list, and A and E are common, distinct approaches. D: Median Encoder is a valid variant of Mean/Target encoding. Like option C, it is a correct technique, but the question is structured to have a specific set of answers.

References

Géron, A. (2019). Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow (2nd ed.). O'Reilly Media. Chapter 2, "End-to-End Machine Learning Project," details handling text and categorical attributes, with a primary focus on Ordinal Encoding and One-Hot Encoding (using OneHotEncoder).

Scikit-learn Developers. (n.d.). 4.3. Preprocessing data. scikit-learn 1.4.2 documentation. Section 4.3.4, "Encoding categorical features," provides the official documentation for the OneHotEncoder as a primary tool for this task. While a direct CountEncoder is not in the main library, the principle is widely used and available in contributed packages like categoryencoders.

Scroll to Top