Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql All In One For Dummies 7 Books In One

Authors: Allen G Taylor ,Richard Blum

4th Edition

1394242298, 978-1394242290

More Books

Students also viewed these Databases questions