Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHONG ON JUPYTER NOTEBOOK CPE 4903 HW 2 - linear regression on parabolic 2nd order model Given labeled data below, input x and output y,

PYTHONG ON JUPYTER NOTEBOOKimage text in transcribed

image text in transcribedimage text in transcribed

CPE 4903 HW 2 - linear regression on parabolic 2nd order model Given labeled data below, input x and output y, find the following linear regression mode y^=h(x)=0+1x+2x2 Using the closed form vector solution, find the three thetas and the minimum cost function value. Plot the data points and the 2nd order fit. You should get something like this In [3]: x=nparray([[0.[0.63157895],[1.26315789],[1.89473684],[2.52631579],[3.15789474],[3.78947368],[4.42105263],[5.05263158],[5.68421053],[6.31578947],[6.94736842],[7.57894737],[8.21052632],[8.84210526],[9.47368421],[10.10526316],[10.73684211],[11.36842105],[12. In [4]: y=nparray([[17.22329795][8.43369363][6.27542435][4.10108263][4.9555383][2.17222397][6.23661542][5.10299025][8.73736893][10.64614783][19.37916358] In [4]: y=nparray([[17.22329795],[8.43369363],[6.27542435],[4.10108263],[4.9555383],[2.17222397],[6.23661542],[8.10299025],[10.646146893],[19.37916358],[11.51349879],[23.35681648],[28.75695777],[46.77636364],[35.80969641],[52.60582249],[52.64694177],[74.65549162],[94.90785863]]) In [7]: print('shape of x:+str(x, shape )+ and y:+str(y+ shape )) shape of x:(20,1) and y:(20,1) In [6]: \# Initialize vectors here m=len(x) x=npzeros((m,3)) Y=npzeros((m,1)) theta = np.zeros ((3,1)) In [9]: \# you code starts here

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

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions