Introduction to Scikit-learn
Chapter 6: Classification
Classifiers in scikit-learn
With your dataset ready, it is time for the main event! Let’s train a classifier.
Before we do that, we have to first choose our classifier model.
Scikit-learn offers implementations of many different classes of classifier models.
- K Nearest Neighbours:
from sklearn.neighbors import KNeighborsClassifier
- Decision Trees:
from sklearn.tree import DecisionTreeClassifier
- Logistic Regression:
from sklearn.linear_model import LogisticRegression
- Random Forests:
from sklearn.ensemble import RandomForestClassifier
- Naive Bayes:
from sklearn.naive_bayes import GaussianNB
- Support Vector Machines:
from sklearn.svm import SVC
- Multilayer Perceptron (a.k.a. Neural Networks):
from sklearn.neural_network import MLPClassifier