This project showcases machine learning techniques to classify the Iris dataset. We utilize both a Random Forest Classifier and a Neural Network to predict the species of iris flowers based on their features.
Dependencies: Ensure you have the following libraries installed to run the code: ->numpy
->pandas
->scikit-learn
->matplotlib
->seaborn
->tensorflow
You can install these libraries using pip:
pip install numpy pandas scikit-learn matplotlib seaborn tensorflow
Create a DataFrame: Convert the data into a pandas DataFrame for easy manipulation.
Split the data: Separate features from target labels.
Encode target labels: Convert labels into numerical format using LabelEncoder.
Train-Test Split: Divide the data into training and testing sets (80-20 ratio).
Initialize and Train:-Train a Random Forest Classifier with 100 estimators on the training data.
Evaluate the Model:-Assess the model’s performance using accuracy, classification report, and confusion matrix.
Create visualizations for accuracy, classification report, and confusion matrix using matplotlib and seaborn.
Normalize Features:-Apply StandardScaler to normalize the data.
Build and Train:-Construct and train a neural network with one hidden layer.
Evaluate the Model:-Measure the model’s accuracy on the test set.
Results
Accuracy:-100%
Accuracy Plot Of Neural Networks:
This project demonstrates the effectiveness of both the Random Forest Classifier and Neural Network in classifying the Iris dataset. Both models achieve high accuracy, supported by detailed metrics and visualizations.