Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python program that uses LOOCV to evaluate polynomials with orders from 1 to 8 based on data stored in below. Print the mean

  1. Write a python program that uses LOOCV to evaluate polynomials with orders from 1 to 8 based on data stored in below. Print the mean loss, the order and the coefficients of the polynomial that has the smallest LOOCV mean loss to IDLE shell. Plot the mean losses for all the polynomials as a curve against their orders. Your program should contain the following three functions:

    a) polynomial(n,f): fit a polynomial with an order of n to the data stored in f. (In this and the following two functions, f should a two columns matrix, i.e., each row is a pair of attribute and target values.) b) LOOCV(n,f): use LOOCV on data stored in f to generate the mean loss for polynomial with degree n.(Hint: convert the algorithm LOOCV to a python function.) c)plotit(n, f): plot the mean loss of each polynomial with an order of i, 1 i n, based on data stored in f.

DATA

-5.00 -565.00 -4.66 -360.20 -4.31 -160.97 -3.97 -253.33 -3.62 -216.29 -3.28 21.13 -2.93 -9.09 -2.59 -74.95 -2.24 -42.49 -1.90 -50.70 -1.55 111.38 -1.21 -31.25 -0.86 -1.61 -0.52 124.28 -0.17 109.41 0.17 101.76 0.52 18.32 0.86 -76.93 1.21 -64.01 1.55 9.07 1.90 185.28 2.24 59.63 2.59 -16.92 2.93 26.63 3.28 156.26 3.62 260.95 3.97 278.68 4.31 427.45 4.66 512.22 5.00 492.00

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

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

Draft a proposal for a risk assessment exercise.

Answered: 1 week ago