-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathll.py
36 lines (31 loc) · 1.37 KB
/
ll.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
models = []
models.append(('Gradient Boosting', GradientBoostingClassifier()))
models.append(('Light Gradient Boosting', LGBMClassifier()))
models.append(('Random Forest', RandomForestClassifier()))
models.append(('Linear Discriminant Analysis', LinearDiscriminantAnalysis()))
models.append(('Logistic Regression', LogisticRegression()))
models.append(('KNN', KNeighborsClassifier()))
models.append(('Extra Trees', ExtraTreesClassifier()))
models.append(('SVM', SVC()))
models.append(('AdaBoost', AdaBoostClassifier()))
models.append(('Ridge', RidgeClassifier()))
models.append(('Dummy', DummyClassifier()))
models.append(('Decision Tree', DecisionTreeClassifier()))
models.append(('Naive Bayes', GaussianNB()))
models.append(('Quadratic Discriminant Analysis', QuadraticDiscriminantAnalysis()))
results = []
names = []
scoring = 'accuracy'
for name, model in models:
kfold = KFold(n_splits=10, random_state=42, shuffle=True)
cv_results = cross_val_score(model, X_train, y_train, cv=kfold, scoring=scoring)
results.append(cv_results)
names.append(name)
plt.figure(figsize=(10,7))
plt.boxplot(results, labels=names)
plt.title('Algorithm Comparison')
# swap the axes
plt.xlabel('Algorithm')
plt.ylabel('Accuracy')
plt.xticks(rotation=90)
plt.show()