AdaBoost / Classifier Layer
AdaBoost Classifier is a meta-estimator that begins by fitting a classifier on the original dataset and then fits additional copies of the classifier on the same dataset but where the weights of incorrectly classified instances are adjusted such that subsequent classifiers focus more on difficult cases. This class implements the Adaptive Boosting Ensemble Algorithm:
Mathematical form: where:
- are weak learners
- are learner weights
- M is number of estimators
Key characteristics:
- Sequential ensemble learning
- Adaptive sample weighting
- Focus on hard examples
- Weighted majority voting
- Automatic feature selection
Common applications:
- Face detection
- Object recognition
- Text classification
- Fraud detection
- Medical diagnosis
Computational notes:
- Time complexity: O(M * n_samples * depth)
- Memory usage: O(M * n_nodes)
- Scales linearly with estimators
- Parallel prediction possible
Outputs:
- Predicted Table: Input data with predictions
- Validation Results: Cross-validation metrics
- Test Metric: Test set performance
- ROC Curve Data: ROC analysis information
- Confusion Matrix: Classification breakdown
- Feature Importances: Aggregated importance scores
Note: Sensitive to noisy data and outliers
SelectFeatures
[column, ...]Feature columns for AdaBoost Classification:
Data requirements:
-
Supported types:
- Numeric (int, float)
- Encoded categoricals
- Binary indicators
- No missing values
-
Preprocessing tips:
- No scaling needed (scale-invariant)
- Encode categorical variables
- Handle missing data
- Remove irrelevant features
-
Feature quality:
- Check for correlations
- Remove redundant features
- Consider interactions
- Ensure predictive power
Note: If empty, uses all numeric columns except target
SelectTarget
columnTarget column for AdaBoost Classification:
Requirements:
-
Data format:
- Categorical labels
- At least two classes
- No missing values
- Consistent encoding
-
Class characteristics:
- Check class balance
- Note rare classes
- Consider class weights
- Monitor class sizes
-
Quality checks:
- Valid categories
- Proper encoding
- Label consistency
- Data integrity
Params
oneofOptimized default configuration for AdaBoost Classification:
-
Ensemble parameters:
- N estimators: 50 (ensemble size)
- Learning rate: 1.0 (full contribution)
- Algorithm: SAMME.R (real-valued boosting)
-
Base estimator (Decision Tree):
- Max depth: 1 (decision stumps)
- Criterion: Gini impurity
- Splitter: Best splits
- Min samples split: 2
- Min samples leaf: 1
-
Feature settings:
- Max features: All features
- Min impurity decrease: 0.0
- No feature constraints
-
Regularization:
- No explicit pruning
- No class weights
- CCP alpha: 0.0
Optimal for:
- Small to medium datasets
- Binary classification
- Balanced classes
- Quick prototyping
Performance characteristics:
- Training time: O(n_estimators * n_samples * log(n_samples))
- Memory usage: O(n_estimators * n_samples)
- Prediction time: O(n_estimators * log(n_samples))
Note: These defaults balance performance and computational efficiency
Fine-tuned configuration for AdaBoost Classification:
Parameter categories:
-
Ensemble control:
- Number of estimators
- Learning rate
- Sequential process
- Model combination
-
Base estimator (Decision Tree):
- Tree structure
- Split criteria
- Node constraints
- Feature selection
-
Regularization:
- Sample weights
- Tree complexity
- Learning control
- Overfitting prevention
Note: Parameter interactions significantly impact ensemble behavior
NEstimators
u32Number of boosting stages:
Properties:
- Controls ensemble size
- Affects model complexity
- Impacts training time
- Memory usage scales linearly
Guidelines:
- Small (10-50): Quick models
- Medium (50-200): Standard use
- Large (>200): Complex problems
Trade-offs:
- More estimators: Better performance but slower
- Interacts with learning rate
- Diminishing returns after convergence
LearningRate
f64Contribution weight for each classifier:
Formula: where:
- is learning rate
- is weak learner
Properties:
- Controls step size
- Shrinkage parameter
- Regularization effect
Typical ranges:
- Strong (0.5-1.0): Fast learning
- Moderate (0.1-0.5): Balanced
- Weak (0.01-0.1): Careful steps
RandomState
u64Random number generator seed. Controls the random seed given at each estimator at each boosting iteration. Thus, it is only used when estimator exposes a random_state. Pass an int for reproducible output across multiple function calls.
Important for:
- Reproducibility
- Debugging
- Result validation
- Experimental control
Criterion
enumSplit quality criteria for base estimators:
Purpose:
- Weak learner optimization
- Local decision quality
- Split point selection
- Tree construction
Impact:
- Base model accuracy
- Ensemble diversity
- Learning speed
- Model complexity
Gini impurity for splits:
Formula:
Properties:
- Range: [0, 1-1/K]
- Fast computation
- Quadratic measure
- Boosting-friendly
Best for:
- Quick training
- Balanced classes
- Binary splits
- Standard cases
Information gain criterion:
Formula:
Properties:
- Range: [0, log(K)]
- Information theoretic
- More computations
- Detailed splits
Best for:
- Multi-class problems
- Complex patterns
- Detailed trees
- Information focus
Logarithmic loss criterion:
Formula:
Properties:
- Probability sensitive
- Confidence aware
- Boosting aligned
- Cost sensitive
Best for:
- Probability trees
- SAMME.R algorithm
- Risk assessment
- Confidence needs
Splitter
enumSplit strategy for base estimators:
Purpose:
- Tree construction
- Ensemble diversity
- Computation control
- Memory management
Impact:
- Training speed
- Model variance
- Ensemble quality
- Resource usage
Optimal split selection:
Properties:
- Exhaustive search
- Deterministic splits
- Maximum quality
- More computation
Best for:
- Small-medium data
- Quality priority
- Reproducibility
- Stable ensembles
Randomized split selection:
Properties:
- Feature subsampling
- Faster training
- Higher diversity
- Memory efficient
Best for:
- Large datasets
- Diverse ensembles
- Quick training
- Memory constraints
MaxDepth
u32Maximum depth of base estimators:
Values:
- 1: Decision stumps (recommended)
- >1: Deeper trees
- 0: Unlimited depth
Impact:
- Weak learner complexity
- Training time
- Memory usage
- Overfitting risk
Note: Simple trees often work best in AdaBoost
Minimum samples for node splitting:
Constraint: where N is node samples
Effects:
- Controls tree growth
- Prevents overfitting
- Ensures stability
- Affects tree size
Minimum samples in leaf nodes:
Constraint: where L is leaf samples
Purpose:
- Ensures prediction stability
- Controls overfitting
- Manages leaf size
- Affects tree structure
Minimum weighted fraction at leaves:
Constraint: where W is sample weight sum
Usage:
- Weighted sample control
- Adapts to boosting weights
- Alternative size control
- Handles imbalance
MaxFeatures
enumFeature subset size for base estimators:
Purpose:
- Feature randomization
- Ensemble diversity
- Computation control
- Overfitting prevention
Impact:
- Model variance
- Training speed
- Memory usage
- Ensemble strength
Use all features:
Formula: where F is total features
Properties:
- Maximum information
- Full feature space
- Deterministic splits
- Higher computation
Best for:
- Small feature sets
- Important interactions
- Quality focus
- Standard boosting
Square root scaling:
Formula: where F is total features
Properties:
- Moderate reduction
- Balanced trade-off
- Popular choice
- Good defaults
Best for:
- Medium dimensions
- General use
- Balanced speed
- Standard cases
Logarithmic scaling:
Formula: where F is total features
Properties:
- Aggressive reduction
- Fastest computation
- Maximum randomness
- High diversity
Best for:
- High dimensions
- Quick training
- Memory limits
- Many features
User-defined feature count:
Properties:
- Full control
- Manual tuning
- Flexible setting
- Problem-specific
Best for:
- Expert users
- Special cases
- Fine-tuning
- Research needs
MaxFeaturesF
u32Custom value of max features. Only used when max_features
is custom
.
MaxLeafNodes
u32Maximum number of leaf nodes:
Values:
- 0: Unlimited leaves
- >0: Leaf count limit
Controls:
- Tree size
- Model complexity
- Memory usage
- Training speed
Minimum impurity decrease for splits:
Constraint:
Purpose:
- Quality threshold
- Prevents weak splits
- Controls growth
- Optimizes structure
ClassWeight
enumClass weighting schemes for base estimators:
Purpose:
- Sample importance
- Class balance
- Error costs
- Learning focus
Note: Interacts with AdaBoost's own weighting
Uniform class weights:
Properties:
- Equal importance
- Natural distribution
- AdaBoost weighting only
- Default behavior
Best for:
- Balanced data
- Standard boosting
- Simple cases
- Default choice
Inverse frequency weighting:
Formula:
where:
- is total samples
- is class count
- is class i samples
Best for:
- Imbalanced data
- Rare classes
- Fair learning
- Cost sensitivity
CcpAlpha
f64Cost-Complexity Pruning alpha:
Formula:
Effects:
- Tree simplification
- Complexity control
- Overfitting prevention
- Size optimization
Note: Less critical for decision stumps
Hyperparameter optimization for AdaBoost Classification:
Search process:
-
Ensemble parameters:
- Number of estimators
- Learning rate
- Combined complexity
-
Base estimator tuning:
- Tree structure
- Split criteria
- Node constraints
-
Regularization:
- Pruning parameters
- Sample thresholds
- Feature selection
Computational impact:
- Time: O(n_params * n_estimators * n_samples)
- Memory: O(n_params * n_estimators)
- Storage: O(n_models)
Best practices:
- Start with ensemble parameters
- Keep trees simple
- Consider interactions
- Monitor resources
NEstimators
[u32, ...]Number of boosting stages to search:
Common patterns:
- Quick search: [10, 50, 100]
- Standard: [50, 100, 200, 500]
- Extensive: [100, 250, 500, 1000]
Trade-offs:
- Model performance
- Training time
- Memory usage
- Convergence rate
Note: Consider learning_rate interaction - lower rates need more estimators
LearningRate
[f64, ...]Contribution weight of each classifier to search:
Common ranges:
- Coarse: [0.01, 0.1, 1.0]
- Fine: [0.01, 0.05, 0.1, 0.5]
- Detailed: [0.001, 0.01, 0.05, 0.1]
Guidelines:
- Lower rates need more estimators
- Higher rates risk overfitting
- Balance with n_estimators
- Consider convergence speed
RandomState
u64Random seed for reproducibility:
Controls randomization in:
- Sample weight initialization
- Base estimator splits
- Feature selection
Pass an int for reproducible output across multiple function calls
Criterion
enumSplit quality criteria for base estimators:
Purpose:
- Weak learner optimization
- Local decision quality
- Split point selection
- Tree construction
Impact:
- Base model accuracy
- Ensemble diversity
- Learning speed
- Model complexity
Gini impurity for splits:
Formula:
Properties:
- Range: [0, 1-1/K]
- Fast computation
- Quadratic measure
- Boosting-friendly
Best for:
- Quick training
- Balanced classes
- Binary splits
- Standard cases
Information gain criterion:
Formula:
Properties:
- Range: [0, log(K)]
- Information theoretic
- More computations
- Detailed splits
Best for:
- Multi-class problems
- Complex patterns
- Detailed trees
- Information focus
Logarithmic loss criterion:
Formula:
Properties:
- Probability sensitive
- Confidence aware
- Boosting aligned
- Cost sensitive
Best for:
- Probability trees
- SAMME.R algorithm
- Risk assessment
- Confidence needs
Splitter
enumSplit strategy for base estimators:
Purpose:
- Tree construction
- Ensemble diversity
- Computation control
- Memory management
Impact:
- Training speed
- Model variance
- Ensemble quality
- Resource usage
Optimal split selection:
Properties:
- Exhaustive search
- Deterministic splits
- Maximum quality
- More computation
Best for:
- Small-medium data
- Quality priority
- Reproducibility
- Stable ensembles
Randomized split selection:
Properties:
- Feature subsampling
- Faster training
- Higher diversity
- Memory efficient
Best for:
- Large datasets
- Diverse ensembles
- Quick training
- Memory constraints
MaxDepth
u32Maximum tree depths to evaluate:
Values:
- 0: Unlimited depth
- 1: Decision stumps (common for AdaBoost)
- >1: Deeper trees (use with caution)
Note: Nodes expand until pure or below min_samples_split
Minimum samples for split thresholds to search:
Common ranges:
- Small trees: [2, 5, 10]
- Larger trees: [10, 20, 50]
Controls complexity and prevents overfitting
Minimum samples in leaf thresholds to evaluate:
Common ranges:
- Decision stumps: [1, 2]
- Deeper trees: [1, 5, 10]
Ensures statistical significance in predictions
Minimum weighted fraction of samples in leaves to search:
Typical ranges:
- Conservative: [0.0, 0.01, 0.05]
- Aggressive: [0.1, 0.2, 0.3]
Important when using sample weights or class weights
MaxFeatures
enumFeature subset size for base estimators:
Purpose:
- Feature randomization
- Ensemble diversity
- Computation control
- Overfitting prevention
Impact:
- Model variance
- Training speed
- Memory usage
- Ensemble strength
Use all features:
Formula: where F is total features
Properties:
- Maximum information
- Full feature space
- Deterministic splits
- Higher computation
Best for:
- Small feature sets
- Important interactions
- Quality focus
- Standard boosting
Square root scaling:
Formula: where F is total features
Properties:
- Moderate reduction
- Balanced trade-off
- Popular choice
- Good defaults
Best for:
- Medium dimensions
- General use
- Balanced speed
- Standard cases
Logarithmic scaling:
Formula: where F is total features
Properties:
- Aggressive reduction
- Fastest computation
- Maximum randomness
- High diversity
Best for:
- High dimensions
- Quick training
- Memory limits
- Many features
User-defined feature count:
Properties:
- Full control
- Manual tuning
- Flexible setting
- Problem-specific
Best for:
- Expert users
- Special cases
- Fine-tuning
- Research needs
MaxFeaturesF
u32Feature count values to try when max_features is Custom:
Common ranges:
- Conservative: [1, 2, 3]
- Moderate: [2, 4, 6] Must be ≥ 1 and ≤ total features
MaxLeafNodes
u32Maximum leaf node counts to evaluate:
Values:
- 0: Unlimited leaves
- >0: Best-first growth with specified limit
Alternative to max_depth for controlling tree size
Minimum impurity decrease thresholds to search:
Common ranges:
- Fine: [0.0, 0.0001, 0.001]
- Coarse: [0.0, 0.001, 0.01]
Controls split quality and tree growth
ClassWeight
enumClass weighting schemes for base estimators:
Purpose:
- Sample importance
- Class balance
- Error costs
- Learning focus
Note: Interacts with AdaBoost's own weighting
Uniform class weights:
Properties:
- Equal importance
- Natural distribution
- AdaBoost weighting only
- Default behavior
Best for:
- Balanced data
- Standard boosting
- Simple cases
- Default choice
Inverse frequency weighting:
Formula:
where:
- is total samples
- is class count
- is class i samples
Best for:
- Imbalanced data
- Rare classes
- Fair learning
- Cost sensitivity
CcpAlpha
f64Cost-complexity pruning alphas to evaluate:
Typical ranges:
- Light pruning: [0.0, 0.001, 0.01]
- Heavy pruning: [0.01, 0.05, 0.1]
Controls tree complexity post-training
RefitScore
enumPerformance evaluation metrics for AdaBoost classification:
Purpose:
- Model evaluation
- Ensemble selection
- Early stopping
- Performance tracking
Selection criteria:
- Problem objectives
- Class distribution
- Ensemble size
- Computation resources
Uses ensemble's built-in scoring:
Properties:
- Weighted accuracy metric
- Ensemble-aware scoring
- Fast computation
- Boosting-compatible
Best for:
- Standard problems
- Quick evaluation
- Initial testing
- Performance tracking
Standard classification accuracy:
Formula:
Properties:
- Range: [0, 1]
- Ensemble consensus
- Intuitive metric
- Equal error weights
Best for:
- Balanced datasets
- Equal error costs
- Simple evaluation
- Quick benchmarking
Class-normalized accuracy score:
Formula:
Properties:
- Range: [0, 1]
- Class-weighted
- Imbalance-robust
- Fair evaluation
Best for:
- Imbalanced data
- Varied class sizes
- Minority focus
- Fair assessment
Logarithmic loss (Cross-entropy):
Formula:
Properties:
- Range: [0, ∞)
- Probability-sensitive
- Boosting-optimal
- Confidence-aware
Best for:
- Probability estimation
- Boosting optimization
- Risk assessment
- Model calibration
Area Under ROC Curve:
Properties:
- Range: [0, 1]
- Ranking quality
- Threshold-invariant
- Ensemble-appropriate
Best for:
- Binary problems
- Ranking tasks
- Score calibration
- Model comparison
Note: Extended to multi-class via averaging
Split
oneofStandard train-test split configuration optimized for general classification tasks.
Configuration:
- Test size: 20% (0.2)
- Random seed: 98
- Shuffling: Enabled
- Stratification: Based on target distribution
Advantages:
- Preserves class distribution
- Provides reliable validation
- Suitable for most datasets
Best for:
- Medium to large datasets
- Independent observations
- Initial model evaluation
Splitting uses the ShuffleSplit strategy or StratifiedShuffleSplit strategy depending on the field stratified
. Note: If shuffle is false then stratified must be false.
Configurable train-test split parameters for specialized requirements. Allows fine-tuning of data division strategy for specific use cases or constraints.
Use cases:
- Time series data
- Grouped observations
- Specific train/test ratios
- Custom validation schemes
RandomState
u64Random seed for reproducible splits. Ensures:
- Consistent train/test sets
- Reproducible experiments
- Comparable model evaluations
Same seed guarantees identical splits across runs.
Shuffle
boolData shuffling before splitting. Effects:
- true: Randomizes order, better for i.i.d. data
- false: Maintains order, important for time series
When to disable:
- Time dependent data
- Sequential patterns
- Grouped observations
TrainSize
f64Proportion of data for training. Considerations:
- Larger (e.g., 0.8-0.9): Better model learning
- Smaller (e.g., 0.5-0.7): Better validation
Common splits:
- 0.8: Standard (80/20 split)
- 0.7: More validation emphasis
- 0.9: More training emphasis
Stratified
boolMaintain class distribution in splits. Important when:
- Classes are imbalanced
- Small classes present
- Representative splits needed
Requirements:
- Classification tasks only
- Cannot use with shuffle=false
- Sufficient samples per class
Cv
oneofStandard cross-validation configuration using stratified 3-fold splitting.
Configuration:
- Folds: 3
- Method: StratifiedKFold
- Stratification: Preserves class proportions
Advantages:
- Balanced evaluation
- Reasonable computation time
- Good for medium-sized datasets
Limitations:
- May be insufficient for small datasets
- Higher variance than larger fold counts
- May miss some data patterns
Configurable stratified k-fold cross-validation for specific validation requirements.
Features:
- Adjustable fold count with
NFolds
determining the number of splits. - Stratified sampling
- Preserved class distributions
Use cases:
- Small datasets (more folds)
- Large datasets (fewer folds)
- Detailed model evaluation
- Robust performance estimation
NFolds
u32Number of cross-validation folds. Guidelines:
- 3-5: Large datasets, faster training
- 5-10: Standard choice, good balance
- 10+: Small datasets, thorough evaluation
Trade-offs:
- More folds: Better evaluation, slower training
- Fewer folds: Faster training, higher variance
Must be at least 2.
K-fold cross-validation without stratification. Divides data into k consecutive folds for iterative validation.
Process:
- Splits data into k equal parts
- Each fold serves as validation once
- Remaining k-1 folds form training set
Use cases:
- Regression problems
- Large, balanced datasets
- When stratification unnecessary
- Continuous target variables
Limitations:
- May not preserve class distributions
- Less suitable for imbalanced data
- Can create biased splits with ordered data
NSplits
u32Number of folds for cross-validation. Selection guide: Recommended values:
- 5: Standard choice (default)
- 3: Large datasets/quick evaluation
- 10: Thorough evaluation/smaller datasets
Trade-offs:
- Higher values: More thorough, computationally expensive
- Lower values: Faster, potentially higher variance
Must be at least 2 for valid cross-validation.
RandomState
u64Random seed for fold generation when shuffling. Important for:
- Reproducible results
- Consistent fold assignments
- Benchmark comparisons
- Debugging and validation
Set specific value for reproducibility across runs.
Shuffle
boolWhether to shuffle data before splitting into folds. Effects:
- true: Randomized fold composition (recommended)
- false: Sequential splitting
Enable when:
- Data may have ordering
- Better fold independence needed
Disable for:
- Time series data
- Ordered observations
Stratified K-fold cross-validation maintaining class proportions across folds.
Key features:
- Preserves class distribution in each fold
- Handles imbalanced datasets
- Ensures representative splits
Best for:
- Classification problems
- Imbalanced class distributions
- When class proportions matter
Requirements:
- Classification tasks only
- Sufficient samples per class
- Categorical target variable
NSplits
u32Number of stratified folds. Guidelines: Typical values:
- 5: Standard for most cases
- 3: Quick evaluation/large datasets
- 10: Detailed evaluation/smaller datasets
Considerations:
- Must allow sufficient samples per class per fold
- Balance between stability and computation time
- Consider smallest class size when choosing
RandomState
u64Seed for reproducible stratified splits. Ensures:
- Consistent fold assignments
- Reproducible results
- Comparable experiments
- Systematic validation
Fixed seed guarantees identical stratified splits.
Shuffle
boolData shuffling before stratified splitting. Impact:
- true: Randomizes while maintaining stratification
- false: Maintains data order within strata
Use cases:
- true: Independent observations
- false: Grouped or sequential data
Class proportions maintained regardless of setting.
Random permutation cross-validator with independent sampling.
Characteristics:
- Random sampling for each split
- Independent train/test sets
- More flexible than K-fold
- Can have overlapping test sets
Advantages:
- Control over test size
- Fresh splits each iteration
- Good for large datasets
Limitations:
- Some samples might never be tested
- Others might be tested multiple times
- No guarantee of complete coverage
NSplits
u32Number of random splits to perform. Consider: Common values:
- 5: Standard evaluation
- 10: More thorough assessment
- 3: Quick estimates
Trade-offs:
- More splits: Better estimation, longer runtime
- Fewer splits: Faster, less stable estimates
Balance between computation and stability.
RandomState
u64Random seed for reproducible shuffling. Controls:
- Split randomization
- Sample selection
- Result reproducibility
Important for:
- Debugging
- Comparative studies
- Result verification
TestSize
f64Proportion of samples for test set. Guidelines: Common ratios:
- 0.2: Standard (80/20 split)
- 0.25: More validation emphasis
- 0.1: More training data
Considerations:
- Dataset size
- Model complexity
- Validation requirements
It must be between 0.0 and 1.0.
Stratified random permutation cross-validator combining shuffle-split with stratification.
Features:
- Maintains class proportions
- Random sampling within strata
- Independent splits
- Flexible test size
Ideal for:
- Imbalanced datasets
- Large-scale problems
- When class distributions matter
- Flexible validation schemes
NSplits
u32Number of stratified random splits. Guidelines: Recommended values:
- 5: Standard evaluation
- 10: Detailed analysis
- 3: Quick assessment
Consider:
- Sample size per class
- Computational resources
- Stability requirements
RandomState
u64Seed for reproducible stratified sampling. Ensures:
- Consistent class proportions
- Reproducible splits
- Comparable experiments
Critical for:
- Benchmarking
- Research studies
- Quality assurance
TestSize
f64Fraction of samples for stratified test set. Best practices: Common splits:
- 0.2: Balanced evaluation
- 0.3: More thorough testing
- 0.15: Preserve training size
Consider:
- Minority class size
- Overall dataset size
- Validation objectives
It must be between 0.0 and 1.0.
Time Series cross-validator. Provides train/test indices to split time series data samples that are observed at fixed time intervals, in train/test sets. It is a variation of k-fold which returns first k
folds as train set and the k + 1
th fold as test set. Note that unlike standard cross-validation methods, successive training sets are supersets of those that come before them. Also, it adds all surplus data to the first training partition, which is always used to train the model.
Key features:
- Maintains temporal dependence
- Expanding window approach
- Forward-chaining splits
- No future data leakage
Use cases:
- Sequential data
- Financial forecasting
- Temporal predictions
- Time-dependent patterns
Note: Training sets are supersets of previous iterations.
NSplits
u32Number of temporal splits. Considerations: Typical values:
- 5: Standard forward chaining
- 3: Limited historical data
- 10: Long time series
Impact:
- Affects training window growth
- Determines validation points
- Influences computational load
MaxTrainSize
u64Maximum size of training set. Should be strictly less than the number of samples. Applications:
- 0: Use all available past data
- >0: Rolling window of fixed size
Use cases:
- Limit historical relevance
- Control computational cost
- Handle concept drift
- Memory constraints
TestSize
u64Number of samples in each test set. When 0:
- Auto-calculated as n_samples/(n_splits+1)
- Ensures equal-sized test sets
Considerations:
- Forecast horizon
- Validation requirements
- Available future data
Gap
u64Number of samples to exclude from the end of each train set before the test set.Gap between train and test sets. Uses:
- Avoid data leakage
- Model forecast lag
- Buffer periods
Common scenarios:
- 0: Continuous prediction
- >0: Forward gap for realistic evaluation
- Match business forecasting needs