sta-363-s20 / community

Discussion, Q&A, everything you want to say, formatted nicely
1 stars 0 forks source link

Exercise 6 #54

Closed walkerjohn97 closed 4 years ago

walkerjohn97 commented 4 years ago

Hey Dr. McGowan,

I'm having problems with exercise 6. I based my codes off the code in the slides and the code runs without any errors, but the MSE is the same for all 3 models, so something is wrong. I paste code below

Screen Shot 2020-02-26 at 7 13 56 PM
LucyMcGowan commented 4 years ago

You should have 3 model statements (instead of having poly vary with k, you should just have 3 separate lines in there) check out the code in #49 along with my response there.

walkerjohn97 commented 4 years ago

If I change the k in that line to K, i get 3 mse's. Does that work?

walkerjohn97 commented 4 years ago
Screen Shot 2020-02-26 at 8 43 20 PM

Using this code I get different MSE's, but i do not have 3 model statements. Is this wrong?

LucyMcGowan commented 4 years ago

You should have 3 different MSEs (1 for each model) yes, but the code above is wrong. You are using K 2 times in that code, once to determine the fold of data that is left out of the training model (and then used to calculate the MSE) this is correct! and once to pick the polynomial term this is not correct! You should have 3 separate model statements, 3 separate predicted values, and 3 separate MSEs