Iris Species Predictor & Explorer

Abdulla Zhaina
November 16, 2026

A Shiny app that identifies iris species from four flower measurements

The Problem & the App

Identifying an iris species usually means comparing measurements against reference tables by hand.

  • Goal: predict the species (setosa, versicolor, virginica) instantly from four measurements.
  • How it works: move four sliders for sepal and petal length and width; the predicted species and its probability update immediately.
  • Explore: a scatter plot with selectable axes shows where your flower sits among the 150 flowers in the data.
  • Built-in help: a Documentation & Help tab inside the app explains every step for new users.

The Model (live R code)

server.R fits a Linear Discriminant Analysis model on the iris data (150 flowers, 4 measurements) and predicts the user's input:

library(MASS)
fit <- lda(Species ~ ., data = iris)
flower <- data.frame(Sepal.Length = 5.8, Sepal.Width = 3.0,
                     Petal.Length = 4.3, Petal.Width = 1.3)
round(predict(fit, flower)$posterior * 100, 1)
  setosa versicolor virginica
1      0        100         0

The model classifies 98% of the training flowers correctly.

Exploring the Data

The Explore tab plots any two measurements; your flower appears as a black star:

plot of chunk unnamed-chunk-2

Try It

No R knowledge needed: open the link, move the sliders, and read the prediction. The Documentation & Help tab explains the rest.