ExtraTrees / Regressor Layer
Extra Trees Regression: Extremely Randomized Trees. This implements a meta estimator that fits a number of randomized decision trees (a.k.a. extra-trees) on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting.
Mathematical formulation: where:
- tₘ are randomized trees
- M is number of trees
- Splits chosen randomly
Key characteristics:
- Extreme randomization
- Ensemble averaging
- Random split points
- Parallel training
Advantages:
- Lower variance
- Faster training
- Better generalization
- Less overfitting
Common applications:
- Large-scale regression
- Noisy data handling
- Feature importance
- Online learning
Outputs:
- Predicted Table: Results with predictions
- Validation Results: Cross-validation metrics
- Test Metric: Hold-out performance
- Feature Importances: Variable ranking
SelectFeatures
[column, ...]Feature selection for Extra Trees:
Requirements:
-
Data properties:
- Numeric features
- No missing values
- Finite numbers
- Any scale ok
-
Preprocessing needs:
- No scaling required
- Handle missing data
- Remove constants
- Check correlations
-
Model considerations:
- Feature counts
- Memory usage
- Training speed
- Random splits
Note: If empty, uses all numeric columns except target
SelectTarget
columnTarget variable for Extra Trees:
Requirements:
-
Data type:
- Numeric continuous
- No missing values
- Finite values
- Real-valued
-
Distribution aspects:
- Any distribution ok
- No scaling needed
- Check outliers
- Note range
-
Model impact:
- Split criterion
- Tree structure
- Prediction type
- Ensemble averaging
Note: Must be a single numeric column
Params
oneofDefault Extra Trees configuration:
-
Ensemble structure:
- 100 trees
- Squared error criterion
- Unlimited depth
-
Node control:
- Min samples split: 2
- Min samples leaf: 1
- No weight constraints
-
Randomization:
- No bootstrap
- Random splits
- Sqrt features
Best suited for:
- Initial modeling
- Quick exploration
- General regression
- Standard problems
Customizable Extra Trees parameters:
Parameter groups:
-
Ensemble design:
- Forest size
- Tree structure
- Split criteria
-
Randomization:
- Feature selection
- Split points
- Bootstrap options
-
Tree control:
- Growth limits
- Node constraints
- Pruning options
Trade-offs:
- Randomness vs accuracy
- Speed vs complexity
- Memory vs performance
NEstimators
u32Number of trees in forest:
Impact:
- Variance reduction: where M is n_estimators
Guidelines:
- Small: 50-100 (fast)
- Medium: 100-300 (balanced)
- Large: 300+ (stable)
Trade-off: Accuracy vs speed
Criterion
enumSplit quality measures:
Mathematical forms:
- Squared Error:
- Friedman MSE: Enhanced variance reduction
- Absolute Error:
- Poisson:
Impact on splits:
- Error measurement
- Node homogeneity
- Prediction type
- Training dynamics
Mean squared error criterion:
Properties:
- Variance reduction
- L2 loss minimization
- Mean-based splits
- Standard choice
Best for:
- Normal distributions
- Continuous targets
- General regression
Friedman's MSE criterion:
Properties:
- Improved MSE
- Split quality boost
- Better selections
- Enhanced splits
Best for:
- Complex patterns
- Quality splits
- Refined trees
Mean absolute error criterion:
Properties:
- L1 loss minimization
- Median-based splits
- Outlier resistant
- Robust behavior
Best for:
- Skewed data
- Outlier presence
- Robust predictions
Poisson deviance criterion:
Properties:
- Count data handling
- Non-negative values
- Rate prediction
- Natural for counts
Best for:
- Count regression
- Rate modeling
- Event frequency
MaxDepth
u32Maximum tree depth:
Control options:
- 0: Unlimited growth
- >0: Fixed depth limit
Effects:
- Model complexity
- Memory usage
- Training speed
Typical values:
- Shallow: 3-5
- Medium: 5-10
- Deep: 10+
Minimum samples for split:
Purpose:
- Controls granularity
- Prevents overfitting
- Ensures stability
Common values:
- 2: Maximum splits
- 5-10: Balanced
- >10: Conservative
Minimum samples in leaves:
Benefits:
- Stable predictions
- Prevents overfitting
- Controls variance
Settings:
- 1: Maximum detail
- 5-10: Stable
- >10: Smooth
Minimum weighted leaf fraction:
Usage:
- 0.0: No constraint
- >0.0: Weight control
- Range: [0.0, 0.5]
For weighted samples
MaxFeatures
enumFeature subset size control:
Options:
- Auto: All features
- Sqrt: √n_features
- Log2: log₂(n_features)
- Custom: User-defined
Impact:
- Split randomization
- Tree diversity
- Computation speed
- Feature exploration
Use all features:
Properties:
- Full feature set
- Maximum information
- Thorough splits
- Slower computation
Best for:
- Small feature sets
- Important decisions
- Complete analysis
Square root selection:
Formula:
Properties:
- Balanced selection
- Good randomization
- Standard choice
Best for:
- Medium feature sets
- General use
- Default choice
Logarithmic selection:
Formula:
Properties:
- Smaller subsets
- More randomization
- Faster splits
Best for:
- Large feature sets
- High dimensions
- Quick training
User-defined selection:
Properties:
- Manual control
- Flexible sizing
- Problem-specific
- Fine-tuning
Best for:
- Expert knowledge
- Special cases
- Optimization
MaxFeaturesF
u32Custom feature count:
Usage:
- Active with MaxFeatures=Custom
- Must be ≤ total features
Selection guide:
- Small: More randomization
- Large: Better splits
- Balance: Speed vs quality
MaxLeafNodes
u32Maximum leaf node count:
Control:
- 0: Unlimited leaves
- >0: Best-first growth
Effects:
- Tree size control
- Memory bounds
- Model complexity
Alternative to max_depth
Minimum impurity decrease:
Purpose:
- Prevents weak splits
- Quality control
- Pre-pruning method
Higher values: More conservative
Bootstrap
boolWhether samples are drawn with replacement.
When True:
- Random sampling with replacement
- ~63.2% unique samples per tree
- Increased diversity
When False:
- Use full dataset
- Default for Extra Trees
- Pure random splits
OobScore
boolWhether to use out-of-bag samples to estimate the generalization score.
Requirements:
- bootstrap = True
- Sufficient samples
Benefits:
- Unbiased estimation
- No validation set needed
- Performance monitoring
RandomState
u64Random number control:
Affects:
- Feature selection
- Split points
- Bootstrap samples
Settings:
- 0: System random
- Fixed: Reproducible
- Different: Variations
WarmStart
boolWhen set to True, reuse the solution of the previous call to fit and add more estimators to the ensemble, otherwise, just fit a whole new ensemble.
When True:
- Keep existing trees
- Add more estimators
- Continue training
When False:
- Fresh forest
- Complete rebuild
- Independent training
CcpAlpha
f64Cost-complexity pruning:
Criterion:
Impact:
- Larger α: More pruning
- Smaller α: Less pruning
- 0: No pruning
Post-training optimization
MaxSamples
f64If bootstrap is True, the fraction of samples to draw from X to train each base estimator.
When bootstrap=True:
- Fraction of samples
- Range: [0, 1.0]
- 0: Use full size
Effects:
- Tree diversity
- Training speed
- Memory usage
Extra Trees hyperparameter optimization:
Search dimensions:
-
Ensemble structure:
- Number of trees
- Tree depth
- Split criteria
-
Randomization:
- Feature selection
- Bootstrap options
- Split thresholds
-
Tree constraints:
- Node sizes
- Leaf conditions
- Growth limits
Best practices:
- Start with core params
- Consider interactions
- Monitor resources
- Balance diversity
NEstimators
[u32, ...]Forest size search:
Search patterns:
-
Basic range:
- [50, 100, 200]
- Initial testing
- Quick evaluation
-
Production range:
- [100, 300, 500]
- Full performance
- Stable results
-
Large-scale:
- [500, 1000]
- Maximum stability
- Resource intensive
Criterion
[enum, ...]Split quality measures:
Mathematical forms:
- Squared Error:
- Friedman MSE: Enhanced variance reduction
- Absolute Error:
- Poisson:
Impact on splits:
- Error measurement
- Node homogeneity
- Prediction type
- Training dynamics
Mean squared error criterion:
Properties:
- Variance reduction
- L2 loss minimization
- Mean-based splits
- Standard choice
Best for:
- Normal distributions
- Continuous targets
- General regression
Friedman's MSE criterion:
Properties:
- Improved MSE
- Split quality boost
- Better selections
- Enhanced splits
Best for:
- Complex patterns
- Quality splits
- Refined trees
Mean absolute error criterion:
Properties:
- L1 loss minimization
- Median-based splits
- Outlier resistant
- Robust behavior
Best for:
- Skewed data
- Outlier presence
- Robust predictions
Poisson deviance criterion:
Properties:
- Count data handling
- Non-negative values
- Rate prediction
- Natural for counts
Best for:
- Count regression
- Rate modeling
- Event frequency
MaxDepth
[u32, ...]Tree depth search:
Search spaces:
-
Shallow trees:
- [3, 5, 7]
- Fast training
- Simple models
-
Deep trees:
- [10, 15, 20]
- Complex patterns
- More capacity
-
Mixed range:
- [5, 10, None]
- Compare depths
MinSamplesSplit
[u32, ...]Split threshold search:
Search patterns:
-
Detailed splits:
- [2, 5, 10]
- Fine granularity
-
Conservative:
- [10, 20, 50]
- Stable splits
-
Mixed approach:
- [2, 10, 30]
- Range comparison
MinSamplesLeaf
[u32, ...]Leaf size search:
Search ranges:
-
Fine-grained:
- [1, 2, 4]
- Detailed predictions
- Maximum splits
-
Stable leaves:
- [5, 10, 20]
- Robust predictions
- Noise reduction
-
Balanced:
- [1, 5, 10]
- Compare effects
MinWeightFractionLeaf
[f64, ...]Weighted leaf fraction search:
Search spaces:
-
No constraint:
- [0.0]
- Default behavior
-
Light weights:
- [0.0, 0.1, 0.2]
- Gentle control
-
Strong weights:
- [0.2, 0.3, 0.4]
- Heavy balancing
MaxFeatures
[enum, ...]Feature subset size control:
Options:
- Auto: All features
- Sqrt: √n_features
- Log2: log₂(n_features)
- Custom: User-defined
Impact:
- Split randomization
- Tree diversity
- Computation speed
- Feature exploration
Use all features:
Properties:
- Full feature set
- Maximum information
- Thorough splits
- Slower computation
Best for:
- Small feature sets
- Important decisions
- Complete analysis
Square root selection:
Formula:
Properties:
- Balanced selection
- Good randomization
- Standard choice
Best for:
- Medium feature sets
- General use
- Default choice
Logarithmic selection:
Formula:
Properties:
- Smaller subsets
- More randomization
- Faster splits
Best for:
- Large feature sets
- High dimensions
- Quick training
User-defined selection:
Properties:
- Manual control
- Flexible sizing
- Problem-specific
- Fine-tuning
Best for:
- Expert knowledge
- Special cases
- Optimization
MaxFeaturesF
[u32, ...]Custom feature count search:
Patterns:
-
Small subsets:
- [2, 4, 6]
- High randomization
-
Large subsets:
- [8, 12, 16]
- More information
Note: Used with MaxFeatures=Custom
MaxLeafNodes
[u32, ...]Leaf count search:
Search ranges:
-
Limited trees:
- [10, 20, 30]
- Controlled size
-
Large trees:
- [50, 100, None]
- Full growth
-
Mixed:
- [20, 50, 100]
- Size comparison
MinImpurityDecrease
[f64, ...]Impurity threshold search:
Search patterns:
-
Fine control:
- [0.0, 1e-4, 1e-3]
- Subtle pruning
-
Strong control:
- [1e-3, 1e-2, 1e-1]
- Heavy pruning
-
Range study:
- Multiple scales
- Effect analysis
Bootstrap
[bool, ...]Bootstrap sampling search:
Options:
-
Extra Trees style:
- [false]
- Pure random splits
-
Random Forest style:
- [true]
- With replacement
-
Compare both:
- [true, false]
- Method study
OobScore
[bool, ...]OOB scoring search:
Options:
-
No OOB: [false]
- Faster training
- Standard CV
-
With OOB: [true]
- Built-in validation
- Extra metrics
Note: Requires bootstrap=true
WarmStart
[bool, ...]When set to True, reuse the solution of the previous call to fit and add more estimators to the ensemble, otherwise, just fit a whole new ensemble.
Options:
-
Fresh start: [false]
- New ensemble
- Independent runs
-
Incremental: [true]
- Add estimators
- Continue training
-
Compare: [true, false]
- Study effect
RandomState
u64Random seed control:
Applications:
-
Development:
- Fixed seed
- Reproducible
- Debugging
-
Production:
- Multiple seeds
- Stability check
- Model variation
CcpAlpha
[f64, ...]Cost-complexity search:
Search ranges:
-
No pruning:
- [0.0]
- Full trees
-
Light pruning:
- [0.001, 0.01, 0.1]
- Gentle effect
-
Heavy pruning:
- [0.1, 0.2, 0.3]
- Strong simplification
MaxSamples
[f64, ...]Sample fraction search:
Search spaces:
-
Large samples:
- [0.7, 0.8, 0.9]
- More stable
-
Small samples:
- [0.4, 0.5, 0.6]
- More diversity
-
Full range:
- [0.3, 0.6, 0.9]
- Compare effects
RefitScore
enumRegression model evaluation metrics:
Purpose:
- Model performance evaluation
- Error measurement
- Quality assessment
- Model comparison
Selection criteria:
- Error distribution
- Scale sensitivity
- Domain requirements
- Business objectives
Model's native scoring method:
- Typically R² score
- Model-specific implementation
- Standard evaluation
- Quick assessment
Coefficient of determination (R²):
Formula:
Properties:
- Range: (-∞, 1]
- 1: Perfect prediction
- 0: Constant model
- Negative: Worse than mean
Best for:
- General performance
- Variance explanation
- Model comparison
- Standard reporting
Explained variance score:
Formula:
Properties:
- Range: (-∞, 1]
- Accounts for bias
- Variance focus
- Similar to R²
Best for:
- Variance analysis
- Bias assessment
- Model stability
Maximum absolute error:
Formula:
Properties:
- Worst case error
- Original scale
- Sensitive to outliers
- Upper error bound
Best for:
- Critical applications
- Error bounds
- Safety margins
- Risk assessment
Negative mean absolute error:
Formula:
Properties:
- Linear error scale
- Robust to outliers
- Original units
- Negated for optimization
Best for:
- Robust evaluation
- Interpretable errors
- Outlier presence
Negative mean squared error:
Formula:
Properties:
- Squared error scale
- Outlier sensitive
- Squared units
- Negated for optimization
Best for:
- Standard optimization
- Large error penalty
- Statistical analysis
Negative root mean squared error:
Formula:
Properties:
- Original scale
- Outlier sensitive
- Interpretable units
- Negated for optimization
Best for:
- Standard reporting
- Interpretable errors
- Model comparison
Negative mean squared logarithmic error:
Formula:
Properties:
- Relative error scale
- For positive values
- Sensitive to ratios
- Negated for optimization
Best for:
- Exponential growth
- Relative differences
- Positive predictions
Negative median absolute error:
Formula:
Properties:
- Highly robust
- Original scale
- Outlier resistant
- Negated for optimization
Best for:
- Robust evaluation
- Heavy-tailed errors
- Outlier presence
Negative Poisson deviance:
Formula:
Properties:
- For count data
- Non-negative values
- Poisson assumption
- Negated for optimization
Best for:
- Count prediction
- Event frequency
- Rate modeling
Negative Gamma deviance:
Formula:
Properties:
- For positive continuous data
- Constant CV assumption
- Relative errors
- Negated for optimization
Best for:
- Positive continuous data
- Multiplicative errors
- Financial modeling
Negative mean absolute percentage error:
Formula:
Properties:
- Percentage scale
- Scale independent
- For non-zero targets
- Negated for optimization
Best for:
- Relative performance
- Scale-free comparison
- Business metrics
D² score with absolute error:
Formula:
Properties:
- Range: (-∞, 1]
- Robust version of R²
- Linear error scale
- Outlier resistant
Best for:
- Robust evaluation
- Non-normal errors
- Alternative to R²
D² score with pinball loss:
Properties:
- Quantile focus
- Asymmetric errors
- Risk assessment
- Distribution modeling
Best for:
- Quantile regression
- Risk analysis
- Asymmetric costs
- Distribution tails
D² score with Tweedie deviance:
Properties:
- Compound Poisson-Gamma
- Flexible dispersion
- Mixed distributions
- Insurance modeling
Best for:
- Insurance claims
- Mixed continuous-discrete
- Compound distributions
- Specialized modeling
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