#linearregression
➡️ Machine Learning from Scratch, part 40: is linear regression machine learning? Linear regression is machine learning, because it learns a weight and a bias from examples with known answers, which makes it supervised learning in its simplest form. What makes it special is that the best weight and bias can also be computed in one step with the normal equation, w = (X^T X)^-1 X^T y, so standard tools usually solve it directly with a least squares routine without any training loop. Gradient descent comes back when the data gets really huge, and it trains neural networks, where there is generally no such formula. We ran everything ourselves and downloaded nothing. linreg_ml.py (14 lines of numpy) takes the same eight points as part 1. Gradient descent with the same settings as part 1 (start at 0, learning rate 0.01) still has a bias of 1.995 after 1,000 steps, while the formula gives 2.029 (weight 0.796), and it needs 2,052 steps to come within 0.0005 of the formula. The least squares routine gives the same numbers as the formula. Honest notes: on eight points the formula is instant, and on millions of rows with many features the picture changes, which is when step by step training pays off. #machinelearning #ai #linearregression #datascience #coding
MachineLearningToGo23,100 görüntüleme • 27 gün önce
Daha fazla içerik yok.


