Skip to content
Pablo Rodriguez

Deciding What To Try

Using J_train and J_cv analysis helps decide what to try next when algorithms make unacceptably large errors. Each technique addresses either high bias or high variance problems.

Overfitting

Get more training examples

  • Learning curves show variance problems benefit from additional data
  • Helps algorithm generalize better to new examples

Try smaller sets of features

  • Reduces model complexity and flexibility
  • Eliminates irrelevant or redundant features
  • Example: Remove x^4, x^5 terms if overfitting polynomial

Increase regularization parameter λ

  • Forces algorithm to fit smoother, less wiggly functions
  • Reduces overfitting to training set
  • Trades some training performance for better generalization
Underfitting

Try getting additional features

  • Provides more information for better predictions
  • Example: Add bedrooms, floors, age to house size for price prediction
  • Helps algorithm capture relevant patterns

Add polynomial features

  • Increases model complexity and flexibility
  • Allows fitting more sophisticated patterns
  • Example: Add x^2, x^3 terms to linear model

Decrease regularization parameter λ

  • Allows model to fit training data more closely
  • Reduces constraint on parameter values
  • Focuses more on minimizing training error

Symptoms: J_cv >> J_train Solutions: Get more data OR simplify model

  • More training examples
  • Fewer features
  • Higher λ values

Reducing training set size for high bias

  • Makes training error appear better
  • Worsens cross-validation performance
  • Doesn’t address underlying model limitations
  • Wastes valuable data
  1. Diagnose the problem using bias/variance analysis
  2. Select appropriate techniques based on diagnosis
  3. Implement changes systematically
  4. Re-evaluate performance metrics
  5. Iterate as problem type may change
Lifetime to Master

Bias and variance is “one of those concepts that takes a short time to learn, but takes a lifetime to master.” Understanding when and how to apply these techniques improves with repeated practice across different machine learning projects.

This systematic framework helps avoid random trial-and-error approaches, leading to more efficient algorithm development and better performance outcomes.