# Can Machines Learn and Predict? — Training a Deep Neural Network using Pytorch for Iris Data set.

Original article can be found here (source): Deep Learning on Medium

# Can Machines Learn and Predict? — Training a Deep Neural Network using Pytorch for Iris Data set.

Using Python Program, train a Deep Neural Network for Iris Dataset and Predict the class of Iris plant.

In this fast moving world where the Machines are trained and used to predict the outcomes, the applications which involves the contribution of Artificial Intelligence has been increasing rapidly at a faster rate.

This post takes you through training a Deep Neural Network for one of the famous/basic dataset — IRIS DATASET. Finally the network will be able to predict the species of Iris based on 4 different physical parameters which will be gives as input.

The following steps will be followed in the process:

1. What is Iris Dataset ?— Let’s make an attempt to understand the dataset so that we can know which attributes will serve as the input and what exactly should be the output from the network.
2. Splitting the dataset — Split the dataset into Training, Validation and Test set.
3. Developing Layers for Neural Network — We will create the Deep neural network which includes Input layer, Hidden Layer, and Output layer.
4. Defining the training parameters — The most important part of a DNN is defining the hyper parameters (Learning rate, batch size, number of epochs etc;), activation function, loss function which we will be discussing as we write the program.
5. Train the network — After completing all the above process we will then train the Deep Neural Network.
6. Prediction — Based on the accuracy obtained we will give a random value and check whether the network is predicting the correct values.

What exactly is a Iris Dataset?

The Iris dataset has 150 rows and 5 columns (excluding the ID column) and it looks something like this:

Iris Dataset consists of 4 physical attributes of the flower namely:

1. sepal length in cm
2. sepal width in cm
3. petal length in cm
4. petal width in cm

and one attribute to be predicted that is the “Species” column — the class of the Iris plant. In the dataset provided there are three species namely “Iris-setosa”, “Iris- versicolor”, “Iris-virginica”.

So, here the 4 physical attributes will serve as the input to the network and the network will give one output based on the input provided whether it belongs to “Iris-setosa”or “Iris- versicolor” or “Iris-virginica”.

Let’s start coding by importing the necessary packages:

[Any Additional information if required the same is provided by # commenting in the program]