mml-book / mml-book.github.io

Companion webpage to the book "Mathematics For Machine Learning"
12.91k stars 2.39k forks source link

ynew not used in the Linear Regression jupyter notebook #708

Open cristianregep opened 2 years ago

cristianregep commented 2 years ago

Describe the mistake The jupyter notebook for Linear Regression has 2 mistakes in the 1. Maximum Likelihood heading . Essentially you are calculating theta_aug_ml with the old y (instead of ynew) and when you are plotting you also using y (instead of ynew). As such the mistake can not be easily observed in the plot, but you are essentially performing the augmented ML estimate on the original dataset and not on the one where y is biased by 2.0

Location

  1. theta_aug_ml = max_lik_estimate_aug(X_aug, y) 2.plt.plot(X, y, '+', markersize=10) below 1. (or the 3rd occurence of this line in the notebook)

Proposed solution

  1. should become theta_aug_ml = max_lik_estimate_aug(X_aug, ynew)
  2. should become plt.plot(X, ynew, '+', markersize=10)

Additional context N/A