Closed
Description
In the following code:
from sklearn import datasets, linear_model
from sklearn.model_selection import cross_validate
from sklearn.metrics.scorer import make_scorer
from sklearn.metrics import confusion_matrix
from sklearn.svm import LinearSVC
import numpy as np
digits = datasets.load_digits()
X = digits.data[:500]
y = digits.target[:500]
counts, unique = np.unique(y, return_counts=True)
g1 = np.repeat(0, int(len(y)/2))
g2 = np.repeat(1, int(len(y)/2))
g = np.concatenate((g1, g2))
linear = LinearSVC()
cv_results = cross_validate(linear, X, y, cv=5)
sorted(cv_results.keys())
print(cv_results)
print('cv_results')
print(cv_results['test_score'])
print('cross-validate')
scores = cross_validate(linear, X, y, cv=5,
scoring=('f1_weighted'),
return_train_score=True, groups=g)
print(scores)
Shouldn't it be returned that:
groups should be equal to CV for the folds?