So today is day 1 of 100.
I started with linear regression and did it properly this time, from scratch, with no sklearn doing the work. Here's how the day went: Intuition first. What it means to fit a line through data, and what "best fit" is
I started with linear regression and did it properly this time, from scratch, with no sklearn doing the work.
Here's how the day went:
- Intuition first. What it means to fit a line through data, and what "best fit" is actually measuring.
- Cost function. Wrote out MSE and worked through why the errors get squared.
- Gradient descent by hand. Worked out the updates on paper before touching any code. It's a small loop: predict, check the error, adjust the weights, repeat.
- Implemented the whole thing in NumPy from scratch.
- Went through the assumptions the model relies on, mainly linearity and how the residuals behave.
- Ran the same data (California housing) through scikit-learn and compared it against my version.
I've used linear models in projects before. The ticket triage pipeline I built has a Linear SVM inside it. But I had never gone through the whole thing step by step myself, and I wanted that done before moving on to anything bigger.
I also spent some time on core Python, to make sure the basics under everything I write are solid.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.