A multi-class classification project that classifies Iris flowers into three species (Iris-setosa, Iris-versicolor, and Iris-virginica) using a Sequential Neural Network built with Keras and TensorFlow, and evaluated using 10-Fold Cross-Validation via Scikit-Learn.
The goal of this project is to accurately predict the species of an unseen Iris plant based on four morphological measurements[cite: 1]. The workflow covers data loading, exploratory data visualization, target label one-hot encoding, neural network modeling, and rigorous cross-validation evaluation[cite: 1].
The dataset contains 150 instances (50 instances per class across 3 classes)[cite: 1]:
- Features (Inputs):[cite: 1]
- Sepal length (cm)[cite: 1]
- Sepal width (cm)[cite: 1]
- Petal length (cm)[cite: 1]
- Petal width (cm)[cite: 1]
- Target Classes (Outputs):[cite: 1]
Iris-setosa[cite: 1]Iris-versicolor[cite: 1]Iris-virginica[cite: 1]
- Python 3[cite: 1]
- Pandas & NumPy – Data loading, manipulation, and array operations[cite: 1]
- Matplotlib – Scatter plots for Sepal and Petal feature visualization[cite: 1]
- Keras & TensorFlow – Building and training the artificial neural network[cite: 1]
- Scikit-Learn –
LabelEncoder,KerasClassifierwrapper, andKFoldcross-validation[cite: 1]
A baseline feedforward neural network is constructed using Keras Sequential API[cite: 1]:
| Layer | Type | Neurons | Activation | Input Shape |
|---|---|---|---|---|
| Hidden Layer | Dense (Fully Connected)[cite: 1] | 8[cite: 1] | relu[cite: 1] |
(4,)[cite: 1] |
| Output Layer | Dense (Fully Connected)[cite: 1] | 3[cite: 1] | softmax[cite: 1] |
(8,) |
- Loss Function:
categorical_crossentropy[cite: 1] - Optimizer:
adam[cite: 1] - Training Parameters:
200epochs, batch size of5[cite: 1]
To ensure model generalizability and prevent overfitting, the network is wrapped with KerasClassifier and evaluated using 10-Fold Cross-Validation (random_state=7)[cite: 1]:
- Baseline Prediction Accuracy: 97.33% (± 4.42%)[cite: 1]
- Individual Fold Accuracies:
[100%, 93.33%, 100%, 100%, 100%, 100%, 100%, 93.33%, 100%, 86.67%][cite: 1]
- Clone the repository:
git clone [https://github.com/Raja-M-4664/](https://github.com/Raja-M-4664/)<repository-name>.git cd <repository-name>