Introduction to Machine Learning

Chapter 06: Dimensionality Reduction I — Feature Selection

1. Introduction

More features are not more information. As dimensionality grows, data becomes sparse, distances lose their meaning, and models that rely on locality — KNN above all — degrade badly. This chapter opens with that problem, the curse of dimensionality, and then develops the first family of answers: choosing a subset of the features you already have.

We cover filter methods, which score features independently of any model using statistical tests — variance threshold, chi-square, ANOVA F-test, — and then wrapper methods, which judge a feature subset by the performance of an actual trained model. Forward selection and backward elimination illustrate the trade-off: wrappers capture feature interactions that filters cannot see, but pay for it with a combinatorial search. The companion chapter takes the other route, constructing new features rather than selecting old ones — for example, combining height and weight into a single new feature, BMI, rather than just picking one of the two original columns. Feature selection, by contrast, always keeps the original variables intact; it only decides which ones to keep.

Learning Objectives

2. Theory

2.1 Curse of Dimensionality

Adding more features to a dataset is not free. Beyond a certain point extra features stop helping, and for distance-based methods such as KNN they actively cause problems, for reasons that are geometric rather than statistical.

Why algorithms react differently to noise features

Given additional features that are pure noise (no relation to target):

2.2 The Hypercube Thought Experiment

Consider the following concrete example. All features are uniformly distributed over [0, 1]. We want to classify a query at X = 0.6 using the 10% nearest neighbors rule (use only training samples whose features all fall within ±5% of the feature range, i.e., 10% of the axis length):

\( \text{Fraction of hypercube captured by a 10\% local neighborhood in } p \text{ dimensions} = (0.1)^p \)
p (dimensions)Fraction of data coveredData you need for 10 observations in neighborhood
p = 110% (0.1)100 rows
p = 21% (0.01)1,000 rows
p = 30.1% (0.001)10,000 rows
p = 100.00000001%10 billion rows

Takeaway: In high dimensions, the local 10% neighborhood is essentially the entire dataset. There is no concept of "nearby." The distance between any two randomly chosen points becomes approximately the same constant. KNN's core assumption — that nearby points share a label — fails catastrophically.

In high dimensions, everyone is your neighbor... and no one is.

2.3 The Feature Selection Problem

The curse of dimensionality tells us that too many features cause problems, so the natural response is to keep only a useful subset of them. We first state that task precisely.

Given a feature matrix \(X \in \mathbb{R}^{n \times d}\) with \(n\) samples and \(d\) features, and target variable \(y \in \mathbb{R}^n\), our goal is to select a subset \(S \subseteq \{1, 2, ..., d\}\) such that features in \(S\) are most predictive of \(y\).

Exponential Search Space: There are \(2^d\) possible subsets of \(d\) features. For \(d = 30\) this gives \(2^{30} = 1,073,741,824\) subsets, so evaluating every subset is not computationally feasible. Practical methods therefore search this space in a restricted way.

2.4 Filter vs Wrapper Methods

Because exhaustive search is impossible, practical methods fall into two families that differ in how they judge a feature. Filter methods score each feature with a statistical test, independently of any model. Wrapper methods judge a subset by training a model on it and measuring how well it performs.

Characteristic Filter Methods Wrapper Methods
Timing Preprocessing step, independent of ML algorithm "Wraps" around a specific ML algorithm
Evaluation Statistical measures (correlation, chi-square) Actual model performance (cross-validation)
Speed Fast and scalable Slower but more accurate
Model Dependence Algorithm-agnostic Tailored to specific algorithm

Note: A third category called "Embedded Methods" (e.g., LASSO, Random Forest feature importance) exists where feature selection happens during model training.

2.5 How Filter Methods Work

All filter methods share the same three-step procedure, and they differ only in the statistical score used in the first step:

  1. Calculate a statistical score for each feature independently
  2. Rank features by their scores (higher = better)
  3. Select top-k features or apply a threshold
  4. Train the model on the selected features

2.6 Variance Threshold

The simplest filter method removes features with very low variance:

\[ \text{Var}(X_j) = \frac{1}{n} \sum_{i=1}^{n} (x_{ij} - \bar{x}_j)^2 \]

Important: Standardization or normalization is required before applying variance threshold so that the same threshold works for all features. A threshold between 0.01 and 0.1 is generally effective.

from sklearn.feature_selection import VarianceThreshold

selector = VarianceThreshold(threshold=0.01)
X_selected = selector.fit_transform(X)

2.7 Chi-Square (\(\chi^2\)) Filter

The Chi-Square test measures the association between one input column and one output column. Both columns must be categorical. For example, is there a relationship between the "Gender" column and the "Education" column? The contingency table (also called a "crosstab") below shows the frequency of each combination of values between the two columns:

FemaleMale
Without graduation67
College1316
Bachelor's degree1615
Master's degree811
Total4349
\[ \chi^2 = \sum_{i=1}^{c} \frac{(O_i - E_i)^2}{E_i} \]

Where \(c\) is the degree of freedom, \(O_i\) is the observed frequency, and \(E_i\) is the expected frequency in cell \(i\).

The expected frequency is computed as:

\[ E_{ij} = \frac{(\text{Row Total}_i) \times (\text{Column Total}_j)}{\text{Grand Total}} \]
from sklearn.feature_selection import SelectKBest, chi2

# Method 1: Select top-k features
selector = SelectKBest(score_func=chi2, k=5)
X_selected = selector.fit_transform(X_categorical, y)

# Method 2: Select features above threshold
selector_threshold = SelectKBest(score_func=chi2, k='all')
selector_threshold.fit(X_categorical, y)

# Filter by p-value threshold
significant_features = selector_threshold.pvalues_ < 0.05
X_significant = X_categorical.iloc[:, significant_features]

2.8 ANOVA F-Test

ANOVA (Analysis of Variance) is used when:

\[ F = \frac{\text{Between-group variability}}{\text{Within-group variability}} = \frac{SS_{between} / (K-1)}{SS_{within} / (N-K)} \]

Where \(K\) = number of classes, \(N\) = total samples.

Higher F-statistic indicates greater difference between class means, making the feature more informative.

from sklearn.feature_selection import SelectKBest, f_classif

# Apply ANOVA F-test to all numerical features
selector = SelectKBest(score_func=f_classif, k=5)
X_selected = selector.fit_transform(X_numerical, y)

# Get F-scores and p-values
f_scores = selector.scores_
p_values = selector.pvalues_

2.9 Comparison of Filter Methods

The four filter methods above apply to different combinations of feature and target type. The table below summarises when each one is appropriate.

Method Target Type Feature Type Captures Non-linear Model-agnostic
Variance Threshold Any Any No Yes
Correlation Continuous Continuous No Yes
Chi-Square Categorical Categorical No Yes
ANOVA F-test Categorical Continuous No Yes

2.10 Wrapper Methods

Filter methods score each feature on its own, so they cannot see that two features are useful only in combination. Wrapper methods address this by evaluating whole subsets.

Wrapper methods use a predictive model to evaluate feature subsets, using model performance as the selection criterion.

Key Characteristics:

Common wrapper methods:

2.11 Forward Selection

Forward Selection is a greedy algorithm that builds the feature set incrementally:

  1. Start with an empty feature set (Null Model)
  2. Iteratively add features that improve model performance the most
  3. In essence, we fit p simple models (one for each feature) and record each case's accuracy. The feature that produces the best evaluation metric is locked in.
  4. We then add the remaining p-1 features to this feature and select the combination that results in the best evaluation metric at stage 2.
  5. This approach is continued until some stopping rule is satisfied (e.g., desired number of features, no improvement in performance)
Forward Stepwise Selection Example A vertical process diagram showing how variables are progressively added to a statistical model according to significance. Forward Stepwise Selection Example workflow with 5 candidate variables 1 Start with a model with no variables Null Model Baseline with zero predictors Evaluate performance Add the most significant variable Best single feature Model with 1 variable Reassess the model Evaluate performance Add the next most significant variable Best pair of features Model with 2 variables Reassess the model Evaluate performance Continue adding variables... Model with k variables Stopping rule reached Final Model s*

Characteristics:

2.12 Backward Selection

Backward Selection is the reverse of Forward Selection:

  1. Start with all features (Full Model)
  2. Iteratively remove features that hurt performance the least
  3. In essence, we explore different (p - 1) feature combinations and retain the one with the best evaluation score.
  4. From these (p - 1) features, we form pairs of (p - 2) variables, train the model and retain the one with the best evaluation score.
  5. This procedure continues until a stopping rule is reached.
Backward Stepwise Selection Example A vertical process diagram showing backward stepwise selection from a full model with five variables to a final model. Backward Stepwise Selection Example with 5 variables 1 Start with a model containing all variables MODEL Full Model Evaluate performance 2 Remove the least significant variable from the model MODEL Model with 4 variables Evaluate performance 3 Remove the next least significant variable MODEL Model with 3 variables 4 Continue removing variables one at a time MODEL Model with k variables Stopping rule reached Final Model selected based on the stopping rule

Characteristics:

2.13 Computational Complexity

The computational cost of filter vs. wrapper methods:

Method Complexity Description Example (100 features)
Filter Methods O(d) Evaluate each feature independently 100 evaluations
Wrapper Methods O(d²) Must evaluate feature combinations ~5050 evaluations (50× more expensive)

Note: This analysis focuses on the combinatorial search complexity and doesn't account for the varying computational costs of different filter methods (chi-square vs. ANOVA) or ML algorithms (linear regression vs. KNN vs. random forest) used in wrapper methods.

2.14 Filter vs Wrapper Comparison

Having seen both families in detail, we can now summarise the trade-off between them:

Aspect Filter Wrapper
Speed ✅ Fast ❌ Slow
Model Involvement ❌ No (Algorithm Independent) ✅ Yes (Algorithm Specific)
Captures Feature Interaction ❌ No ✅ Yes
Evaluation Statistical (e.g., Chi-Square, ANOVA) CV Performance
Examples Chi-Square, ANOVA Forward/Backward Selection, RFE
Overfitting Risk ✅ Low ❌ High

3. Interactive Examples

Example 1: Understanding the Search Space

Problem: For \(d = 3, 4,\) and \(5\) features, how many possible subsets exist? List all subsets for \(d = 3\).

  • \(d = 3\): \(2^3 = 8\) subsets
  • \(d = 4\): \(2^4 = 16\) subsets
  • \(d = 5\): \(2^5 = 32\) subsets

For \(d = 3\) with features \(\{A, B, C\}\):

  • Size 0: \(\emptyset\) (empty set)
  • Size 1: \(\{A\}, \{B\}, \{C\}\)
  • Size 2: \(\{A, B\}, \{A, C\}, \{B, C\}\)
  • Size 3: \(\{A, B, C\}\)

Example 2: Chi-Square Test in Action

Dataset: Examining the relationship between "Income Level" (Low, Medium, High) and "Subscription Status" (Subscribed, Not Subscribed).

Income Level Subscribed (O) Not Subscribed (O) Row Total
Low 20 30 50
Medium 40 25 65
High 10 15 25
Column Total 70 70 140

Expected Values:

  • Low, Subscribed: \((50 \times 70) / 140 = 25\)
  • Low, Not Subscribed: \((50 \times 70) / 140 = 25\)
  • Medium, Subscribed: \((65 \times 70) / 140 = 32.5\)
  • Medium, Not Subscribed: \((65 \times 70) / 140 = 32.5\)
  • High, Subscribed: \((25 \times 70) / 140 = 12.5\)
  • High, Not Subscribed: \((25 \times 70) / 140 = 12.5\)

Example 3: Curse of Dimensionality — Hypercube Neighborhood Size

Neighborhood Coverage Calculator 📐

Uniform data on [0,1]^p. You want to capture a 5% neighborhood along each axis so you look at points that fall in [x − 0.025, x + 0.025] on every axis.

  1. What fraction of the space is covered in p = 2, 5, and 20 dimensions?
  2. Suppose you want on average 50 observations inside the neighborhood. How many total rows do you need in your dataset at p = 2, 5, 20?

(a) Coverage fraction = (0.05)^p.

p=2: (0.05)² = 0.25%
p=5: (0.05)^5 = 3.125 × 10⁻⁷ ≈ 0.00003%
p=20: (0.05)^20 ≈ 9.5 × 10⁻²⁷ (essentially zero!)

(b) Required dataset size N = 50 / coverage:

p=2: N = 50 / 0.0025 = 20,000 rows
p=5: N ≈ 50 / 3.125e-7 = 160,000,000 rows
p=20: ~ 5.3 × 10²⁷ rows → more than the age of the universe in seconds. Impossible.

This is exactly why feature reduction (selection + extraction: Units 7–8) is mandatory before KNN on wide data.

Example 4: Forward vs Backward Selection

Consider a dataset with 5 features and the following evaluation metrics:

Forward Selection
Backward Selection

Forward Selection Process:

  1. Step 0: Start with empty set, accuracy = 0.60
  2. Step 1: Try each feature individually:
    • F1: accuracy = 0.75 (best)
    • F2: accuracy = 0.70
    • F3: accuracy = 0.72
    • F4: accuracy = 0.65
    • F5: accuracy = 0.68
    → Select F1
  3. Step 2: Try adding each remaining feature to {F1}:
    • {F1, F2}: accuracy = 0.78
    • {F1, F3}: accuracy = 0.82 (best)
    • {F1, F4}: accuracy = 0.76
    • {F1, F5}: accuracy = 0.79
    → Select F3
  4. Step 3: Try adding each remaining feature to {F1, F3}:
    • {F1, F3, F2}: accuracy = 0.85 (best)
    • {F1, F3, F4}: accuracy = 0.80
    • {F1, F3, F5}: accuracy = 0.83
    → Select F2
  5. Step 4: Try adding F4 or F5 to {F1, F3, F2}:
    • {F1, F3, F2, F4}: accuracy = 0.84 (decreases!)
    • {F1, F3, F2, F5}: accuracy = 0.86
    → Select F5

Final selected features: {F1, F3, F2, F5}

Backward Selection Process:

  1. Step 0: Start with all features {F1,F2,F3,F4,F5}, accuracy = 0.86
  2. Step 1: Try removing each feature:
    • Remove F1: accuracy = 0.84
    • Remove F2: accuracy = 0.83
    • Remove F3: accuracy = 0.81
    • Remove F4: accuracy = 0.85 (least impact)
    • Remove F5: accuracy = 0.82
    → Remove F4
  3. Step 2: From {F1,F2,F3,F5}, try removing each:
    • Remove F1: accuracy = 0.80
    • Remove F2: accuracy = 0.79
    • Remove F3: accuracy = 0.83 (least impact)
    • Remove F5: accuracy = 0.78
    → Remove F3
  4. Step 3: From {F1,F2,F5}, try removing each:
    • Remove F1: accuracy = 0.75
    • Remove F2: accuracy = 0.80 (least impact)
    • Remove F5: accuracy = 0.74
    → Remove F2

Final selected features: {F1, F5}

4. Numerical Solutions

Problem 1: Complete Chi-Square Calculation

Using the contingency table from Example 2, compute the Chi-Square statistic and determine if Income Level is a significant predictor of Subscription Status at \(\alpha = 0.05\).

Step 1: State Hypotheses

  • H\(_0\): No significant association between Income Level and Subscription Status
  • H\(_1\): There is a significant association between Income Level and Subscription Status

Step 2: Calculate Expected Frequencies

Income Level Subscribed (E) Not Subscribed (E)
Low2525
Medium32.532.5
High12.512.5

Formula: \(E_{ij} = \frac{\text{Row}_i \times \text{Column}_j}{\text{Grand Total}}\)

Step 3: Compute Chi-Square Statistic

\[ \chi^2 = \sum \frac{(O - E)^2}{E} \]
  • Low, Subscribed: \((20 - 25)^2 / 25 = 1.0\)
  • Low, Not Subscribed: \((30 - 25)^2 / 25 = 1.0\)
  • Medium, Subscribed: \((40 - 32.5)^2 / 32.5 = 1.731\)
  • Medium, Not Subscribed: \((25 - 32.5)^2 / 32.5 = 1.731\)
  • High, Subscribed: \((10 - 12.5)^2 / 12.5 = 0.5\)
  • High, Not Subscribed: \((15 - 12.5)^2 / 12.5 = 0.5\)

Total: \(\chi^2 = 6.462\)

Step 4: Determine Degrees of Freedom and Critical Value

\[ df = (r - 1) \times (c - 1) = (3 - 1) \times (2 - 1) = 2 \]

Critical value at \(\alpha = 0.05\), \(df = 2\): 5.991

Step 5: Conclusion

Since \(6.462 > 5.991\), we reject H\(_0\).

Conclusion: There is a significant association between Income Level and Subscription Status. This feature would be selected by the Chi-Square filter method. Higher \(\chi^2\) values indicate a stronger feature-target relationship.

Problem 2: Forward Selection Trace

Consider a dataset with 4 features and the following evaluation metrics when adding features one by one:

Step Features Added Accuracy Feature Selected
1{}0.60-
2{F1}0.75F1
3{F1, F3}0.82F3
4{F1, F3, F2}0.85F2
5{F1, F3, F2, F4}0.84F4

Selected features: {F1, F3, F2}

Reasoning:

  1. Start with empty set, accuracy = 0.60
  2. Add F1: accuracy improves to 0.75 → F1 selected
  3. Try adding each remaining feature to {F1}:
    • {F1, F2}: accuracy = 0.78
    • {F1, F3}: accuracy = 0.82 (best)
    • {F1, F4}: accuracy = 0.76
    → F3 selected
  4. Try adding each remaining feature to {F1, F3}:
    • {F1, F3, F2}: accuracy = 0.85 (best)
    • {F1, F3, F4}: accuracy = 0.80
    → F2 selected
  5. Try adding F4 to {F1, F3, F2}:
    • {F1, F3, F2, F4}: accuracy = 0.84 (decreases!)
    → Stop here, final features: {F1, F3, F2}

Problem 3: KNN and Dimensionality

You run KNN on 3 different feature subsets of a 500-row dataset, getting 10-fold CV accuracy of 89% using p=4 features; 85% using p=40 features; and 72% using p=400 features. The true information content is actually contained in those 4 features.

  1. Name and explain the phenomenon causing accuracy to drop as p grows despite the same underlying ground truth.
  2. Why does accuracy drop steadily rather than stay the same?
  3. What three actions would recover most of the lost performance?

(a) Curse of Dimensionality on KNN. As feature count grows, the extra 36 (and then 396) noise dimensions inflate distances between every pair of points, swamping the useful signal in the first 4 dimensions. KNN cannot tell "true nearby" from "randomly close on noise axes."

(b) Distances become less discriminative uniformly — the ratio of (nearest neighbor distance / farthest neighbor distance) → 1 in high dimensions. More and more of the K nearest neighbors are actually of the wrong class because label structure doesn't correlate with the noise dimensions at all.

(c) Recovery menu: (i) Filter feature selection / ANOVA / MI to prune dimensions. (ii) Wrapper selection (forward/backward — this chapter). (iii) PCA extraction (Chapter 6) onto a low-dim subspace before KNN. (iv) Switch classifier to Random Forest which ignores noise features (doesn't fix KNN but sidesteps the curse for the modeling step).

5. Try It Yourself

Problem 1: Variance Threshold Decision

You have 4 features with the following variances after standardization: A=0.15, B=0.003, C=0.08, D=0.001. If you apply VarianceThreshold with threshold=0.01, which features will be selected?

Features with variance >= 0.01 are selected:

  • A: 0.15 >= 0.01 SELECTED
  • B: 0.003 < 0.01 REJECTED
  • C: 0.08 >= 0.01 SELECTED
  • D: 0.001 < 0.01 REJECTED

Selected features: A and C

Problem 2: ANOVA F-test Interpretation

You compute ANOVA F-statistics for three features predicting a binary target:

Using \(\alpha = 0.05\), which features are significant? Rank them by importance.

Compare each p-value to \(\alpha = 0.05\):

  • Feature X: p = 0.0004 < 0.05 SIGNIFICANT
  • Feature Y: p = 0.15 > 0.05 NOT SIGNIFICANT
  • Feature Z: p = 0.004 < 0.05 SIGNIFICANT

Ranking by F-statistic (higher = more important):

  1. Feature X (F = 12.5)
  2. Feature Z (F = 8.3)
  3. Feature Y (F = 2.1) — not significant
Problem 3: Method Selection

For each scenario, identify the most appropriate filter method:

  1. Predicting loan default (Yes/No) using customer age (continuous) and income (continuous).
  2. Predicting disease presence (Yes/No) using blood type (A, B, AB, O) and genotype categories.
  3. Identifying which sensors provide useful information when some sensors always read the same value.
  1. ANOVA F-test — continuous features, categorical target.
  2. Chi-Square — both feature and target are categorical.
  3. Variance Threshold — removes constant/quasi-constant features.
Problem 5: Forward Selection

You have 5 features (F1-F5) and the following accuracy improvements when adding features:

Current FeaturesAdd F1Add F2Add F3Add F4Add F5
{}0.650.700.750.600.68
{F3}0.820.78-0.800.79
{F3, F1}-0.88-0.850.86

Task: Which features would be selected using forward selection with a stopping rule of maximum 3 features?

  1. Step 1: Start with empty set. Best single feature is F3 (accuracy 0.75)
  2. Step 2: Add to {F3}. Best improvement is F1 (accuracy 0.82)
  3. Step 3: Add to {F3, F1}. Best improvement is F2 (accuracy 0.88)
  4. Result: Selected features = {F3, F1, F2}
Problem 6: Backward Selection

Using the same dataset as Problem 5, the accuracies when removing features from the full set are:

Current FeaturesRemove F1Remove F2Remove F3Remove F4Remove F5
{F1,F2,F3,F4,F5}0.840.800.750.860.85
{F1,F2,F3,F5}0.830.790.74-0.84
{F1,F2,F3,F5}0.820.780.73--

Task: Which features would be selected using backward selection with a stopping rule of minimum 3 features?

  1. Step 1: Start with all features {F1,F2,F3,F4,F5}. Remove F4 (least impact, accuracy 0.86)
  2. Step 2: From {F1,F2,F3,F5}. Remove F5 (accuracy 0.84)
  3. Step 3: From {F1,F2,F3}. Stop (reached minimum of 3 features)
  4. Result: Selected features = {F1, F2, F3}
Problem 7: Local Neighborhood Growth

p = 100 features, each uniform on [0,1]. To make a prediction at a query, KNN(k=100) on a dataset of n = 100,000 rows considers 100 nearest neighbors among 100,000. For each feature independently, what's the average local "fraction" of the feature axis that those 100 neighbors span? (Approximate: treat each axis independently, assume 100 neighbors span ~ 100/100,000 = 0.1% of the order statistics on a single axis.)

Order-statistics approximation: on any 1-D axis, the 100 nearest neighbors span roughly a fraction 100/100,000 = 0.1% of the axis length on average. So the neighborhood per feature is 0.1% of the axis. Hypercube volume fraction = (0.001)^100 = 10⁻³⁰⁰. That's far more extreme than the number of atoms in the observable universe (~10⁸⁰). In other words, even with 100k rows, in 100 dimensions the 100 "nearest" neighbors are NOT local in any meaningful sense — they are scattered across essentially the entire range of every feature. KNN's local-structure assumption collapses.

6. Interactive Quiz

Answer all 8 questions. Click an option for instant feedback.

Your score: 0 / 8

7. Key Takeaways

  1. Curse of dimensionality: In p dimensions, a local "10% neighborhood" captures only (0.1)^p of the space. For large p, this is astronomically small → KNN needs astronomically large n to find true neighbors.
  2. KNN + wide data = suffering. Distance-based methods degrade fastest; trees and Naive Bayes degrade slowest. Fix the curse before KNN: reduce dimensions via selection or extraction!
  3. Curse of Dimensionality degrades model performance as feature count grows; feature selection and extraction are essential remedies.
  4. Filter Methods evaluate features using statistical measures independently of any learning algorithm — fast, scalable, and model-agnostic.
  5. Variance Threshold removes constant/quasi-constant features; requires standardized data.
  6. Chi-Square tests association between categorical features and categorical targets.
  7. ANOVA F-test measures whether continuous feature means differ across categorical target classes.
  8. Higher statistical scores indicate more informative features; always compare against critical values or p-value thresholds.
  9. Model-based evaluation: Uses a predictive model to evaluate feature subsets based on performance
  10. Captures interactions: Can detect interactions between features that filter methods might miss
  11. Algorithm-specific: Selected features are optimal for the specific model being used
  12. Computationally expensive: Requires training multiple models, leading to O(d²) complexity
  13. Forward Selection: Starts with empty set, adds features one by one. More efficient for large feature sets.
  14. Backward Selection: Starts with all features, removes least important one by one. Often more computationally intensive.
  15. Both are greedy: Make locally optimal choices at each step, may not find global optimum

8. Common Pitfalls

  1. Running KNN on p=500 without dimension reduction. Classic high-dim failure mode. You'll get ~random performance and spend weeks debugging the algorithm instead of applying feature selection/PCA first.
  2. More features always help. False. Adding pure-noise features actively damages KNN. It doesn't stay neutral — it actively poisons the distance metric.
  3. Ignoring Feature Interactions: Filter methods evaluate features individually. A feature that seems weak alone may be powerful in combination with others.
  4. Threshold Sensitivity: Performance depends heavily on manually chosen thresholds. Always experiment with multiple values.
  5. Forgetting Standardization: Variance threshold requires standardized features; otherwise the same threshold won't work across features.
  6. Method Mismatch: Using Chi-Square on continuous data or ANOVA on categorical features produces meaningless results.
  7. Treating Filter Selection as Final: Filter methods are great for initial reduction, but wrapper or embedded methods may find better subsets.
  8. Overlooking p-values: A high F-statistic or Chi-Square value is only meaningful if the corresponding p-value is below your significance level.
  9. Computational cost: Wrapper methods can be very slow for datasets with many features due to O(d²) complexity
  10. Overfitting: Using the same data for both feature selection and model training can lead to overfitting. Always use cross-validation.
  11. Model dependency: Selected features are optimal for the specific model used, may not generalize to other models
  12. Greedy nature: Both forward and backward selection make locally optimal choices, which may not lead to the global optimum
  13. Stopping criteria: Choosing the wrong stopping rule can lead to underfitting (too few features) or overfitting (too many features)
  14. Feature selection vs extraction: Don't confuse the two. Selection keeps original features, extraction creates new ones.
  15. Data leakage: Applying feature selection/extraction before train-test split can leak information from test to train
  16. Correlation assumption: PCA works best when features are correlated. If features are already uncorrelated, PCA may not provide much benefit.