Я работаю над проблемой классификации и использую метод Гришерча для нахождения оптимальных гиперпараметров.Однако я использую архитектуру конвейера для построения той же модели классификации, изменяя только классификатор.Ошибка для xgboost - строка для параметров.Есть ли у вас какие-либо советы?
elif method == "XGBoost":
#classifier = Boosting
classifier = XGBClassifier(random_state = 0, n_jobs = 4)
parameters = {"xgb__max_depth":[3,4,5,6,7,9],
"xgb__gamma":[0, 0.1, 0.2],
"xgb__colsample_bytree":[0.5,0.6,0.7,0.8,0.9],
"xgb__n_estimators": [10, 50, 100, 500],
"xgb__learning_rate": [0.1, 0.5, 1],
'xgb__min_child_weight': [1, 3, 4, 5, 6]
}
print("Start PIPELINE !!!")
# Add one transformers and two samplers in the pipeline object
pipeline = make_pipeline(renn, smote_enn, classifier)
#pipeline = make_pipeline(knn)
print()
print(" Starting Grid Search, with this method: " + method)
print()
#If it is not clear review the link from Stack
#https://stackoverflow.com/questions/48370150/how-to-implement-smote-in-cross-validation-and-gridsearchcv
scorers = {
'precision_score': make_scorer(precision_score, pos_label="1"),
'recall_score': make_scorer(recall_score, pos_label="1"),
'accuracy_score': make_scorer(accuracy_score),
'f1_scorer': make_scorer(f1_score, pos_label="1")
}
random_search = GridSearchCV(pipeline, param_grid = parameters ,
cv = kf, scoring = scorers, refit = 'recall_score')
gg = random_search.fit(X, y)
Однако я получил эту ошибку:
ValueError: Invalid parameter xgb for estimator Pipeline(memory=None,
steps=[('repeatededitednearestneighbours', RepeatedEditedNearestNeighbours(kind_sel='all', max_iter=100, n_jobs=2,
n_neighbors=5, random_state=0, ratio=None,
return_indices=False, sampling_strategy='auto')), ('smoteenn', SMOTEENN(enn=None, random_state=0, ratio=None, ...
reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=None,
silent=True, subsample=1))]). Check the list of available parameters with `estimator.get_params().keys()`.