Expert Answers /
(Solved): 1. Randomly shuffle your data again. 2. Define which rows belong to which fold. Hint 1: You can use ...
1. Randomly shuffle your data again. 2. Define which rows belong to which fold. Hint 1: You can use the function cut on any vector to split it into equally sized folds Hint 2: You may not cut the data into k parts directly. Instead you may want to cut the row indices (1: nrow( data )) 3. Foreach of the 10 folds (write a loop using for or sapply): (a) Define the test set. Hint: you can use the function which, to define which rows are included in the test set. Sometimes, a minimal example helps to understand how the function works. testingstuff =c(1,1,1,2,2,2,3,3,3); which(testingstuff ==2) (b) Define the training set. Hint: the "-" Operator might be helpful. testingstuff [−c(3,4)] (c) Run your models on the training data. (d) Make prediction on the test data and compute the MSEs. (e) Save them in a vector. 4. Average the MSE over K runs. Which model is better?
Information and annotation - Please complete the tasks listed below in R - Please get together in groups of 3 persons, maximum, and hand in one assignment per group - Please send us the finished assignments via email (email@example.com or firstname.lastname@example.org) - Your assignment solution should be a single, run-able R script file, which we will re-run (we will adjust the working directory in your code, accordingly) - Please comment your code to make it comprehensible - Tasks that require an answer in text form should be answered in comments in the code - Please state the names and matriculation numbers of all group members in your code - This assignment is due by November, 20th , end of day - Grading will be based on - Whether the script runs correctly - Whether the produced results are correct - Whether the comments are concise and helpful - Whether both script and notes are generally helpful and concise