Compare commits

..
2 Commits
Author SHA1 Message Date
lzh 4a8a3dad9b 1
Gitea Actions Experiment Test / Experiment-Actions (push) Successful in 24s
2024-11-02 21:22:34 +08:00
lzh 9d6226e04b 1 2024-11-02 21:21:56 +08:00
-13
View File
@@ -42,7 +42,6 @@ def load_data(filepath):
del data[26]
del data[25]
del data[24]
del data[23]
del data[22]
del data[2]
for i in data_25:
@@ -107,15 +106,3 @@ if __name__ == "__main__":
accuracy_test = accuracy_score(y_test, y_pred_test)
print(f"Test Accuracy: {accuracy_test}")
# 随机森林模型
param_grid = {
'n_estimators': [100, 200, 300],
'max_depth': [5, 10, 15],
'learning_rate': [0.01, 0.05, 0.1]
}
rf = RandomForestClassifier()
grid_search = GridSearchCV(estimator=rf, param_grid=param_grid, cv=5, scoring='accuracy')
grid_search.fit(X_train, y_train)
best_rf = grid_search.best_estimator_
print("Best parameters:", grid_search.best_params_)
print("Best accuracy:", grid_search.best_score_)