Logistic Regression on the Iris Dataset
Sepal Length
5.10Sepal Width
3.50Petal Length
1.40Petal Width
0.20The Iris dataset used in the literature on classification methods and widely used in statistics and machine learning. There are four features: sepal length, sepal width, petal length, and petal width. The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant: Iris Setosa, Iris Versicolour, or Iris Virginica.
The following is a visualization of the logistic regression model trained on the Iris dataset. A given input goes through 3 transformations:
- Scaling: Normalizing the input to a mean of 0 and a standard deviation of 1, a.k.a, Z-score normalization
- Computing Logits: We calculate the logits as a linear combination of all the scaled inputs
- Softmax: The logits aren't useful by themselves, we can apply the softmax function to convert it to a probability distribution
- Prediction: Our prediction is the class with the largest probability
Notice that there is a fifth extra feature which is always 1. This gives us a convenient way to encode the bias terms.