Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write the python code and carry out the following requirements a) Generate a synthetic 2-D data set with 100 data points where 0 x 1,0


write the python code and carry out the following requirements 
a) Generate a synthetic 2-D data set with 100 data points where 0  x  1,0  x  1 are evenly spaced. Assign the

a) Generate a synthetic 2-D data set with 100 data points where 0 x 1,0 x 1 are evenly spaced. Assign the data with target values y = sin(x + 5x2) polluted by random noise. Use LinearRegression model in sk-learn to train the dataset. Use Polynomial Features to map the generated dataset into higher dimension space and train the dataset with LinearRegression model. Plot the mean square errors with regard to the polynomial degree ranging from 1 to 10. b) When the degree of polynomial feature mapping is 3, the new input data will be 10-D, so linear model will train 10 weights. Try to use Ridge regression model with the following parameters and find the new weights: (i) = 0.1, (ii) = 0.01, (iii) = 0.001. Create a plot showing how these weights change with values. Explain what effects does have on the trained model? c) Now try to use Lasso regression model with the following parameters and find the new weights: (i) = 0.1, (ii) = 0.01, (iii) = 0.001. Explain what effects does have on the trained model? Talk about similarities and differences between Ridge and Lasso

Step by Step Solution

There are 3 Steps involved in it

Step: 1

a To generate the synthetic 2D dataset map it into a higherdimensional space using PolynomialFeatures and train it with a LinearRegression model you c... 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

Basic Technical Mathematics

Authors: Allyn J. Washington, Richard Evans

12th Edition

0137529899, 9780137529896

More Books

Students also viewed these Programming questions

Question

Find the fractions equal to the given decimals. 0.33333 . . .

Answered: 1 week ago