Your restaurant bill predicts your tip. That’s linear regression. 🍽️
#machinelearning #linearregression #datascience
Your restaurant bill predicts your tip. That’s linear regression. 🍽️
We took 244 real restaurant bills and their tips, and drew one straight line through them:
tip = w × bill + b
How do you find the best line? Every miss is an error. Square each error, add them up, and pick the line where that total is the smallest. That’s “least squares”, and it’s the idea behind every regression model.
The result:
→ Every extra dollar on the bill adds about 10.5 cents of tip
→ A $50 bill → about $6.17 tip
→ The line explains 46% of the variation (R² = 0.46). The rest is people being people.
💬 Comment LINE and I’ll DM you the code: the formula by hand + scikit-learn, same result.
#machinelearning #linearregression #datascience #python #scikitlearn
Comments
Comments from the original post on Instagram
No comments yet
