DEV Community

Cover image for Day 9: yup we are back, strong as ever.....
Venkata Sugunadithya
Venkata Sugunadithya

Posted on

Day 9: yup we are back, strong as ever.....

Hello There !!
Today was fun, after a long break I decided to work on writeing full code for gradient decent from scratch, and also I will write a full guide for linear regression here on dev soon

This guide will the intution behind cost function and gradient decent along with how learning rate effects the results....all these days of research wont go on scrap, ill share it here so everyone can access, since as I observed, there are very limited resources out there that help in Machine Learning

Well that aside this is what I am building right now....still got things to sort out

Dataset I Used:
Sales price of different houses along with other factors that effect the same

My Code:
implimentation of linear regression with the help of gradient decent and cost function

People keep cretisizeing that I copied code from somewhere....so here are some issues I faced so that you know this is my work no matter what

  • Overflow at functions compute_cost, gradient_decent as i didnt initalize cost, dm, db to 0.0 and used the power function insted of **

  • Forgot that alpha existed and ended up getting a weird graph that looks like this for iterations vs cost

  • I didn't know what skewing initially was, but i was aware of scaleing and ended up getting this which I absolutely hated cause I had a felling this will mess up my gradient decent cause values were too close to eachother

Final Results after I fixed things I felt were wrong:
Graphs:

  • Cost Vs area of land

    ahh so beautiful, Exactly what I wanted a nice scaled data that is centered

  • Iterations Vs Min cost function for different values of alpha (the step size)
    alpha = 0.0001 painfully slow i had to wait more than usual

alpha = 0.001 I got a really lovely graph for this.....I know I can do better but this was good

Lets see an overstep just in case......
alpha = 10

So thats it for today, tmrw see me do a test on my first model after looking for any refinement.....

Top comments (0)