The iris data is a widely used dataset in data analysis examples. It includes four botanical measurements related to three flower species: setosa, versicolor and virginica.

The following graphics show the three species and their distribution of the sepal and petal lengths and widths.

Classification: 2 species

We will remove the setosa species and study the classification between versicolor and virginica species for a first approach. Later we will work on the entire set.

We create the train and test partitions.

Classification by one feature (LDA)

We start this study by classifying the species based on only one feature.

Among the four features, the one that showed the best cutoff, with the highest accuracy, was the Petal Width.
So we will use the Petal Width to classify and calculate the accuracy over the test set.

The classification model we trained is in fact Linear Discriminant Analysis (LDA) applied over one predictor. By applying LDA, it has the same confusion matrix.

Classification by two features (LDA)

Using a single feature and optimizing the cutoff as we did on our training data can lead to overfitting.
We can explore the data, analysing each feature against the others.

By analyzing previous figure, we see that Petal.Length and Petal.Width in combination could potentially be more informative than either feature alone.
We will optimize the cutoffs separately for Petal.Length and Petal.Width in the train set and predict with Petal.Length and Petal.Width cutoffs together.

We can see that we achieved a better accuracy over the model. If we apply LDA over 2 predictors, the accuracy achieved is quite similar, but with a better distribution of sensitivity and specificity.

Classification by all predictors (QDA)

We now apply Quadratic Discrimant Analysis, using all predictors, in search for a better accuracy.

Classification: 3 species

We now proceed to apply the LDA and QDA models with the entire dataset and outcomes.

LDA: all predictors

QDA: all predictors

Since this dataset is small and has few predictors, LDA and QDA was fast and showed high accuracy. The predictors also looked to follow multivariate normal distribution, which is required for these models.