Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (50 points) Complete the linear regression functions (least squares and ridge regression). Use the code to conduct the following experiments: (a) (5 points)

  

1. (50 points) Complete the linear regression functions (least squares and ridge regression). Use the code to conduct the following experiments: (a) (5 points) Randomly generate 30 data points from the sine function, where each data point (x, y) has the form: x = [x0,x, x, x10], x = [0,2] y=sin(x), EN(0, 0.3) (b) (5 points) Plot the data points along with the sine function. You should be able to see a figure similar to the following: 1.5 1.0 0.5 0.0 -0.5 -1.0- 0 1 3 4 5 6 t (c) (20 points) Randomly split the dataset (you can use the function provided in the Regres- sion code) and use 70% of the data points for training and the rest for testing. Apply ridge regression using different A E A = [le - 10, le 5, le 2, le 1, 1, 10, 100, 1000]. Plot the training and testing performance per \. (d) (20 points) Implement the k-fold cross validation function. Use k = 4 to choose the optimal from the set A above.

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Solve the following equations. 3x + 5y = 11 2x- y=16

Answered: 1 week ago