Я пытаюсь оценить производительность моего дерева решений AdaBoosted по случайной случайности.
dcf = AdaBoostClassifier(DecisionTreeClassifier(max_depth=2,
max_features="auto", min_samples_split=3,
min_samples_leaf=14),
algorithm="SAMME",random_state=123)
clf = GridSearchCV(dcf, param_grid, scoring='accuracy', cv=5)
clf.fit(train_dat, train_labels)
Однако, когда я хочу добавить тест перестановки:
score, permutation_scores, pvalue = permutation_test_score(
clf.best_estimator_, test_dat,test_labels, scoring="accuracy", cv=5, n_permutations=600, n_jobs=1)
myошибка:
Traceback (most recent call last):
File "adaboost-test.py", line 99, in <module>
clf.best_estimator_, test_dat,test_labels, scoring="accuracy", cv=5, n_permutations=600, n_jobs=1)
File "/usr/local/lib/python3.5/dist-packages/sklearn/model_selection/_validation.py", line 1092, in permutation_test_score
score = _permutation_test_score(clone(estimator), X, y, groups, cv, scorer)
File "/usr/local/lib/python3.5/dist-packages/sklearn/model_selection/_validation.py", line 1109, in _permutation_test_score
estimator.fit(X_train, y_train)
File "/usr/local/lib/python3.5/dist-packages/sklearn/ensemble/weight_boosting.py", line 427, in fit
return super().fit(X, y, sample_weight)
File "/usr/local/lib/python3.5/dist-packages/sklearn/ensemble/weight_boosting.py", line 150, in fit
random_state)
File "/usr/local/lib/python3.5/dist-packages/sklearn/ensemble/weight_boosting.py", line 490, in _boost
random_state)
File "/usr/local/lib/python3.5/dist-packages/sklearn/ensemble/weight_boosting.py", line 579, in _boost_discrete
raise ValueError('BaseClassifier in AdaBoostClassifier '
ValueError: BaseClassifier in AdaBoostClassifier ensemble is worse than random, ensemble can not be fit.