DY0-001 practice question 8 of 15
A data scientist is analyzing a data set with categorical features and would like to make those features more useful when building a model. Which of the following data transformation techniques should the data scientist use? (Choose two.)
Full set: 85 questionsMachine learning algorithms require numerical input. Categorical features, which represent qualitative data (e.g., 'color', 'city'), must be transformed into a numerical format. One-hot encoding is a technique that converts a categorical feature into multiple new binary (0 or 1) columns, with each column representing a unique category. This is ideal for nominal data where no inherent order exists. Label encoding is another technique that assigns a unique integer to each category (e.g., 'low' -> 0, 'medium' -> 1, 'high' -> 2). This method is particularly suitable for ordinal data where a meaningful order is present. Both are fundamental techniques for making categorical features useful for model building.
A. Normalization: This technique scales numerical features to a specific range (e.g., 0 to 1) and is not used for categorical data.
C. Linearization: This is not a standard term for encoding categorical features; it relates to transforming data to fit a linear model.
E. Scaling: This is a general term for adjusting the range of numerical data, not for converting categorical data into a numerical format.
F. Pivoting: This is a data reshaping operation used for aggregation and summarization, not a feature encoding technique for modeling.
1. Scikit-learn Developers. (n.d.). 6.3. Preprocessing data. Scikit-learn User Guide. Retrieved from scikit-learn.org.
Section 6.3.4
"Encoding categorical features": This section explicitly details the use of OneHotEncoder to "create a binary column for each category" and OrdinalEncoder (which functions like label encoding for features) to "convert each category into an integer value." This directly supports the use of both one-hot and label encoding for categorical features.
2. VanderPlas
J. (2016). Python Data Science Handbook. O'Reilly Media
Inc.
Chapter 5
Section "Feature Engineering"
Subsection "Categorical Features": This section explains the problem with feeding categorical data directly to models and presents solutions. It states
"For categorical features... we can split the category into a number of binary features... This is often called one-hot encoding." It also discusses the alternative of using integer codes for categories (label encoding).
3. Massachusetts Institute of Technology. (2020). MIT 6.036: Introduction to Machine Learning
Fall 2020. MIT OpenCourseWare.
Lecture 9 Notes
Section 4
"Features": The course notes discuss feature representation
stating: "Discrete features with no natural ordering (like 'animal' = 'dog'
'cat'
'bird') are often converted into a one-hot vector representation." This validates one-hot encoding as a standard academic practice.
Keep practicing
Take the free DY0-001 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DY0-001 practice questions
- Question 3Under perfect conditions, E. coli bacteria would cover the entire earth in a matter of da…
- Question 4Which of the following is the naive assumption in Bayes' rule?
- Question 5A data analyst wants to generate the most data using tables from a database. Which of the…
- Question 6A team is building a spam detection system. The team wants a probability-based identifica…
- Question 7A data scientist is working with a data set that covers a two-year period for a large num…
- Question 9A data scientist is creating a responsive model that will update a product's daily pricin…
