Linear Regression clearly Explained!
Linear Regression models relationship between a dependant variable (y) & two or more independent variables (x1, x2 ...)
❗️For the sake of simplicity we discuss linear regression with a single independent variable.
Mathematical Representation:
y=mx+c
where:
- y is the dependent variable
- x is the independent variable
- m is the slope of the line
- c is the y intercept
Cost Function:
❗️The goal is to find the best values for m and c that minimize the error between the predicted values & the actual values for all data points.
This is how the cost function looks, a mean squared error:
MSE= 1/N∑(yi−(m*xi+c))**2
Where:
- N is the number of data points.
- yi is the actual value for the ith data point.
- mxi+c is the predicted value for the ith data point.
How it works (Optimisation)❓
To minimize the MSE, we can use gradient descent.
The basic idea is to:
- Start with some initial value of m & c
- Compute the gradient of the MSE w.r.t. both m & c.
- Update m & c in the direction of the negative gradient.
Implementation from Scratch:
Now that we understand how things work it's fairly simple to implement linear regression in Python!
Check this out 👇
That's a wrap!
If you interested in:
- Python 🐍
- ML/MLOps 🛠
- CV/NLP 🗣
- LLMs 🧠
- AI Engineering ⚙️
Find me → @akshay_pachaar ✔️
Everyday, I share tutorials on above topics!
I also write a weekly Newsletter on AI Engineering, link in the next tweet!
Cheers!! 🙂
Working on a project and want to collaborate together? Hang with us for coffee and code ☕Saturday ☕May 20th☕ 1pm at Marie Blachère Bakery & Café . Details on our MeetUp page: https://t.co/0glbSQkh9D
I wrote a short tutorial on how to access data and create maps like mine from Microsoft's Global Building Footprint dataset using #python and #QGIS. The dataset is *really* cool, and this is just a way to get started with it
https://t.co/xW4oMoRk9t
I don’t know who needs to hear this but there is a 30 minute video called “Studio Ghibli Nature Loop” on HBO Max that just plays different pretty scenes from Ghibli movies with ambient sound
This month we are reading 👁️🗨️ "Queer Data : Using Gender, Sex and Sexuality Data for Action" by Dr. Kevin Guyan. Come join us for our book club discussion on Saturday 8/20 in Great Hill in Central Park. Details on our Meet Up page.
Just discovered you can create a docker image from for your #rstats project with a one-liner using either the DESCRIPTION file or the `renv` lock file:
We're excited to announce Quarto, a new open-source scientific and technical publishing system.
Quarto is the next generation of R Markdown and takes what we've learned from the last 10 years and weave it into a more complete, cohesive whole.
Read more: https://t.co/ceO07mFT0V
Blogging is a great opportunity for
📚 learning
🤝 helping others
👨🏽💼 building a portfolio and finding jobs
And it has never been so easy to start a blog. To help you, I've created a MASSIVE guide to get you started. Find it at https://t.co/W5qAsSWDhq
Highlights in 🧵 #rstats
Do you have a dataset with some missing values, and another form with the missing values completed? Yesterday I was reminded about the rows_update() #rstats function!
Putting your work on GitHub probably is the best decision you can make to build your portfolio.
But what makes a good project stand out?
A good README.
Here are 4 ways to make a good README: 🧵
@ryenlung I love your videos! Congrats on a successful corgicon :D
Will you be restocking the sold-out colors of "Gatsby Corgi Embroidered DAD HAT"? Trying to figure out if I should wait or get one before they're all gone. Thank you!
Today I realised I can add emojis to my #Rstats code to help my squiggly brain navigate it! Now I just have to look for the correctly coloured thing instead of a wall of monochromatic text. Look at how tidy and cute my @rstudio document outline is!
It was a privilege to present "Level Up Your Labels" at the #rstats@_useRconf poster session this afternoon. Thanks for the good questions!
Here's a link to the poster with the full code I used to create the plot.
https://t.co/qOBVGnbNRU
And here are the 5 tips in detail🧵👇