Question: 11. Write an R function to perform matrix completion as in Algorithm 12.1 and as outlined in Section 12.5.2. In each iteration, the function should

11. Write an R function to perform matrix completion as in Algorithm 12.1 and as outlined in Section 12.5.2. In each iteration, the function should keep track of the relative error, as well as the iteration count. Iterations should continue until the relative error is small enough or until some maximum number of iterations is reached (set a default value for this maximum number). Furthermore, there should be an option to print out the progress in each iteration. Test your function on the Boston data. First, standardize the features to have mean zero and standard deviation one using the scale() func- tion. Run an experiment where you randomly leave out an increasing (and nested) number of observations from 5% to 30%, in steps of 5%. Apply Algorithm 12.1 with M = 1,2,....8. Display the approx- imation error as a function of the fraction of observations that are missing, and the value of M, averaged over 10 repetitions of the ex- periment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
