1# SVC: support vector classifier (one of the "built-in" classifiers in scikit-learn)
2# X, y: array-like representing input and target variables
3# X.shape = (N, num_of_features)
4# y.shape = (N, 1) in case of classification problem
5
6from sklearn.model_selection import cross_val_score
7clf = svm.SVC(kernel='linear', C=1, random_state=42)
8scores = cross_val_score(clf, X, y, cv=5) # 5-fold cross validation
1from sklearn.model_selection import cross_validate
1from sklearn.model_selection import train_test_split
1Cross-validation is a resampling procedure used to evaluate machine learning models on a limited data sample. The procedure has a single parameter called k that refers to the number of groups that a given data sample is to be split into. As such, the procedure is often called k-fold cross-validation.