This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 6: Classification

Classifiers in scikit-learn

face Josiah Wang

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