RandomForest / Classifier Layer

Random Forest Classification: An ensemble learning method using decision trees. It is a meta estimator that fits a number of decision tree classifiers on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting. Trees in the forest use the best split strategy.

Mathematical formulation: where:

  • is the number of trees
  • is the prediction of the b-th tree
  • is the input feature vector

Key characteristics:

  • Parallel tree construction
  • Bootstrap aggregation (bagging)
  • Random feature selection
  • Ensemble prediction averaging
  • Out-of-bag error estimation

Advantages:

  • Robust to overfitting
  • Handles high-dimensional data
  • Provides feature importance
  • Parallelizable training
  • No feature scaling needed

Common applications:

  • Credit risk assessment
  • Medical diagnosis
  • Customer churn prediction
  • Image classification
  • Fraud detection

Outputs:

  1. Predicted Table: Input data with predictions
  2. Validation Results: Cross-validation metrics
  3. Test Metric: Hold-out set performance
  4. ROC Curve Data: Classification quality analysis
  5. Confusion Matrix: Detailed class predictions
  6. Feature Importances: Variable contribution scores
Table
0
0
Predicted Table
1
Validation Results
2
Test Metric
3
ROC Curve Data
4
Confusion Matrix
5
Feature Importances

SelectFeatures

[column, ...]

Feature column selection for Random Forest Classification:

Data requirements:

  1. Supported types:

    • Numeric (int, float)
    • Categorical (encoded)
    • Boolean features
    • Binary indicators
  2. Data quality considerations:

    • Missing values allowed (handled internally)
    • No scaling needed
    • Outliers handled naturally
    • Automated feature binning
  3. Feature engineering tips:

    • Interaction terms can help
    • Date/time decomposition
    • Domain-specific aggregations
    • Meaningful transformations
  4. Best practices:

    • Remove constant features
    • Check feature cardinality
    • Consider correlation groups
    • Monitor importance scores
  5. Performance impact:

    • Memory scales with features
    • Training time affected by count
    • Tree depth implications
    • Storage requirements

Note: If empty, automatically uses all suitable numeric columns except target

Target column specification for classification:

Requirements:

  1. Data characteristics:

    • Categorical labels
    • Unique class values
    • No missing values
    • Consistent encoding
  2. Class properties:

    • Two or more classes
    • Meaningful categories
    • Clear distinctions
    • Known label mapping
  3. Distribution considerations:

    • Class balance/imbalance
    • Rare class frequency
    • Sample sufficiency
    • Stratification needs
  4. Quality checks:

    • Label consistency
    • Error costs
    • Business relevance
    • Domain validity
  5. Modeling implications:

    • Class weight needs
    • Evaluation metrics
    • Validation strategy
    • Performance goals

Note: Must be a single column containing class labels

Params

oneof
DefaultParams

Optimized default configuration for Random Forest Classification:

Core settings:

  1. Ensemble structure:

    • Trees: 100 estimators
    • Criterion: Gini impurity
    • Bootstrap: True (with replacement)
  2. Tree parameters:

    • Max depth: Unlimited
    • Min samples split: 2
    • Min samples leaf: 1
    • Max features: sqrt(n_features)
  3. Regularization:

    • Min weight fraction leaf: 0.0
    • Min impurity decrease: 0.0
    • CCP alpha: 0.0
  4. Sampling controls:

    • Max samples: Auto (63.2%)
    • Class weights: None
    • OOB score: Disabled

Best suited for:

  • Initial modeling
  • Medium-sized datasets
  • Balanced classes
  • General classification tasks

Customizable parameters for Random Forest Classification:

Parameter categories:

  1. Ensemble configuration

    • Number of trees
    • Feature selection
    • Splitting criteria
  2. Tree construction

    • Growth limits
    • Node constraints
    • Split thresholds
  3. Sampling controls

    • Bootstrap options
    • Class balancing
    • Sample weights
  4. Regularization

    • Complexity control
    • Pruning parameters
    • Minimum improvements

Trade-offs:

  • Accuracy vs speed
  • Memory vs performance
  • Generalization vs fit

Number of trees in the forest:

Impact:

  • Model complexity
  • Prediction stability
  • Training time
  • Memory usage

Trade-offs:

  • More trees: Better stability, higher resource use
  • Fewer trees: Faster training, potential instability

Guidelines:

  • Small datasets: 50-200 trees
  • Medium datasets: 100-500 trees
  • Large datasets: 200-1000+ trees

Note: Returns diminish with more trees

Gini

Split quality measurement methods for Random Forest trees:

Purpose:

  • Determines optimal split points
  • Measures node impurity
  • Guides tree construction
  • Affects model performance

Selection impact:

  • Training speed
  • Tree structure
  • Memory usage
  • Prediction quality
Gini ~

Gini impurity measurement:

Mathematical form: where is the proportion of class i at the node

Properties:

  • Range: [0, 1-1/C]
  • 0: Pure node
  • Maximum: Equal class distribution
  • Computationally efficient

Advantages:

  • Faster computation than entropy
  • More robust to noise
  • Better numerical stability
  • Default choice for most cases

Best for:

  • Large datasets
  • Real-time applications
  • General classification tasks
  • Production environments
Entropy ~

Information entropy criterion:

Mathematical form: where is the proportion of class i at the node

Properties:

  • Range: [0, log2(C)]
  • 0: Pure node
  • Maximum: Equal distribution
  • Information theory based

Advantages:

  • More sensitive to differences
  • Theoretically grounded
  • Better for multi-class
  • Finer probability distinctions

Best for:

  • Multi-class problems
  • Complex relationships
  • When computation time isn't critical
  • Research applications
Logloss ~

Log loss (Cross-entropy) criterion:

Mathematical form: where is true label and is predicted probability

Properties:

  • Probabilistic interpretation
  • Sensitive to prediction confidence
  • Heavily penalizes confident mistakes
  • Natural for probability estimation

Advantages:

  • Better probability calibration
  • Suitable for probabilistic predictions
  • Good for risk assessment
  • Robust likelihood estimation

Best for:

  • Probability estimation needs
  • Risk-sensitive applications
  • When confidence is crucial
  • Cost-sensitive problems

Maximum tree depth limit:

Effects:

  • Controls tree complexity
  • Manages overfitting
  • Impacts memory usage
  • Affects training speed

Guidelines:

  • Shallow (5-10): Simple problems
  • Medium (10-20): Standard datasets
  • Deep (20+): Complex relationships
  • 0: Unlimited depth

Trade-offs:

  • Deeper: Better fit, higher complexity
  • Shallower: Better generalization, simpler model

Minimum samples for node splitting:

Purpose:

  • Controls node creation
  • Prevents overfitting
  • Ensures statistical validity

Typical values:

  • Minimum: 2 samples
  • Conservative: 5-10 samples
  • Aggressive: 20+ samples

Impact:

  • Higher values: More stability, less detail
  • Lower values: More detail, potential overfitting

Minimum samples in leaf nodes:

Function:

  • Ensures prediction stability
  • Controls leaf size
  • Prevents single-sample leaves

Setting guide:

  • Small datasets: 1-5 samples
  • Medium datasets: 5-10 samples
  • Large datasets: 10+ samples

Considerations:

  • Noise level in data
  • Sample size
  • Prediction stability needs

Minimum weighted fraction at leaf nodes:

Definition:

  • Fraction of total weights required at leaf
  • Range: [0.0, 0.5]

Use cases:

  • Weighted samples
  • Class imbalance
  • Cost-sensitive learning

Typical values:

  • 0.0: No constraint
  • 0.01-0.1: Moderate constraint
  • >0.1: Strong constraint

Feature subset selection strategies for split optimization:

Purpose:

  • Control feature randomization
  • Reduce correlation between trees
  • Balance computation and accuracy
  • Manage feature space exploration

Impact:

  • Tree diversity
  • Training speed
  • Model robustness
  • Memory usage

Selection considerations:

  • Dataset dimensionality
  • Computational resources
  • Feature relevance distribution
  • Model performance requirements
All ~

Use all available features:

Mathematical form: where p is total number of features

Characteristics:

  • Maximum information usage
  • Traditional decision tree style
  • No feature randomization
  • Complete split search

Advantages:

  • Best single tree performance
  • No information loss
  • Deterministic splits
  • Easier interpretation

Best for:

  • Few features (<10)
  • When all features matter
  • Interpretability needs
  • Small datasets
Sqrt ~

Square root of total features:

Mathematical form: where p is total number of features

Characteristics:

  • Classic random forest default
  • Balanced randomization
  • Moderate feature subset
  • Proven effectiveness

Advantages:

  • Good default choice
  • Reduced correlation
  • Faster training
  • Empirically validated

Best for:

  • General applications
  • Medium feature count
  • Initial modeling
  • Production systems
Log2 ~

Logarithm base-2 of total features:

Mathematical form: where p is total number of features

Characteristics:

  • More aggressive reduction
  • Stronger randomization
  • Smallest feature subset
  • Maximum tree diversity

Advantages:

  • Fastest training
  • Lowest correlation
  • Memory efficient
  • Good for high dimensions

Best for:

  • High-dimensional data
  • Limited compute resources
  • When speed matters
  • Feature-rich problems
Custom ~

User-specified feature count taken from MaxFeaturesF:

Mathematical form: where k is user-defined value

Characteristics:

  • Flexible control
  • Manual optimization
  • Precise tuning
  • Problem-specific adaptation

Advantages:

  • Full user control
  • Domain knowledge integration
  • Performance optimization
  • Experimental freedom

Best for:

  • Expert users
  • Research settings
  • Specific requirements
  • Parameter tuning

Custom value of max features. Only used when MaxFeatures enum is Custom.

Maximum leaf nodes per tree:

Purpose:

  • Controls tree size
  • Alternative to depth control
  • Manages model complexity

Settings:

  • 0: Unlimited leaves
  • Small (10-50): Simple trees
  • Medium (50-200): Balanced complexity
  • Large (200+): Complex patterns

Impact:

  • Memory usage
  • Training speed
  • Model capacity

Minimum impurity decrease for splitting:

Mathematical form:

Function:

  • Controls split quality
  • Prevents weak splits
  • Optimization threshold

Typical values:

  • 0.0: No constraint
  • 1e-7 to 1e-4: Weak pruning
  • >1e-3: Strong pruning
true

Whether bootstrap samples are used when building trees. If False, the whole dataset is used to build each tree.

Purpose:

  • Creates diverse training sets
  • Enables out-of-bag estimation
  • Reduces tree correlation

Effects when enabled:

  • Random sampling with replacement
  • ~63.2% unique samples per tree
  • Independent tree training

Use cases:

  • Standard random forest (True)
  • Pasting ensemble (False)
  • When exact sample control needed
false

Whether to use out-of-bag samples to estimate the generalization score.

Functionality:

  • Uses unselected bootstrap samples
  • Provides unbiased error estimate
  • No separate validation set needed

Requirements:

  • Bootstrap must be True
  • Sufficient samples
  • Additional computation time

Benefits:

  • Free validation
  • Honest error estimates
  • Model monitoring

Controls both the randomness of the bootstrapping of the samples used when building trees (if bootstrap=True) and the sampling of the features to consider when looking for the best split at each node (if max_features < n_features).

Importance:

  • Result reproducibility
  • Debugging
  • Experimental control
  • Model comparison
true

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

Functionality:

  • Reuses existing trees
  • Adds more estimators
  • Preserves previous training

Use cases:

  • Online learning
  • Incremental training
  • Model updating
  • Parameter tuning

Note: Affects convergence behavior

None

Class importance weighting strategies:

Purpose:

  • Balance class influence
  • Control prediction bias
  • Adjust error penalties
  • Optimize business metrics

Mathematical impact:

  • Modifies sample importance
  • Affects tree construction
  • Influences split selection
  • Adjusts final predictions

Use cases:

  • Imbalanced datasets
  • Cost-sensitive learning
  • Rare event detection
  • Business-driven optimization
None ~

Uniform class weighting:

Mathematical form:

Characteristics:

  • Equal class treatment
  • Native data distribution
  • No bias adjustment
  • Raw frequency learning

Advantages:

  • Simple interpretation
  • No hyperparameter needs
  • Faster computation
  • Natural probabilities

Best for:

  • Balanced datasets
  • Equal error costs
  • Large class overlap
  • When natural distribution matters
Balanced ~

Inverse frequency weighting:

Mathematical form: where is the frequency of class i

Characteristics:

  • Automatic weight calculation
  • Inverse frequency scaling
  • Equal class influence
  • Bias correction

Advantages:

  • Handles imbalanced data
  • Improves minority class detection
  • Automatic adjustment
  • Better F1 scores

Best for:

  • Imbalanced classes
  • Rare event detection
  • When recall matters
  • Fraud/anomaly detection

Cost-Complexity Pruning alpha:

Mathematical basis: where:

  • R(T) is tree error
  • |T| is tree size
  • α controls pruning strength

Effect:

  • Post-training pruning
  • Complexity reduction
  • Overfitting control

Values:

  • 0.0: No pruning
  • >0.0: Increasing pruning strength

If bootstrap is True, the fraction of samples to draw from X to train each base estimator.

Settings:

  • 0.0: Use all samples
  • (0.0, 1.0): Fraction of samples

Impact:

  • Tree diversity
  • Training speed
  • Memory usage
  • Model robustness

Guidelines:

  • Small (0.1-0.4): High diversity
  • Medium (0.4-0.7): Balanced
  • Large (0.7-1.0): More stability

Hyperparameter optimization for Random Forest Classification:

Search space organization:

  1. Ensemble parameters:

    • Number of trees
    • Feature selection
    • Tree diversity controls
  2. Tree construction:

    • Split criteria
    • Growth limits
    • Node constraints
  3. Regularization:

    • Complexity controls
    • Pruning parameters
    • Minimum thresholds
  4. Sampling strategies:

    • Bootstrap options
    • Sample sizes
    • Class balancing

Computational impact:

  • Time: O(n_params * n_trees * n_samples * log(n_samples))
  • Memory: O(n_params * n_trees * max_depth)
  • Storage: O(n_params * n_trees)

NEstimators

[u32, ...]
100

Number of trees search space:

Search strategies:

  1. Linear scale:

    • Basic: [50, 100, 200]
    • Extended: [100, 300, 500, 1000]
  2. Log scale:

    • [50, 100, 200, 400, 800]

Resource impact:

  • Training time: O(n_trees)
  • Memory: O(n_trees)
  • Prediction time: O(n_trees)

Selection guide:

  • Start with smaller values
  • Monitor performance gains
  • Consider resource constraints

Criterion

[enum, ...]
Gini

Split quality measurement methods for Random Forest trees:

Purpose:

  • Determines optimal split points
  • Measures node impurity
  • Guides tree construction
  • Affects model performance

Selection impact:

  • Training speed
  • Tree structure
  • Memory usage
  • Prediction quality
Gini ~

Gini impurity measurement:

Mathematical form: where is the proportion of class i at the node

Properties:

  • Range: [0, 1-1/C]
  • 0: Pure node
  • Maximum: Equal class distribution
  • Computationally efficient

Advantages:

  • Faster computation than entropy
  • More robust to noise
  • Better numerical stability
  • Default choice for most cases

Best for:

  • Large datasets
  • Real-time applications
  • General classification tasks
  • Production environments
Entropy ~

Information entropy criterion:

Mathematical form: where is the proportion of class i at the node

Properties:

  • Range: [0, log2(C)]
  • 0: Pure node
  • Maximum: Equal distribution
  • Information theory based

Advantages:

  • More sensitive to differences
  • Theoretically grounded
  • Better for multi-class
  • Finer probability distinctions

Best for:

  • Multi-class problems
  • Complex relationships
  • When computation time isn't critical
  • Research applications
Logloss ~

Log loss (Cross-entropy) criterion:

Mathematical form: where is true label and is predicted probability

Properties:

  • Probabilistic interpretation
  • Sensitive to prediction confidence
  • Heavily penalizes confident mistakes
  • Natural for probability estimation

Advantages:

  • Better probability calibration
  • Suitable for probabilistic predictions
  • Good for risk assessment
  • Robust likelihood estimation

Best for:

  • Probability estimation needs
  • Risk-sensitive applications
  • When confidence is crucial
  • Cost-sensitive problems

MaxDepth

[u32, ...]
0

Tree depth limits to evaluate:

Search ranges:

  1. Fixed steps:

    • Basic: [5, 10, 15, 20]
    • Extended: [5, 10, 15, 20, None]
  2. Log scale:

    • [4, 8, 16, 32, None]

Memory impact:

  • Space: O(2^depth) per tree
  • Training: O(depth * n_samples)

Best practices:

  • Start shallow
  • Include None for comparison
  • Monitor memory usage

MinSamplesSplit

[u32, ...]
2

Minimum split samples search space:

Search patterns:

  1. Small datasets:

    • [2, 5, 10, 20] samples
  2. Large datasets:

    • [10, 30, 50, 100] samples
  3. Percentage based:

    • [0.1%, 0.5%, 1%, 5%] of total

Impact analysis:

  • Tree size
  • Training speed
  • Model complexity
  • Overfitting control

MinSamplesLeaf

[u32, ...]
1

Minimum leaf samples search space:

Search strategies:

  1. Absolute counts:

    • Conservative: [1, 3, 5, 10]
    • Aggressive: [10, 30, 50, 100]
  2. Dataset scaled:

    • Small: [1, 2, 4, 8]
    • Large: [50, 100, 200, 500]

Selection factors:

  • Dataset size
  • Noise level
  • Prediction stability needs
  • Memory constraints

Minimum weighted leaf fraction search:

Search ranges:

  1. Fine-grained:

    • [0.0, 0.01, 0.05, 0.1]
  2. Coarse-grained:

    • [0.0, 0.1, 0.2, 0.3]

Use cases:

  • Weighted samples
  • Imbalanced classes
  • Cost-sensitive learning

Impact:

  • Tree structure
  • Prediction balance
  • Model complexity

MaxFeatures

[enum, ...]
All

Feature subset selection strategies for split optimization:

Purpose:

  • Control feature randomization
  • Reduce correlation between trees
  • Balance computation and accuracy
  • Manage feature space exploration

Impact:

  • Tree diversity
  • Training speed
  • Model robustness
  • Memory usage

Selection considerations:

  • Dataset dimensionality
  • Computational resources
  • Feature relevance distribution
  • Model performance requirements
All ~

Use all available features:

Mathematical form: where p is total number of features

Characteristics:

  • Maximum information usage
  • Traditional decision tree style
  • No feature randomization
  • Complete split search

Advantages:

  • Best single tree performance
  • No information loss
  • Deterministic splits
  • Easier interpretation

Best for:

  • Few features (<10)
  • When all features matter
  • Interpretability needs
  • Small datasets
Sqrt ~

Square root of total features:

Mathematical form: where p is total number of features

Characteristics:

  • Classic random forest default
  • Balanced randomization
  • Moderate feature subset
  • Proven effectiveness

Advantages:

  • Good default choice
  • Reduced correlation
  • Faster training
  • Empirically validated

Best for:

  • General applications
  • Medium feature count
  • Initial modeling
  • Production systems
Log2 ~

Logarithm base-2 of total features:

Mathematical form: where p is total number of features

Characteristics:

  • More aggressive reduction
  • Stronger randomization
  • Smallest feature subset
  • Maximum tree diversity

Advantages:

  • Fastest training
  • Lowest correlation
  • Memory efficient
  • Good for high dimensions

Best for:

  • High-dimensional data
  • Limited compute resources
  • When speed matters
  • Feature-rich problems
Custom ~

User-specified feature count taken from MaxFeaturesF:

Mathematical form: where k is user-defined value

Characteristics:

  • Flexible control
  • Manual optimization
  • Precise tuning
  • Problem-specific adaptation

Advantages:

  • Full user control
  • Domain knowledge integration
  • Performance optimization
  • Experimental freedom

Best for:

  • Expert users
  • Research settings
  • Specific requirements
  • Parameter tuning

MaxFeaturesF

[u32, ...]
1

MaxLeafNodes

[u32, ...]
0

Maximum leaves search space:

Search patterns:

  1. Powers of 2:

    • [16, 32, 64, 128]
  2. Linear scale:

    • [10, 50, 100, 200]

Considerations:

  • Tree complexity
  • Memory usage
  • Training speed
  • Model capacity

Impurity threshold search space:

Search ranges:

  1. Log scale (recommended):

    • [0.0, 1e-5, 1e-4, 1e-3]
  2. Linear scale:

    • [0.0, 0.01, 0.05, 0.1]

Impact evaluation:

  • Split quality
  • Tree size
  • Training speed
  • Model complexity

Bootstrap

[bool, ...]
true

Bootstrap strategy evaluation:

Options to compare:

  • [true]: Standard random forest
  • [false]: Random patches
  • [true, false]: Full comparison

Impact assessment:

  • Sample diversity
  • Tree correlation
  • OOB estimation
  • Model robustness

OobScore

[bool, ...]
false

Out-of-bag scoring options:

Search choices:

  • [false]: No OOB estimation
  • [true]: Enable OOB scores
  • [true, false]: Compare impact

Evaluation criteria:

  • Validation needs
  • Computation time
  • Memory usage
  • Error estimation

WarmStart

[bool, ...]
true

Incremental fitting evaluation:

Search options:

  • [false]: Independent fits
  • [true]: Incremental building
  • [true, false]: Compare approaches

Assessment factors:

  • Training efficiency
  • Memory usage
  • Model evolution
  • Convergence behavior

ClassWeight

[enum, ...]
None

Class importance weighting strategies:

Purpose:

  • Balance class influence
  • Control prediction bias
  • Adjust error penalties
  • Optimize business metrics

Mathematical impact:

  • Modifies sample importance
  • Affects tree construction
  • Influences split selection
  • Adjusts final predictions

Use cases:

  • Imbalanced datasets
  • Cost-sensitive learning
  • Rare event detection
  • Business-driven optimization
None ~

Uniform class weighting:

Mathematical form:

Characteristics:

  • Equal class treatment
  • Native data distribution
  • No bias adjustment
  • Raw frequency learning

Advantages:

  • Simple interpretation
  • No hyperparameter needs
  • Faster computation
  • Natural probabilities

Best for:

  • Balanced datasets
  • Equal error costs
  • Large class overlap
  • When natural distribution matters
Balanced ~

Inverse frequency weighting:

Mathematical form: where is the frequency of class i

Characteristics:

  • Automatic weight calculation
  • Inverse frequency scaling
  • Equal class influence
  • Bias correction

Advantages:

  • Handles imbalanced data
  • Improves minority class detection
  • Automatic adjustment
  • Better F1 scores

Best for:

  • Imbalanced classes
  • Rare event detection
  • When recall matters
  • Fraud/anomaly detection

CcpAlpha

[f64, ...]
0

Cost-complexity pruning search:

Search spaces:

  1. Fine-grained:

    • [0.0, 0.001, 0.01, 0.1]
  2. Coarse-grained:

    • [0.0, 0.1, 0.5, 1.0]

Impact analysis:

  • Tree complexity
  • Model size
  • Generalization
  • Prediction speed

MaxSamples

[f64, ...]
0

Sample size ratio search:

Search ranges:

  1. Conservative:

    • [0.5, 0.7, 0.9]
  2. Exploratory:

    • [0.1, 0.3, 0.5, 0.7, 0.9]

Evaluation criteria:

  • Tree diversity
  • Training speed
  • Memory usage
  • Model stability

Random seed configuration:

Purpose:

  • Reproducible experiments
  • Consistent comparisons
  • Debug capabilities
  • Result validation

Best practices:

  • Fix seed during development
  • Use different seeds for validation
  • Document chosen values
Accuracy

Performance evaluation metrics for classification:

Purpose:

  • Model evaluation
  • Ensemble selection
  • Early stopping
  • Performance tracking

Selection criteria:

  • Problem objectives
  • Class distribution
  • Ensemble size
  • Computation resources
Default ~

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

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

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

Logarithmic loss (Cross-entropy):

Formula:

Properties:

  • Range: [0, ∞)
  • Probability-sensitive
  • Boosting-optimal
  • Confidence-aware

Best for:

  • Probability estimation
  • Boosting optimization
  • Risk assessment
  • Model calibration
RocAuc ~

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

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