Question: Generate Figure 4.6 Figure 4.6 In the same setting as that of figure 4.5, using one hundred models instead of five, bias, variance, and error

Generate Figure 4.6

 Generate Figure 4.6 Figure 4.6 In the same setting as that

of figure 4.5, using one hundred models instead of five, bias, variance,

and error for polynomials of order 1 to 5 . Order 1

Figure 4.6 In the same setting as that of figure 4.5, using one hundred models instead of five, bias, variance, and error for polynomials of order 1 to 5 . Order 1 has the smallest variance. Order 5 has the smallest bias. As the order is increased, bias decreases but variance increases. Order 3 has the minimum error. Ex[(E[rx]g(x))2x]=(E[rx])EX(g(x))2+EX[(g(x)EX[g(x)])2] Evaluate each of the three error functions with 10 equally spaced values starting from 0 and ending at 5 , i.e. np.linspace(0,5, 10) TODO: For each of the five polynomial models, print the average predictions, EX[g(x)], at np.linspace (0,5,10) lint: Average prediction at point x means computing the average value of the predictions of 100 models generated by 100 datasets. The point x should range from np.linspace (0,5,10) rODO: Generate and print a DataFrame with 5 rows, one for each order and 4 columns. The 4 columns are: - Order - Bias error - Variance error - Total error Hint: Average prediction at point x means computing the average value of the predictions of 100 models generated by 100 datasets. The point x should range from np.linspace (0,5,10) Hint: For bias error (E[rx])EX(g(x))2,E[rx]=f(x) and EX[g(x)] is the average over 100 models from the 100 datasets. Then, you can approximate bias error by average over x in np.linspace (0,5,10) of (E[rx]EX[g(x)])2. Hint: For For variance error, you need to have a nested loops (for each dataset and for x in n.linespace (0,5,10) ) to get the average variance arror. Hint: The total error is the sum of bias error and variance error

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!