MLOPS | DAY 13 | LINEAR  REGRESSION  WITH  ANN

MLOPS | DAY 13 | LINEAR REGRESSION WITH ANN

In this Article, you will came across on linear regression with Artificial Neural Network(ANN). In this Example we will be using Perceptron i.e the basic unit of Neural Network.

No alt text provided for this image

In the above example, i have taken the dataset of height and weight of male and female. Height feature is stored in x variable whereas Weight is stored in y variable.

No alt text provided for this image

After that we will build the network of only one layer. In this Scenario Keras will helps us to build a layer. There different types of models in keras.model. So, from that only Sequential model is selected. Dense will form the layer with only one input and only one output. As we are using single layer perceptron therefore it has only one input and one output. Sequential() will make the model and store in model variable.

No alt text provided for this image

model.summary() will give you the summary of the model. In summary there will be name of the model i.e Sequential_2. How many layers you have applied with how many inputs and outputs. The param # will give you how many weights and biases the neural network have selected for predicting output(y).

No alt text provided for this image

compile function will take loss and optimizers. Loss will give the no. of decents required (difference in current weight and actual weight) for that we have used MSE(mean_squared_error) whereas optimizer will full fill that descent. Here we have used Adam as a optimizers.

No alt text provided for this image

The epoch will pass your whole dataset through the entire network . Here i have taken epoch=20 that means my whole dataset will be passed 20 times through the network. As you can see when model was on the first epoch the loss was 657.03 as it cam to the last epoch the error have reduced to 181.2. By this we can say that if our model have reduced the error then the accuracy will be more.

This was the complete example on how ANN can be used for linear regression problem.

Hope you'll find this article interesting.

Thank You !


Kajal Kashyap

RHCE | ARTH learner | ISCP Certified

4 年

??????

要查看或添加评论,请登录

Amit Sharma的更多文章

社区洞察

其他会员也浏览了