daviddalpiaz / r4sl

:chart_with_upwards_trend: Machine Learning from the perspective of a Statistician using R
https://daviddalpiaz.github.io/r4sl/
72 stars 62 forks source link

Another view of Sim Bias Variance Tradeoff #10

Closed hxd1011 closed 6 years ago

hxd1011 commented 6 years ago

First, I really like the Bias Variance Tradeoff Simulation Section!! Thank you very much for making such a great book.

One suggestion from me.

Figure 1 is not very intuitive for me, it shows too many information. image

Alternatively I think this visualization may be better, which only shows the prediction for the x=0.95 cross different model. From 4 sub plots we can clean see, bias and variance.

image

Here is the code.

  par(mfrow=c(1,4))
  plot(rep(0.95,n_sims),predictions[,1],col="red", xlim = c(0.75, 1), ylim = c(0, 1.5))
  points(x0, f(x0), col = "black", pch = "x", cex = 2)
  plot(rep(0.95,n_sims),predictions[,2],col="blue", xlim = c(0.75, 1), ylim = c(0, 1.5))
  points(x0, f(x0), col = "black", pch = "x", cex = 2)
  plot(rep(0.95,n_sims),predictions[,3],col="green", xlim = c(0.75, 1), ylim = c(0, 1.5))
  points(x0, f(x0), col = "black", pch = "x", cex = 2)
  plot(rep(0.95,n_sims),predictions[,4],col="orange", xlim = c(0.75, 1), ylim = c(0, 1.5))
  points(x0, f(x0), col = "black", pch = "x", cex = 2)
daviddalpiaz commented 6 years ago

Thanks for the suggestion! I'll actually be teaching a course on this material this coming semester, so expect updates throughout the fall. This chapter in particular is one I'll definitely be cleaning up.

daviddalpiaz commented 6 years ago

Completely rewrote chapter. @hxd1011 if you're willing to provide your name, I'll add you to the acknowledgments. I used your visualization idea.

hxd1011 commented 6 years ago

Hi, David, Thank you very much for the acknowledgement. My name is Haitao Du. and here is my linkedin profile.

https://www.linkedin.com/in/haitao-du-32a28220/

If you like I am also happy to revise or write some chapter together with you in the future. Thank you again and nice work!.

daviddalpiaz commented 6 years ago

Added!