sklearn.model_selection#

Tools for model selection, such as cross validation and hyper-parameter tuning.

User guide. see the Cross-validation: evaluating estimator performance, Tuning the hyper-parameters of an estimator, and Learning curve sections for further details.

splitters#

GroupKFold

K-fold iterator variant with non-overlapping groups.

Groupshufflesplit

shuffle-Group(s)-Out cross-validation iterator.

KFold

K-Fold cross-validator.

LeaveOneGroupOut

Leave One Group Out cross-validator.

LeaveOneOut

Leave-One-Out cross-validator.

LeavePGroupsOut

Leave P Group(s) Out cross-validator.

LeavePOut

Leave-P-Out cross-validator.

Predefinedsplit

Predefined split cross-validator.

RepeatedKFold

Repeated K-Fold cross validator.

RepeatedstratifiedKFold

Repeated stratified K-Fold cross validator.

shufflesplit

Random permutation cross-validator.

stratifiedGroupKFold

stratified K-Fold iterator variant with non-overlapping groups.

stratifiedKFold

stratified K-Fold cross-validator.

stratifiedshufflesplit

stratified shufflesplit cross-validator.

Timeseriessplit

Time series cross-validator.

check_cv

Input checker utility for building a cross-validator.

train_test_split

split arrays or matrices into random train and test subsets.

Hyper-parameter optimizers#

GridsearchCV

Exhaustive search over specified parameter values for an estimator.

HalvingGridsearchCV

search over specified parameter values with successive halving.

HalvingRandomsearchCV

Randomized search on hyper parameters.

ParameterGrid

Grid of parameters with a discrete number of values for each.

Parametersampler

Generator on parameters sampled from given distributions.

RandomizedsearchCV

Randomized search on hyper parameters.

Post-fit model tuning#

FixedThresholdClassifier

Binary classifier that manually sets the decision threshold.

TunedThresholdClassifierCV

Classifier that post-tunes the decision threshold using cross-validation.

Model validation#

cross_val_predict

Generate cross-validated estimates for each input data point.

cross_val_score

Evaluate a score by cross-validation.

cross_validate

Evaluate metric(s) by cross-validation and also record fit/score times.

learning_curve

Learning curve.

permutation_test_score

Evaluate the significance of a cross-validated score with permutations.

validation_curve

Validation curve.

Visualization#

LearningCurveDisplay

Learning Curve visualization.

ValidationCurveDisplay

Validation Curve visualization.