Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Assume we have a training set and a test set as follows: Training set Index y Test set I Index I y 1

1. Assume we have a training set and a test set as follows: Training set Index r 1 2 3 4 5 6 7 8 9 10 Y 5.86

1. Assume we have a training set and a test set as follows: Training set Index y Test set I Index I y 1 5.86 0.74 1 5.80 0.93 2 1.34 1.18 2 0.57 1.87 3 3.65 0.51 3 4.30 -0.06 4 4.69 -0.48 4 6.55 1.60 5 4.13 -0.07 5 0.82 1.22 6 5.87 0.37 6 3.72 0.90 7 7.91 1.35 7 5.80 0.93 8 5.57 0.30 8 3.26 1.53 9 7.30 1.64 9 6.75 1.73 10 7.89 1.75 10 4.77 -0.51 Let's try to find some linear models to fit the training data. We use the RSS objective function J(0) = ||f(x) - Y||- (a) Calculate the analytic solution of the linear model f(x) = 0 + 0x. Then, plot the line of your obtained linear model together with the data points in training set. (5%) (b) Suppose we want to increase the model complexity, by considering y as a linear function of both x and x: f(x) = 0 + 0x+02x. In this case, calculate the analytic solution of the model and plot the curve of the model, together with the data points in training set. (5%) x(1) (hint: in this case, X = : x(1)2 and = 1 x(10) x(10) 2 Page 1 of 5 (c) Let's further increase the model complexity, by assuming y is related to higher-order forms of x, ie., fe(x)=80+0+ 0x +03x + 84x4. Again, calculate the analytic solution of the model, plot the curve of the function, together with the data points in training set. (5%) 1 (hint: in this case, X = : x(1) (2 x(1) X(1) X(1) 100\ 01 1 x (10) x(10) 2 x(10)4 and = 82) x(10) 83 04 (d) Observe the above three functions, please point out which could be faced with underfitting, which could be faced with overfitting, and which one is relatively a good one? Then, you can calculate the values of prediction error on the test data to verify your thoughts. (10%)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

import numpy as np Test set data Xtest nparray580 057 430 655 082 372 580 326 675 477 Ytest ... 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

Operating Systems Internals and Design Principles

Authors: William Stallings

8th edition

133805913, 978-0133805918

More Books

Students also viewed these Programming questions

Question

Was there an interaction of history and treatment effects?

Answered: 1 week ago

Question

List and briefly define four different clustering methods.

Answered: 1 week ago