write the python code and carry out the following requirements a) Generate a synthetic 2-D data set
Fantastic news! We've Found the answer you've been seeking!
Question:
write the python code and carry out the following requirements
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
a To generate the synthetic 2D dataset map it into a higherdimensional space using PolynomialFeatures and train it with a LinearRegression model you c... View the full answer
Related Book For
Basic Technical Mathematics
ISBN: 9780137529896
12th Edition
Authors: Allyn J. Washington, Richard Evans
Posted Date:
Students also viewed these programming questions
-
In a sales/accounts receivable system the original customer purchase order is sent to billing. What misstatement does sending the original, not a copy, best help to prevent?
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
For each polynomial function, find (a) (-1), (b) (2), and (c) (0). f(x)=x5x4
-
Each of three machined parts is classified as either above or below the target specification for the part.
-
A hollow cubical box is 0.30 m on an edge. This box is floating in a lake with one-third of its height beneath the surface. The walls of the box have a negligible thickness. Water from a hose is...
-
Rainwater flows through the galvanized iron downspout shown in Fig. P8.106 at a rate of \(0.006 \mathrm{~m}^{3} / \mathrm{s}\). Determine the size of the downspout cross section if it is a rectangle...
-
Olympia Hospital has overall variable costs of 25% of total revenue and fixed costs of $45 million per year. 1. Compute the break-even point expressed in total revenue. 2. A patient-day is often used...
-
The Singly Linked List below represents a queue q where q.peek() -87. Then, we perform these operations: q.peek(); q.enqueue(88); q.dequeue(); What is the output of q.peek() after all those...
-
Diana acquires, for $65,000, and places in service a 5-year class asset on December 19, 2022. It is the only asset that Diana acquires during 2022. Diana does not elect immediate expensing under ...
-
The chief benefit of a marketing plan is: a). To raise money for the business. b). To identify all potential customers precisely. c). To anticipate marketing methods that do not yet exist. d). To...
-
Provide an overview of the three theoretical underpinnings supporting student engagement. What conclusions will be reached about student engagement? What framework of theory and resources can be...
-
Create a sales funnel using the below information: ABC company has 500 employees and 6 departments: Sales, Marketing, Customer Support, Finance, IT, and Human Resources. They need a system that...
-
Solve the newsperson problem. Probability 0.27 Value 1 Purchase cost c Selling price p Salvage value v 0.20 2 Optimal order quantity 0.13 3 16 36 10 What is the optimal order quantity? 0.10 4 0.20 5...
-
Electric charge and electric force You have all heard about electric charge. Well, for now, please forget EVERYTHING you have heard. For the rest of this lab, you are only to write comments and make...
-
A retailer of a seasonal product is determining the order quantity for the coming selling season. The retailer buys each unit at $10 and sells it at a price of $20. At the end of the selling season,...
-
What are Filipinos family traditions?
-
A fast-food restaurant averages 150 customers per hour. The average processing time per customer is 90 seconds. a. Determine how many cash registers the restaurant should have if it wishes to...
-
Find the fractions equal to the given decimals. 0.33333 . . .
-
Express the given complex numbers in polar and rectangular forms. 2.50e 3.84j
-
Find the indicated sides of the right triangle shown in Fig. 2.132. b = 0.380, c = 0.736, a = ? a C b Fig. 2.132
-
How do you classify a lathe? Explain briefly.
-
Differentiate between live and dead centres of a lathe.
-
List the various lathe accessories.
Study smarter with the SolutionInn App