Linear Regression, Machine Learning, Deep Learning, Jupyter Notebook, Naem Azam.
formula:- Now let’s try doing OLS on the above dataset:- n = len(X) theta_1 = ((n * (X*Y).sum()) - (X.sum() * Y.sum())) / ((n * (X**2).sum()) - X.sum()**2) theta_0 = (Y.sum() - theta_1 * X.sum()) / n print(theta_1, theta_0) Well, the values look the same as we expected. But one thing to understand