๐ค Machine Learning Yearning
Decision Tree Summary - Based on Andrew Ng's Machine Learning Yearning
๐ฏStart Here: Model Performance Issues
Is your model performing poorly?
๐ EVALUATE PERFORMANCE METRICS
โโโ Training Error High?
โ โโโ YES โ HIGH BIAS PROBLEM
โ โ โโโ Solutions:
โ โ โ โโโ ๐ง Increase model complexity
โ โ โ โ โโโ Add more layers (neural networks)
โ โ โ โ โโโ Add more features
โ โ โ โ โโโ Use more sophisticated architecture
โ โ โ โโโ ๐ Reduce regularization
โ โ โ โ โโโ Decrease L1/L2 penalty
โ โ โ โ โโโ Reduce dropout rate
โ โ โ โ โโโ Increase learning rate
โ โ โ โโโ โฐ Train longer
โ โ โ โโโ More epochs
โ โ โ โโโ Until convergence
โ โ โโโ โ ๏ธ Risk: May increase variance
โ โ
โ โโโ NO โ Check Dev/Test Error Gap
โ โโโ Dev Error >> Training Error?
โ โ โโโ YES โ HIGH VARIANCE PROBLEM
โ โ โ โโโ Solutions:
โ โ โ โ โโโ ๐ Get more training data
โ โ โ โ โ โโโ Collect new samples
โ โ โ โ โ โโโ Data augmentation
โ โ โ โ โ โโโ Synthetic data generation
โ โ โ โ โโโ ๐ง Reduce model complexity
โ โ โ โ โ โโโ Fewer layers/parameters
โ โ โ โ โ โโโ Feature selection
โ โ โ โ โ โโโ Simpler architecture
โ โ โ โ โโโ ๐ Increase regularization
โ โ โ โ โ โโโ Higher L1/L2 penalty
โ โ โ โ โ โโโ Increase dropout
โ โ โ โ โ โโโ Early stopping
โ โ โ โ โโโ ๐ฒ Ensemble methods
โ โ โ โ โโโ Bagging
โ โ โ โ โโโ Random forests
โ โ โ โ โโโ Model averaging
โ โ โ โโโ โ ๏ธ Risk: May increase bias
โ โ โ
โ โ โโโ NO โ Check Test Performance
โ โ โโโ Test Error >> Dev Error?
โ โ โ โโโ YES โ DATA MISMATCH PROBLEM
โ โ โ โ โโโ Solutions:
โ โ โ โ โ โโโ ๐ Analyze train vs dev/test distributions
โ โ โ โ โ โโโ ๐ Create train-dev set
โ โ โ โ โ โโโ ๐ฏ Make training data more representative
โ โ โ โ โ โโโ ๐ง Domain adaptation techniques
โ โ โ โ โ โโโ ๐ Collect more dev-like training data
โ โ โ โ โโโ ๐ Error Analysis Required
โ โ โ โ
โ โ โ โโโ NO โ SATISFACTORY PERFORMANCE
โ โ โ โโโ ๐ Model is working well!
โ โ โ
โ โ โโโ Both errors acceptable but still not meeting targets?
โ โ โโโ TARGETS TOO AMBITIOUS
โ โ โโโ ๐ Reassess human-level performance
โ โ โโโ ๐ฏ Adjust success metrics
โ โ โโโ ๐ Bayes error analysis
๐Detailed Diagnostic Framework
1. Bias vs Variance Identification
๐งช DIAGNOSTIC TESTS
โโโ Compare Training vs Dev Error
โ โโโ Training Error: 8%, Dev Error: 10% โ Acceptable variance
โ โโโ Training Error: 15%, Dev Error: 16% โ High bias problem
โ โโโ Training Error: 1%, Dev Error: 11% โ High variance problem
โ
โโโ Learning Curves Analysis
โ โโโ Training & dev error converge high โ High bias
โ โโโ Large gap between training & dev โ High variance
โ โโโ Both decreasing with more data โ Get more data
โ
โโโ Human-Level Performance Comparison
โโโ Model << Human performance โ Focus on bias
โโโ Model โ Human performance โ Focus on variance
โโโ Model > Human performance โ Check for overfitting
2. Error Analysis Methodology
๐ ERROR ANALYSIS PROCESS
โโโ Manual Error Examination
โ โโโ ๐ Categorize error types
โ โโโ ๐ Count frequency of each error type
โ โโโ ๐ฏ Focus on most common errors first
โ โโโ ๐ก Generate improvement hypotheses
โ
โโโ Ceiling Analysis
โ โโโ ๐ง Fix one component perfectly
โ โโโ ๐ Measure improvement
โ โโโ ๐ Repeat for each component
โ โโโ ๐ Prioritize based on potential gains
โ
โโโ Ablation Studies
โโโ โ Remove features/components
โโโ ๐ Measure performance drop
โโโ ๐ฏ Keep most impactful components
โโโ ๐๏ธ Remove less useful parts
3. Data Strategy Decisions
๐ DATA MANAGEMENT
โโโ Train/Dev/Test Split Strategy
โ โโโ ๐ฏ Dev & test from same distribution
โ โโโ ๐ Size based on total data available
โ โ โโโ Small dataset: 60/20/20
โ โ โโโ Medium dataset: 70/15/15
โ โ โโโ Large dataset: 98/1/1
โ โโโ ๐ Shuffle before splitting
โ
โโโ Data Mismatch Solutions
โ โโโ ๐ Create train-dev set
โ โโโ ๐ Identify distribution differences
โ โโโ ๐ฏ Make training data more representative
โ โโโ ๐ Synthesize training data to match test
โ
โโโ When to Get More Data
โโโ โ
High variance problem identified
โโโ โ
Learning curves show benefit
โโโ โ
Cost-effective to collect
โโโ โ High bias problem (won't help much)
4. Model Optimization Strategies
โ๏ธ OPTIMIZATION APPROACHES
โโโ Architecture Changes
โ โโโ ๐ง For High Bias:
โ โ โโโ Deeper networks
โ โ โโโ Wider networks
โ โ โโโ More complex models
โ โ โโโ Advanced architectures
โ โ
โ โโโ ๐ฏ For High Variance:
โ โโโ Simpler models
โ โโโ Fewer parameters
โ โโโ Regularized architectures
โ โโโ Ensemble methods
โ
โโโ Hyperparameter Tuning
โ โโโ ๐ Grid/Random search
โ โโโ ๐ Bayesian optimization
โ โโโ ๐ฏ Focus on most impactful parameters
โ โโโ ๐ Use dev set for validation
โ
โโโ Advanced Techniques
โโโ ๐ Transfer learning
โโโ ๐ Multi-task learning
โโโ ๐ฏ End-to-end vs pipeline
โโโ ๐ง Attention mechanisms
๐Key Principles from Machine Learning Yearning
The ML Strategy Loop
1
๐ Define metrics โ What success looks like
2
๐ Diagnose problems โ Bias/variance/data mismatch
3
๐ ๏ธ Apply solutions โ Based on diagnosis
4
๐ Measure improvement โ Validate on dev set
5
๐ Iterate โ Repeat until satisfactory
Critical Insights
๐ฏ Single Number Evaluation Metric
Essential for team alignment and decision making
๐ Representative Dev/Test Sets
Should reflect real-world distribution you care about
๐ Error Analysis First
Systematic analysis beats intuition for improvements
๐ Human-Level Performance
Provides crucial bias/variance intuition
โก Rapid Iteration
Quick cycles better than slow perfection
๐ Satisficing vs Optimizing
For multi-objective problems, optimize one, satisfice others
Common Pitfalls to Avoid
โ Optimizing the wrong metric - Ensure your metric aligns with business goals
โ Mismatched data distributions - Train/dev/test should come from same distribution
โ Dev set too small - Need sufficient size to detect meaningful improvements
โ Changing dev/test during development - Stick to original sets for consistency
โ Assuming more data always helps - Only helps with high variance problems
โ Skipping error analysis - Always analyze errors before optimizing