FlashKeepers

Data Science · College · College and University

Feature Engineering

Encoding categoricals, scaling, binning, interaction features, date features, text features, imputation and leakage avoidance.

About this set

40 basic cards for College Data Science. It opens with "What is one-hot encoding used for?" and "When is label encoding preferred over one-hot encoding?". Study it alongside the other College sets below.

40 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is one-hot encoding used for?
Show answerConverts categorical variables into binary columns, one per category, with a single 1 and rest 0s.
When is label encoding preferred over one-hot encoding?
Show answerWhen the categorical variable is ordinal (has natural ordering) and you want fewer features.
What is ordinal encoding?
Show answerAssigns integers to categories based on their natural order, e.g. low=1, medium=2, high=3.
Define target encoding in feature engineering.
Show answerReplaces each category with the mean (or median) of the target variable for that category.
What is binary encoding?
Show answerConverts categories to binary numbers, then splits the binary digits into separate features, reducing dimensionality compared to one-hot.
What is frequency encoding?
Show answerReplaces each category with how often it appears in the dataset.
When might one-hot encoding cause problems?
Show answerWith high-cardinality features (many unique categories), creating too many columns.
What is the dummy variable trap?
Show answerWhen using one-hot encoding, including all dummy columns (not dropping one) leads to multicollinearity in linear models.
Define standardization (z-score normalization).
Show answerSubtracts the mean and divides by standard deviation: (x - mean) / std. Result has mean 0 and std 1.
Define min-max normalization.
Show answerScales features to a fixed range, usually [0,1], using (x - min) / (max - min).
What is robust scaling?
Show answerUses median and interquartile range instead of mean and std, making it less sensitive to outliers.
When should you NOT scale a feature?
Show answerTree-based models (decision trees, random forests) are scale-invariant, so scaling is unnecessary.
What is log scaling used for?
Show answerCompresses the range of large values, useful for right-skewed distributions.
Why is it important to fit scalers on training data only?
Show answerTo prevent leakage, the scaler parameters (mean, std, min, max) must be computed from training data before applying to test data.
What is equal-width binning?
Show answerDivides the range into n intervals of equal width, then assigns values to bins.

25 more cards in the app

Study this set free