sklearn.model_selection.cross_val_score
from sklearn.model_selection import cross_val_score cv_scores = cross_val_score(clf, X, y, cv=5)
Where:
clf: The estimator/model object to evaluate.X: The input data (features) to fit.y: The target variable/labels.cv: The number of folds for cross-validation (defaults to 5).
The function returns an array of scores (such as accuracy) for each of the folds. The average performance of the model can be calculated using cv_scores.mean().
0
3
Contributors are:
Who are from:
Tags
Helpful Scikit-Learn functions
Data Science
Related
sklearn.preprocessing.OneHotEncoder
sklearn.neighbors.KNeighborsClassifier
sklearn.dummy.DummyClassifier
sklearn.preprocessing.LabelEncoder
Train Test Split Function
sklearn.datasets.make_regression
sklearn.datasets.make_friedman1
sklearn.datasets.make_classification
sklearn.svm.SVC
sklearn.tree.DecisionTreeClassifier
sklearn.ensemble.RandomForestClassifier
sklearn.dummy.DummyRegressor
sklearn.model_selection.GridSearchCV
sklearn.ensemble.RandomForestRegressor
sklearn.model_selection.cross_val_score
K-Fold Cross-Validation vs. Leave-One-Out Cross-Validation
in K-Fold Cross-Validation
Multiple Testing Resilience in K-Fold Cross-Validation
Identifying Overfitting via Cross-Validation
K-Fold Cross-Validation Bias-Variance Tradeoff
sklearn.model_selection.cross_val_score