How are feature selection and feature engineering approaches different?
.
.
.
.
.
Feature selection and feature engineering play vital roles in the data preprocessing stage when constructing a machine learning model. Below is an in-depth comparison:
Feature Selection
Purpose:
Feature selection is the process of identifying and selecting a subset of relevant features (variables, predictors) for use in model construction. The main goals are to improve model performance, reduce overfitting, and decrease model training time.
Approaches:
1. Filter Methods: These methods apply a statistical measure to assign a scoring to each feature. The features are ranked by the score and either selected to be kept or removed from the dataset. Examples include correlation coefficients, Chi-squared test, and information gain.
2. Wrapper Methods: These methods consider the selection of a set of features as a search problem, where different combinations are prepared, evaluated and compared to other combinations. A predictive model is used to evaluate a combination of features and assign a score based on model accuracy. Examples include recursive feature elimination.
3. Embedded Methods: These methods perform feature selection as part of the model training process and are specific to given learning algorithms. Examples include LASSO and Ridge regression, which have built-in penalization functions to reduce overfitting.
Feature Engineering
Purpose:
Feature engineering is the process of using domain knowledge to select, modify, or create new features from raw data to increase the predictive power of machine learning algorithms. The goal is to make the data more suitable for modeling and improve model accuracy on unseen data.
Approaches:
1. Creating Features: Invent new features based on existing data or through domain expertise. This could involve aggregating variables, combining features, or transforming variables (log transformation, polynomial features).
2. Transforming Features: Modify existing features to enhance their relationship with the target variable. Examples include normalization, standardization, and various data transformations like log or exponential transformations to deal with skewed data.
3. Encoding Features: Convert categorical data into numerical format so that the machine learning algorithm can better understand them. Common techniques include one-hot encoding, label encoding, and use of binary, ordinal, or frequency-based encoders.
4. Handling Missing Data: Techniques to handle missing data can also be considered part of feature engineering since they prepare the dataset for effective modeling. This could involve imputation, using a constant value, or leveraging algorithms that support missing values.
Key Differences
Focus: Feature selection focuses on eliminating unnecessary features from the model to reduce complexity and improve performance. In contrast, feature engineering focuses on creating new features or transforming existing features to improve the efficacy of the model.
Impact on Data: Feature selection reduces the dimensionality of the data by choosing a subset of all available features without altering their actual content. Feature engineering, on the other hand, may increase or maintain the dimensionality but changes the nature or number of data features through transformations or aggregations.
Methodology: Feature selection methods are largely mathematical and rely heavily on statistical properties of the data. Feature engineering is more creative, requiring domain knowledge and practical insight into how data relates to the prediction task.