С другими моделями у меня вообще нет проблем.
Я что-то делаю не так?
(Это набор данных, который я использую, если он кому-то поможет: https://www.kaggle.com /datasets/bhanupratapbiswas/hr-analytics-case-study)
Код модели:
Код: Выделить всё
#Running the model with the best hyperparameters
weight_dict = {0: 0.59, 1: 3.12}
model = RandomForestClassifier(bootstrap=False, criterion='gini', max_depth=24, max_features='log2', min_samples_leaf=1, min_samples_split=2, n_estimators=200, class_weight=weight_dict)
model.fit(X_train_smote, y_train_smote)
y_pred = model.predict(X_test_outliers)
#Printing the results
print('Accuracy:', accuracy_score(y_test, y_pred))
print('AUC-ROC Score:', roc_auc_score(y_test, y_pred))
print('Classification Report:', classification_report(y_test, y_pred))
#Plotting the confusion matrix
plt.figure()
sns.heatmap(confusion_matrix(y_test, y_pred), annot=True, fmt='d', cmap='Blues')
plt.xlabel('Predicted label')
plt.ylabel('True label')
plt.xticks(rotation=45)
Я проверил прошлые вопросы и ответы , но я уже применил решения из разных ответов, но безуспешно.
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/783 ... h-randomfo