Created
November 11, 2021 00:36
-
-
Save marcosan93/9e5ebed50604776256365e7383f2cf71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Other models | |
| from sklearn.ensemble import AdaBoostClassifier, GradientBoostingClassifier, RandomForestClassifier | |
| from sklearn.neighbors import KNeighborsClassifier | |
| from sklearn.linear_model import LogisticRegression | |
| from sklearn.naive_bayes import GaussianNB | |
| from sklearn.svm import SVC | |
| from sklearn.tree import DecisionTreeClassifier | |
| models = { | |
| "adaboost":AdaBoostClassifier(random_state=11), | |
| "gradboost":GradientBoostingClassifier(random_state=11), | |
| "rf":RandomForestClassifier(random_state=11), | |
| "knn":KNeighborsClassifier(), | |
| "logreg":LogisticRegression(solver='liblinear'), | |
| "nb":GaussianNB(), | |
| "svm":SVC(), | |
| "dec_tree": DecisionTreeClassifier() | |
| } | |
| for model_name, model in models.items(): | |
| # Fitting | |
| clf = model | |
| clf.fit(X_train, y_train) | |
| # Predictions | |
| preds = clf.predict(X_test) | |
| #Printing out results | |
| report = classification_report(y_test, preds) | |
| print(model_name+"\n",report) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment