This approach can be chosen where the output can take only two values, 0 or 1, pass/fail, win/lose, alive/dead, or healthy/sick, and so on. In cases where the dependent variable has more than two outcome categories, it may be analyzed using multinomial logistic regression.
Logistic regression classifier
How to do it...
- After installing the essential packages, let's construct some training labels:
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
a = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
b = np.array([1, 1, 1, 2, 2, 2])
- Initiate the classifier:
classification = linear_model.LogisticRegression(solver='liblinear', C=100)
classification.fit(a, b)
- Sketch...