Classify three Iris groups from four flower measurements
This reproducible benchmark standardizes sepal and petal measurements and applies a direct three-class softmax model. The exported classifier labels all 30 held-out records correctly, with a testing cross-entropy of 0.0359. The result demonstrates the workflow on a small historical data set; it does not establish general botanical identification accuracy.
1. Scientific objective
The objective is to reproduce a classic three-class classification problem using four morphometric measurements: sepal length, sepal width, petal length and petal width. The model is useful for teaching data splitting, multiclass softmax inference and reproducible deployment. It is not a field-identification system and does not capture the traits, geography or taxonomic evidence required for botanical work.
Show how four measured variables map directly to three class scores without a hidden layer.
Connect the historical table, exact random split, regenerated figures and executable export.
Use the browser model to explore how petal and sepal measurements change the three output scores.
2. Data and provenance
The downloadable irisflowers.csv contains 150 complete rows: 50 labelled Iris setosa, 50 Iris versicolor and 50 Iris virginica. The four continuous inputs are recorded in centimetres.
| CSV field | Definition | Unit | Observed range |
|---|---|---|---|
sepal_length | Length of the sepal | cm | 4.3–7.9 |
sepal_width | Width of the sepal | cm | 2.0–4.4 |
petal_length | Length of the petal | cm | 1.0–6.9 |
petal_width | Width of the petal | cm | 0.1–2.5 |
class | Supplied group label | category | three labels |
| Subset | Rows | Setosa | Versicolor | Virginica | Purpose |
|---|---|---|---|---|---|
| Training | 90 | 28 | 33 | 29 | Estimate model parameters |
| Selection | 30 | 11 | 7 | 12 | Monitor optimization |
| Testing | 30 | 11 | 10 | 9 | Report final internal performance |


iris.data file and corrected variants. This tutorial preserves the exact values used to train the supplied Neural Designer project; the downloadable copy only normalizes the accidental leading space in one column header. UCI lists the data under CC BY 4.0.3. Model
Each measurement is standardized using its mean and standard deviation. A single dense softmax layer connects the four scaled inputs directly to three outputs ordered as iris_setosa, iris_versicolor and iris_virginica.
The architecture has no hidden layer and contains 15 trainable parameters: twelve weights and three biases. It is a multiclass logistic classifier represented in Neural Designer’s neural-network framework.

4. Training strategy
The model minimizes multiclass cross-entropy with the quasi-Newton method and no explicit regularization. Optimization stores 44 iterations (epochs 0–43) and stops on the minimum-loss-decrease criterion.
Training cross-entropy decreases from 1.0995 to 0.0456. Selection cross-entropy decreases from 0.4546 to its minimum of approximately 0.0390 at epoch 30 and finishes at 0.0439.

5. Model selection and baseline
No neuron selection, input selection or architecture selection was performed. The direct 4–3 softmax model is both the base and final architecture. The selection subset monitors training but is not used to compare network sizes.
| Reference | Testing accuracy | Interpretation |
|---|---|---|
| Largest testing class | 36.7% | Always predict the label represented by 11 of 30 testing rows |
| Uniform three-class chance | 33.3% expected | Reference for three equally likely labels |
| Fixed softmax model | 100% | All 30 records in this internal testing subset classified correctly |
The compact linear decision model is sufficient for this split. Adding neurons would increase complexity without addressing the more important limitations: small sample size, duplicated measurement vectors and lack of external botanical validation.
6. Scientific validation
The held-out subset contains 30 records. The exported final model assigns all 11 setosa, 10 versicolor and 9 virginica rows to their supplied classes. Perfect accuracy on this small, familiar benchmark should be interpreted alongside score margins, provenance and split limitations.
| Testing metric | Value | Interpretation |
|---|---|---|
| Accuracy | 100% | 30 correct labels from 30 testing records |
| Macro precision | 100% | Unweighted mean across the three labels |
| Macro recall | 100% | Every testing record in each label recovered |
| Macro-F1 | 100% | Class-balanced precision/recall summary |
| Testing cross-entropy | 0.0359 | Calculated from the exact Python export |
Confusion matrix
| Actual / predicted | Iris setosa | Iris versicolor | Iris virginica | Total |
|---|---|---|---|---|
| Iris setosa | 11 | 0 | 0 | 11 |
| Iris versicolor | 0 | 10 | 0 | 10 |
| Iris virginica | 0 | 0 | 9 | 9 |
| Total | 11 | 10 | 9 | 30 |
Lowest-margin correct test case
A held-out Iris versicolor record with measurements 6.3, 2.5, 4.9 and 1.5 cm receives a versicolor score of 61.13% and a virginica score of 38.87%. The correct label alone therefore does not imply that every decision has a wide score margin.
7. Inference and reproducibility
A credible morphometric workflow would begin with a traceable specimen, confirm the measurement protocol and units, apply quality checks, calculate the four measurements, validate the input domain, produce the three model scores and route the result to botanical or teaching review.
Held-out inference example
The default browser values reproduce record 121 from the published testing subset. Its supplied label is Iris virginica.
| Input | Value |
|---|---|
| Sepal length | 6.9 cm |
| Sepal width | 3.2 cm |
| Petal length | 5.7 cm |
| Petal width | 2.3 cm |
| Supplied class | Iris virginica |
Setosa <0.0001%; versicolor 0.0080%; virginica 99.9920%. The predicted label matches the held-out target.
Try the exported Iris classifier
Enter the four flower measurements in centimetres. The default values reproduce a held-out Iris virginica record from the published split.
Reproduce the inference
The Python package contains the exact export, ordered four-field schema, held-out example and expected scores. The project package preserves the random split, trained parameters and regenerated analyses.
from model import NeuralNetwork
measurements_cm = [6.9, 3.2, 5.7, 2.3]
scores = NeuralNetwork().calculate_outputs(measurements_cm)8. Validity, uncertainty and limitations
- Small historical sample. The table contains only 150 records and 30 testing cases, so perfect testing accuracy has substantial sampling uncertainty.
- Duplicate-vector leakage. The measurement vector 4.9, 3.1, 1.5 and 0.1 cm occurs in the training, selection and testing subsets with the same setosa label.
- Known data-version issues. UCI documents corrections to particular rows. This project preserves the historical values it was trained on rather than silently mixing versions.
- Restricted measurements. The model uses four morphometric values only; it ignores location, growth conditions, phenology, colour, genetic evidence and other diagnostic traits.
- Uncalibrated scores. Softmax values rank the three labels but have not been independently calibrated as probabilities.
- No external validation. Transfer to new populations, observers, instruments, taxa or measurement protocols has not been evaluated.
- Educational boundary. The model is suitable for teaching and software verification, not authoritative botanical identification.
References
- UCI Machine Learning Repository: Iris. DOI: 10.24432/C56C76.
- Fisher RA. The use of multiple measurements in taxonomic problems. Annals of Eugenics. 1936;7(2):179–188.
- Unwin A, Kleinman K. Iris Data Set: In Search of the Source of Virginica. Significance. 2021;18(6):26–29.




