myrandaGoesToSpace / homework-DS5640

0 stars 0 forks source link

hw5 issue #5

Open Jiabing-Ruan opened 3 years ago

Jiabing-Ruan commented 3 years ago

Hi,

For _nadarayawatson <- function(y, x, x0, kern, ...), it uses y and x to fit the model, and it predicts the output with x0 parameter. That caused problem for your y_hat_test: y_hat_test <- nadaraya_watson(y_test, x_test, x_test, kern = kernel_k_nearest_neighbors, k = k) You should still use _ytrain and _xtrain to fit the model, and predict _y_hattest with _xtest.

Also, your homework looks incomplete. For question 4 and 5, https://biostat.app.vumc.org/wiki/pub/Main/CourseDSI5640/kNN-CV.R would be one good way to conduct cross-validation test and plot the figure. Just think about how to replace knnreg() with _nadarayawatson().

myrandaGoesToSpace commented 3 years ago

Thank you! I just resubmitted. Let me know if it looks good!

shiyaol commented 3 years ago

Hi Myranda, for the final question, lower k represents model for more complexity, you might want to change your answer