Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

age,sex,bmi,children,smoker,region,charges 19,female,27.9,0,yes,southwest,16884.924 18,male,33.77,1,no,southeast,1725.5523 28,male,33,3,no,southeast,4449.462 33,male,22.705,0,no,northwest,21984.47061 32,male,28.88,0,no,northwest,3866.8552 31,female,25.74,0,no,southeast,3756.6216 46,female,33.44,1,no,southeast,8240.5896 37,female,27.74,3,no,northwest,7281.5056 37,male,29.83,2,no,northeast,6406.4107 60,female,25.84,0,no,northwest,28923.13692 25,male,26.22,0,no,northeast,2721.3208 62,female,26.29,0,yes,southeast,27808.7251 23,male,34.4,0,no,southwest,1826.843 56,female,39.82,0,no,southeast,11090.7178 27,male,42.13,0,yes,southeast,39611.7577 19,male,24.6,1,no,southwest,1837.237 52,female,30.78,1,no,northeast,10797.3362 23,male,23.845,0,no,northeast,2395.17155 56,male,40.3,0,no,southwest,10602.385 30,male,35.3,0,yes,southwest,36837.467 60,female,36.005,0,no,northeast,13228.84695 30,female,32.4,1,no,southwest,4149.736 18,male,34.1,0,no,southeast,1137.011 34,female,31.92,1,yes,northeast,37701.8768

age,sex,bmi,children,smoker,region,charges 19,female,27.9,0,yes,southwest,16884.924 18,male,33.77,1,no,southeast,1725.5523 28,male,33,3,no,southeast,4449.462 33,male,22.705,0,no,northwest,21984.47061 32,male,28.88,0,no,northwest,3866.8552 31,female,25.74,0,no,southeast,3756.6216 46,female,33.44,1,no,southeast,8240.5896 37,female,27.74,3,no,northwest,7281.5056 37,male,29.83,2,no,northeast,6406.4107 60,female,25.84,0,no,northwest,28923.13692 25,male,26.22,0,no,northeast,2721.3208 62,female,26.29,0,yes,southeast,27808.7251 23,male,34.4,0,no,southwest,1826.843 56,female,39.82,0,no,southeast,11090.7178 27,male,42.13,0,yes,southeast,39611.7577 19,male,24.6,1,no,southwest,1837.237 52,female,30.78,1,no,northeast,10797.3362 23,male,23.845,0,no,northeast,2395.17155 56,male,40.3,0,no,southwest,10602.385 30,male,35.3,0,yes,southwest,36837.467 60,female,36.005,0,no,northeast,13228.84695 30,female,32.4,1,no,southwest,4149.736 18,male,34.1,0,no,southeast,1137.011 34,female,31.92,1,yes,northeast,37701.8768 37,male,28.025,2,no,northwest,6203.90175 59,female,27.72,3,no,southeast,14001.1338 63,female,23.085,0,no,northeast,14451.83515 55,female,32.775,2,no,northwest,12268.63225 23,male,17.385,1,no,northwest,2775.19215 31,male,36.3,2,yes,southwest,38711 22,male,35.6,0,yes,southwest,35585.576 18,female,26.315,0,no,northeast,2198.18985 19,female,28.6,5,no,southwest,4687.797 63,male,28.31,0,no,northwest,13770.0979 28,male,36.4,1,yes,southwest,51194.55914 19,male,20.425,0,no,northwest,1625.43375 62,female,32.965,3,no,northwest,15612.19335 26,male,20.8,0,no,southwest,2302.3 35,male,36.67,1,yes,northeast,39774.2763 60,male,39.9,0,yes,southwest,48173.361 24,female,26.6,0,no,northeast,3046.062 31,female,36.63,2,no,southeast,4949.7587 41,male,21.78,1,no,southeast,6272.4772 37,female,30.8,2,no,southeast,6313.759 38,male,37.05,1,no,northeast,6079.6715 55,male,37.3,0,no,southwest,20630.28351 18,female,38.665,2,no,northeast,3393.35635 28,female,34.77,0,no,northwest,3556.9223 60,female,24.53,0,no,southeast,12629.8967 36,male,35.2,1,yes,southeast,38709.176 18,female,35.625,0,no,northeast,2211.13075 21,female,33.63,2,no,northwest,3579.8287 48,male,28,1,yes,southwest,23568.272 36,male,34.43,0,yes,southeast,37742.5757 40,female,28.69,3,no,northwest,8059.6791 58,male,36.955,2,yes,northwest,47496.49445 58,female,31.825,2,no,northeast,13607.36875 18,male,31.68,2,yes,southeast,34303.1672 53,female,22.88,1,yes,southeast,23244.7902 34,female,37.335,2,no,northwest,5989.52365 43,male,27.36,3,no,northeast,8606.2174 25,male,33.66,4,no,southeast,4504.6624 64,male,24.7,1,no,northwest,30166.61817 28,female,25.935,1,no,northwest,4133.64165 20,female,22.42,0,yes,northwest,14711.7438 19,female,28.9,0,no,southwest,1743.214 61,female,39.1,2,no,southwest,14235.072 40,male,26.315,1,no,northwest,6389.37785 40,female,36.19,0,no,southeast,5920.1041

1.3 Train the linear regression model Use the Linear regression model to do prediction minw 1 | y -Xw||2 Please output the learned model parameter w and see how the learned model fit the training set. In [16]: # your code 1.4 Evaluate the linear regression model Evaluate the learned model to see how well this model generaizes on the testing set In [171: # your code 1.5 Use the ridge regression model to do prediction In [181: 1.5.1 Compare its performance on the testing set with that of the standard linear regression model minw Ill -Xwl? 1.5.2 Use different ^ to see how it affects the performance of the ridge regression model on the testing set

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

More Books

Students also viewed these Databases questions

Question

LO6 List the components of job descriptions.

Answered: 1 week ago

Question

LO3 Define job design and identify common approaches to job design.

Answered: 1 week ago