RandomSearchCV используется для выбора лучших гиперпараметров.
Я хотел бы проверить лучший оценщик на своем тестовом наборе.
Код: Выделить всё
cv = RepeatedStratifiedKFold(n_splits=5, n_repeats=10, random_state=42)
scaler = RobustScaler(quantile_range=(25.0, 75.0))
smote = SMOTENC(categorical_features=categorical_features, sampling_strategy=0.35, random_state=42)
rus = RandomUnderSampler(sampling_strategy=0.35, random_state=42)
classifier = RandomForestClassifier(random_state=42)
pipeline = imbalanced_make_pipeline(scaler, smote, rus, classifier)
random_search = RandomizedSearchCV(pipeline, param_distributions=param, scoring=scoring_metric, cv=cv, n_iter=10, random_state=42, n_jobs=-1)
best_model = random_search.fit(X_train, y_train).best_estimator_
y_pred = best_model.predict(X_test)
Гарантируется ли это конвейером несбалансированного обучения или мне нужно учитывать что-то еще?
Подробнее здесь: https://stackoverflow.com/questions/784 ... e-test-set