GradientBoosting / Regressor Layer

Gradient Boosting Regression: Sequential ensemble learning. This estimator builds an additive model in a forward stage-wise fashion; it allows for the optimization of arbitrary differentiable loss functions. In each stage a regression tree is fit on the negative gradient of the given loss function.

Mathematical formulation: where:

  • Fₘ is the model at stage m
  • hₘ is the weak learner
  • ν is the learning rate
  • Each hₘ fits pseudo-residuals

Key characteristics:

  • Stage-wise additive modeling
  • Gradient-based optimization
  • Flexible loss functions
  • Strong predictive power

Advantages:

  • High accuracy
  • Handles non-linearity
  • Feature interactions
  • Robust performance

Common applications:

  • Complex regression
  • Feature importance
  • Robust prediction
  • Production systems

Outputs:

  1. Predicted Table: Results with predictions
  2. Validation Results: Cross-validation metrics
  3. Test Metric: Hold-out performance
  4. Feature Importances: Variable contributions
Table
0
0
Predicted Table
1
Validation Results
2
Test Metric
3
Feature Importances

SelectFeatures

[column, ...]

Feature selection for Gradient Boosting:

Requirements:

  1. Data properties:

    • Numeric features
    • No missing values
    • Finite numbers
    • Any scale ok
  2. Preprocessing needs:

    • No scaling required
    • Handle missing data
    • Remove constants
    • Check correlations
  3. Model considerations:

    • Feature importance
    • Gradient calculation
    • Memory usage
    • Training speed
  4. Best practices:

    • Remove redundant features
    • Consider interactions
    • Monitor importance
    • Feature selection

Note: If empty, uses all numeric columns except target

Target variable for Gradient Boosting:

Requirements:

  1. Data type:

    • Numeric continuous
    • No missing values
    • Finite values
    • Real-valued
  2. Distribution properties:

    • Any distribution ok
    • Loss function match
    • Check outliers
    • Note range
  3. Model impact:

    • Gradient computation
    • Loss optimization
    • Residual fitting
    • Stage-wise learning
  4. Loss selection:

    • Normal: SquaredError
    • Robust: AbsoluteError
    • Mixed: Huber
    • Quantile: Distribution tails

Note: Must be a single numeric column

Params

oneof
DefaultParams

Default Gradient Boosting configuration:

  1. Learning setup:

    • Loss: Squared error
    • Learning rate: 0.1
    • Trees: 100
  2. Tree structure:

    • Max depth: 3
    • Min samples split: 2
    • Friedman MSE criterion
  3. Optimization:

    • Full samples (1.0)
    • Early stopping ready
    • Validation: 10%

Best suited for:

  • Initial modeling
  • Medium datasets
  • General regression
  • Standard problems

Customizable Gradient Boosting parameters:

Parameter groups:

  1. Boosting strategy:

    • Loss function
    • Learning rate
    • Number of estimators
  2. Tree structure:

    • Depth control
    • Split criteria
    • Node constraints
  3. Optimization:

    • Subsampling
    • Early stopping
    • Feature selection

Trade-offs:

  • Speed vs accuracy
  • Memory vs performance
  • Bias vs variance

Loss

enum
SquaredError

Loss function selection:

Mathematical forms:

  1. Squared Error:
  2. Absolute Error:
  3. Huber: Combines L1 and L2
  4. Quantile:

Impact:

  • Optimization behavior
  • Robustness properties
  • Prediction characteristics
  • Training dynamics
SquaredError ~

L2 loss function:

Properties:

  • Mean estimation
  • Larger penalties
  • Smooth gradients
  • Standard choice

Best for:

  • Normal noise
  • Clean data
  • General regression
AbsoluteError ~

L1 loss function:

Properties:

  • Median estimation
  • Constant gradients
  • Outlier robust
  • Linear penalties

Best for:

  • Noisy data
  • Outlier presence
  • Robust predictions
Huber ~

Huber loss function:

Properties:

  • Combined L1/L2
  • Adaptive behavior
  • Robust-smooth mix
  • Controlled transition

Best for:

  • Mixed noise
  • Unknown distribution
  • Balance robustness
Quantile ~

Quantile loss function:

Properties:

  • Quantile estimation
  • Asymmetric penalties
  • Distribution focused
  • Flexible modeling

Best for:

  • Specific quantiles
  • Risk assessment
  • Uncertainty bounds

The number of boosting stages to perform. Gradient boosting is fairly robust to over-fitting so a large number usually results in better performance.

Impact: where ν is learning rate

Trade-off:

  • Small ν: More trees needed
  • Large ν: Fewer trees

Typical ranges:

  • Small: 0.01-0.1
  • Large: 0.1-0.3

Number of boosting stages:

Selection guide:

  1. With small learning rate:

    • More estimators needed
    • Better generalization
  2. With large learning rate:

    • Fewer estimators
    • Faster training

Common ranges:

  • Basic: 100-500
  • Advanced: 500-2000

The fraction of samples to be used for fitting the individual base learners.

Effects:

  • <1.0: Stochastic boosting
  • 1.0: Traditional boosting

Benefits of subsampling:

  • Reduces variance
  • Prevents overfitting
  • Faster training

Typical values:

  • 0.5-0.8: More randomization
  • 0.8-1.0: More stability
FriedmanMse

Split quality measures:

Options:

  1. Friedman MSE:

    • Enhanced measurement
    • Improvement scoring
    • Better splits
  2. Standard MSE:

    • Simple variance reduction
    • Direct measurement
    • Basic approach

Impact:

  • Tree structure
  • Split selection
  • Learning quality
FriedmanMse ~

Friedman's improvement score:

Properties:

  • Advanced criterion
  • Considers variance
  • Split potential
  • Default choice

Best for:

  • General use
  • Quality splits
  • Better trees
Mse ~

Standard mean squared error:

Properties:

  • Simple criterion
  • Direct variance
  • Fast computation
  • Basic measure

Best for:

  • Quick training
  • Simple problems
  • Baseline comparison

Minimum samples for split:

Effects:

  • Controls tree growth
  • Prevents overfitting
  • Ensures stability

Typical values:

  • 2-10: Detailed trees
  • 10-50: More stable

Minimum samples per leaf:

Impact:

  • Prediction stability
  • Smoothing effect
  • Overfitting control

Common settings:

  • 1-5: Fine detail
  • 5-20: Smoother predictions

Minimum weighted leaf fraction:

Purpose:

  • Weight-based control
  • Balanced trees
  • Handling importance

Range: [0.0, 0.5]

  • 0.0: No constraint
  • >0.0: Enforces balance

Maximum tree depth:

Control options:

  • 0: Unlimited growth
  • >0: Fixed depth limit

Guidelines:

  • Shallow (3-5): Fast, robust
  • Medium (5-8): Balanced
  • Deep (>8): Complex patterns

Note: Key parameter for boosting

A node will be split if this split induces a decrease of the impurity greater than or equal to this value.

Usage:

  • Pre-pruning method
  • Quality control
  • Prevents weak splits

Values:

  • 0.0: All splits allowed
  • >0.0: Quality threshold

Controls the random seed given to each Tree estimator at each boosting iteration. In addition, it controls the random permutation of the features at each split.

Affects:

  • Subsampling
  • Feature selection
  • Tree structure

Settings:

  • 0: System random
  • Fixed: Reproducible
  • Different: Variations
Auto

Feature subset selection:

Strategies:

  1. All features (Auto)
  2. Square root scaling
  3. Logarithmic scaling
  4. Custom selection

Effects:

  • Split randomization
  • Training speed
  • Model variance
  • Feature exploration
Auto ~

Use all features:

Properties:

  • Complete information
  • Thorough search
  • Slower splits
  • Full capacity

Best for:

  • Small feature sets
  • Important decisions
  • Maximum accuracy
Sqrt ~

Square root selection:

Formula:

Properties:

  • Balanced selection
  • Moderate sampling
  • Common choice

Best for:

  • Medium datasets
  • Standard problems
  • Good trade-off
Log2 ~

Logarithmic selection:

Formula:

Properties:

  • Aggressive reduction
  • Faster splitting
  • More randomization

Best for:

  • Many features
  • Quick training
  • High dimensions
Custom ~

User-defined selection:

Properties:

  • Manual control
  • Flexible sizing
  • Tunable option
  • Problem-specific

Best for:

  • Expert knowledge
  • Special cases
  • Fine-tuning

Custom feature count:

Usage:

  • With MaxFeatures=Custom
  • Must be ≤ total features

Selection:

  • Small: More randomization
  • Large: Better splits
  • Balance performance
0.9

The alpha-quantile of the huber loss function and the quantile loss function. Only if loss is huber or quantile.

Maximum leaf node count:

Control:

  • 0: Unlimited leaves
  • >0: Best-first growth

Benefits:

  • Memory control
  • Tree size limit
  • Quality-based growth

Alternative to max_depth

false

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.

When True:

  • Keep existing trees
  • Add more stages
  • Continue training

Applications:

  • Model updating
  • Iterative fitting
  • Parameter tuning

Early stopping validation size:

Usage:

  • Monitors convergence
  • Prevents overfitting
  • Automatic stopping

Typical values:

  • Small (0.1): More training
  • Large (0.2): Better validation

Early stopping patience:

Behavior:

  • 0: No early stopping
  • >0: Stop after n stagnant rounds

Settings:

  • Small (5-10): Aggressive
  • Large (10-20): Patient

Used with validation_fraction

Tol

f64
0.0001

Early stopping tolerance:

Criterion:

Values:

  • Strict (1e-4): Precise
  • Loose (1e-3): Faster

Used with n_iter_no_change

Complexity parameter used for Minimal Cost-Complexity Pruning. The subtree with the largest cost complexity that is smaller than ccp_alpha will be chosen.

Gradient Boosting hyperparameter optimization:

Key components:

  1. Learning parameters:

    • Loss functions
    • Learning rates
    • Number of trees
  2. Tree structure:

    • Depth/leaf limits
    • Node constraints
    • Split criteria
  3. Regularization:

    • Subsampling rates
    • Early stopping
    • Complexity control

Best practices:

  • Balance learning rate/trees
  • Consider interactions
  • Monitor convergence
  • Resource awareness

Loss

[enum, ...]
SquaredError

Loss function selection:

Mathematical forms:

  1. Squared Error:
  2. Absolute Error:
  3. Huber: Combines L1 and L2
  4. Quantile:

Impact:

  • Optimization behavior
  • Robustness properties
  • Prediction characteristics
  • Training dynamics
SquaredError ~

L2 loss function:

Properties:

  • Mean estimation
  • Larger penalties
  • Smooth gradients
  • Standard choice

Best for:

  • Normal noise
  • Clean data
  • General regression
AbsoluteError ~

L1 loss function:

Properties:

  • Median estimation
  • Constant gradients
  • Outlier robust
  • Linear penalties

Best for:

  • Noisy data
  • Outlier presence
  • Robust predictions
Huber ~

Huber loss function:

Properties:

  • Combined L1/L2
  • Adaptive behavior
  • Robust-smooth mix
  • Controlled transition

Best for:

  • Mixed noise
  • Unknown distribution
  • Balance robustness
Quantile ~

Quantile loss function:

Properties:

  • Quantile estimation
  • Asymmetric penalties
  • Distribution focused
  • Flexible modeling

Best for:

  • Specific quantiles
  • Risk assessment
  • Uncertainty bounds

LearningRate

[f64, ...]
0.1

Learning rate search:

Search spaces:

  1. Log scale:

    • [0.001, 0.01, 0.1]
    • Wide exploration
  2. Fine-tuning:

    • [0.05, 0.1, 0.15]
    • Around optimal

Note: Pair with n_estimators

NEstimators

[u32, ...]
100

Number of trees search:

Search ranges:

  1. Quick exploration:

    • [50, 100, 200]
    • Initial testing
  2. Production:

    • [200, 500, 1000]
    • Full performance
  3. Large scale:

    • [500, 1000, 2000]
    • High accuracy

Subsample

[f64, ...]
1

Subsample ratio search:

Patterns:

  1. Conservative:

    • [0.8, 0.9, 1.0]
    • Stable learning
  2. Aggressive:

    • [0.5, 0.7, 0.9]
    • More randomization
  3. Comprehensive:

    • [0.6, 0.8, 1.0]
    • Full range

Criterion

[enum, ...]
FriedmanMse

Split quality measures:

Options:

  1. Friedman MSE:

    • Enhanced measurement
    • Improvement scoring
    • Better splits
  2. Standard MSE:

    • Simple variance reduction
    • Direct measurement
    • Basic approach

Impact:

  • Tree structure
  • Split selection
  • Learning quality
FriedmanMse ~

Friedman's improvement score:

Properties:

  • Advanced criterion
  • Considers variance
  • Split potential
  • Default choice

Best for:

  • General use
  • Quality splits
  • Better trees
Mse ~

Standard mean squared error:

Properties:

  • Simple criterion
  • Direct variance
  • Fast computation
  • Basic measure

Best for:

  • Quick training
  • Simple problems
  • Baseline comparison

MinSamplesSplit

[u32, ...]
2

Split threshold search:

Search ranges:

  1. Fine grain:

    • [2, 5, 10]
    • Detailed splits
  2. Conservative:

    • [10, 20, 50]
    • Stable trees
  3. Mixed: [2, 10, 30]

    • Range comparison

MinSamplesLeaf

[u32, ...]
1

Leaf size search:

Patterns:

  1. Detailed:

    • [1, 3, 5]
    • Fine predictions
  2. Stable:

    • [5, 10, 20]
    • Robust leaves
  3. Study: [1, 5, 15]

    • Effect analysis

Weight constraint search:

Search spaces:

  1. No constraint: [0.0]

    • Default behavior
  2. Light balance:

    • [0.0, 0.1, 0.2]
    • Gentle weighting
  3. Strong balance:

    • [0.2, 0.3, 0.4]
    • Heavy constraints

MaxDepth

[u32, ...]
3

Tree depth search:

Ranges:

  1. Shallow trees:

    • [3, 4, 5]
    • Fast, robust
  2. Deep trees:

    • [6, 8, 10]
    • Complex patterns
  3. Full range:

    • [3, 6, 9]
    • Depth impact

Split quality threshold search:

Search patterns:

  1. All splits: [0.0]

    • No filtering
  2. Light pruning:

    • [0.0, 1e-4, 1e-3]
    • Gentle filtering
  3. Heavy pruning:

    • [1e-3, 1e-2, 1e-1]
    • Strong filtering

MaxFeatures

[enum, ...]
Auto

Feature subset selection:

Strategies:

  1. All features (Auto)
  2. Square root scaling
  3. Logarithmic scaling
  4. Custom selection

Effects:

  • Split randomization
  • Training speed
  • Model variance
  • Feature exploration
Auto ~

Use all features:

Properties:

  • Complete information
  • Thorough search
  • Slower splits
  • Full capacity

Best for:

  • Small feature sets
  • Important decisions
  • Maximum accuracy
Sqrt ~

Square root selection:

Formula:

Properties:

  • Balanced selection
  • Moderate sampling
  • Common choice

Best for:

  • Medium datasets
  • Standard problems
  • Good trade-off
Log2 ~

Logarithmic selection:

Formula:

Properties:

  • Aggressive reduction
  • Faster splitting
  • More randomization

Best for:

  • Many features
  • Quick training
  • High dimensions
Custom ~

User-defined selection:

Properties:

  • Manual control
  • Flexible sizing
  • Tunable option
  • Problem-specific

Best for:

  • Expert knowledge
  • Special cases
  • Fine-tuning

MaxFeaturesF

[u32, ...]
1

Custom feature count search:

Ranges:

  1. Small sets:

    • [2, 4, 6]
    • Fast splits
  2. Large sets:

    • [8, 12, 16]
    • More features

Note: Used with Custom max_features

Alpha

[f64, ...]
0.9

Quantile/Huber parameter search:

Search spaces:

  1. Quantile loss:

    • [0.1, 0.5, 0.9]
    • Different quantiles
  2. Huber loss:

    • [0.7, 0.9, 0.95]
    • Robustness levels

Note: Loss-specific parameter

MaxLeafNodes

[u32, ...]
0

Maximum leaves search:

Search patterns:

  1. Small trees:

    • [10, 20, 30]
    • Simple models
  2. Large trees:

    • [50, 100, 200]
    • Complex models
  3. Mixed:

    • [0, 31, 63]
    • Compare unlimited

WarmStart

[bool, ...]
false

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:

  1. Standard: [false]

    • Fresh training
    • Independent models
  2. Compare: [false, true]

    • Study reuse impact
    • Training efficiency

Early stopping validation size:

Guidelines:

  1. Small datasets:

    • 0.2 fraction
    • More validation
  2. Large datasets:

    • 0.1 fraction
    • More training

Note: Used with early stopping

Early stopping patience:

Settings:

  1. No early stop: 0

    • Full iterations
    • Complete training
  2. With early stop: >0

    • Monitors improvement
    • Prevents overfitting

Used with validation_fraction

Tol

f64
0.0001

Improvement tolerance:

Usage:

  • Stops if score gain < tol
  • Over n_iter_no_change rounds

Values:

  • Strict: 1e-4 (default)
  • Relaxed: 1e-3
  • Tight: 1e-5

CcpAlpha

[f64, ...]
0

Cost-complexity search:

Search spaces:

  1. No pruning: [0.0]

    • Full trees
    • Maximum detail
  2. Light pruning:

    • [0.001, 0.01, 0.1]
    • Gentle simplification
  3. Heavy pruning:

    • [0.1, 0.2, 0.3]
    • Strong simplification
R2score

Regression model evaluation metrics:

Purpose:

  • Model performance evaluation
  • Error measurement
  • Quality assessment
  • Model comparison

Selection criteria:

  • Error distribution
  • Scale sensitivity
  • Domain requirements
  • Business objectives
Default ~

Model's native scoring method:

  • Typically R² score
  • Model-specific implementation
  • Standard evaluation
  • Quick assessment
R2score ~

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
ExplainedVariance ~

Explained variance score:

Formula:

Properties:

  • Range: (-∞, 1]
  • Accounts for bias
  • Variance focus
  • Similar to R²

Best for:

  • Variance analysis
  • Bias assessment
  • Model stability
MaxError ~

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
NegMeanAbsoluteError ~

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
NegMeanSquaredError ~

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
NegRootMeanSquaredError ~

Negative root mean squared error:

Formula:

Properties:

  • Original scale
  • Outlier sensitive
  • Interpretable units
  • Negated for optimization

Best for:

  • Standard reporting
  • Interpretable errors
  • Model comparison
NegMeanSquaredLogError ~

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
NegMedianAbsoluteError ~

Negative median absolute error:

Formula:

Properties:

  • Highly robust
  • Original scale
  • Outlier resistant
  • Negated for optimization

Best for:

  • Robust evaluation
  • Heavy-tailed errors
  • Outlier presence
NegMeanPoissonDeviance ~

Negative Poisson deviance:

Formula:

Properties:

  • For count data
  • Non-negative values
  • Poisson assumption
  • Negated for optimization

Best for:

  • Count prediction
  • Event frequency
  • Rate modeling
NegMeanGammaDeviance ~

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
NegMeanAbsolutePercentageError ~

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
D2AbsoluteErrorScore ~

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²
D2PinballScore ~

D² score with pinball loss:

Properties:

  • Quantile focus
  • Asymmetric errors
  • Risk assessment
  • Distribution modeling

Best for:

  • Quantile regression
  • Risk analysis
  • Asymmetric costs
  • Distribution tails
D2TweedieScore ~

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

oneof
DefaultSplit

Standard 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

Random seed for reproducible splits. Ensures:

  • Consistent train/test sets
  • Reproducible experiments
  • Comparable model evaluations

Same seed guarantees identical splits across runs.

true

Data 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
0.8

Proportion 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
false

Maintain 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

oneof
DefaultCv

Standard 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
3

Number 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

Number 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.

Random 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.

true

Whether 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

Number 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

Seed for reproducible stratified splits. Ensures:

  • Consistent fold assignments
  • Reproducible results
  • Comparable experiments
  • Systematic validation

Fixed seed guarantees identical stratified splits.

false

Data 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

Number 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.

Random seed for reproducible shuffling. Controls:

  • Split randomization
  • Sample selection
  • Result reproducibility

Important for:

  • Debugging
  • Comparative studies
  • Result verification
0.2

Proportion 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

Number 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

Seed for reproducible stratified sampling. Ensures:

  • Consistent class proportions
  • Reproducible splits
  • Comparable experiments

Critical for:

  • Benchmarking
  • Research studies
  • Quality assurance
0.2

Fraction 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 + 1th 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.

Number 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

Maximum 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

Number 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

u64
0

Number 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