Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions- Provide the python code and the mathematical equation. 5.) Conduct a Ridge Regression and a Lasso Regression on the Baseball Data set from Exercise

Instructions- Provide the python code and the mathematical equation.

5.) Conduct a Ridge Regression and a Lasso Regression on the Baseball Data set from Exercise 3. Does the r-squared value differ? Are any attributes discarded? What is the resulting equation? Provide the python equation and the mathematical equation.

image text in transcribedimage text in transcribed

E F G H 1 J L M N O w X G Position Age 1B LF SS 1B 33 23 25 32 R 634 626 531 H 85 127 69 2B 180 175 135 70 55 3B 38 22 25 14 HR 1 2 1 0 3 0 0 6 RBI 33 41 20 20 5 8 SB 123 101 52 56 CS 2 37 4 BB 2 9 2 0 2 SO 36 76 46 20 42 SS 1B SS 3B 2B OF 31 30 30 28 24 27 27 34 26 79 62 102 44 22 34 82 51 0 0 0 8 4 15 A B 1 Player Team 2 Abreu, Jos CWS 3 Acuna, Rc ATL 4 Adames, \ TB 5 Adams, M WSH 6 Adrianza, MIN 7 Aguilar, J. MIL 8 Ahmed, N ARI 9 Alberto, BAL 10 Albies, O: ATL 11 Alfaro, Jo MIA 12 Allen, Gre CLE 13 Almora, A CHC 14 Alonso, P NYM 15 Alonso, Y. CWS 16 Altuve, Jo HOU 17 Anderson MIA 18 Anderson CWS 19 Andrus, E TEX 20 Arcia, Orl MIL 21 Arenado, COL 22 Avila, Ale ARI 23 Bader, Ha STL 24 Baez, Javi CHC 0 2 4 4 4 2 50 141 160 189 113 53 AB 159 156 152 111 84 94 158 139 160 130 89 130 161 67 124 126 123 147 152 155 63 128 8 1 20 31 52 16 54 22 11 8 9 33 21 43 14 9 11 30 6 OF 310 202 222 556 524 640 431 231 339 597 219 500 459 498 600 494 588 164 26 3 1 2 16 26 Q R S S T AVG OBP SLG OPS Ave. Annual Salary 152 0.284 0.33 0.503 0.833 1.6E+07 188 0.28 0.365 0.518 0.883 560000 153 0.254 0.317 0.418 0.735 562400 115 0.226 0.276 0.465 0.741 4000000 40 0.272 0.349 0.416 0.765 1300000 59 0.225 0.32 0.374 0.694 637500 113 0.254 0.316 0.437 0.753 3662500 50 0.305 0.329 0.422 0.751 578000 112 0.295 0.352 0.5 0.852 575000 154 0.262 0.312 0.425 0.737 570000 53 0.229 0.29 0.346 0.636 560400 62 0.236 0.271 0.381 0.652 615500 183 0.26 0.358 0.583 0.941 555000 53 0.178 0.275 0.301 0.576 8000000 82 0.298 0.353 0.55 0.903 2.3E+07 114 0.261 0.342 0.468 0.81 585000 109 0.335 0.357 0.508 0.865 4166667 96 0.275 0.313 0.393 0.706 1.5E+07 109 0.223 0.283 0.35 0.633 565700 93 0.315 0.379 0.583 0.962 2.6E+07 68 0.207 0.353 0.421 0.774 4125000 117 0.205 0.314 0.366 0.68 578300 156 0.281 0.316 0.531 0.847 5200000 0 72 29 41 3 1B DH 2B 3B SS SS SS 3B CF SS 44 30 41 103 23 89 57 81 81 51 102 22 54 89 33 30 27 27 32 26 19 12 24 18 4 12 53 7 31 20 18 12 15 41 9 12 29 80 155 39 149 120 167 165 110 185 34 27 33 32 27 16 31 8 14 38 57 27 32 120 27 74 66 56 72 59 118 24 39 85 1 0 4 1 2 8 2 2 1 0 6 5 17 31 8 3 1 11 11 4 2 1 0 1 5 1 5 8 5 2 0 3 7 15 34 43 0 29 33 26 28 62 36 46 28 347 71 149 3 4 138 531 Exercise 3 - Baseball Statistic D E F G H 1 J K L M N o P S V 46 39 85 71 149 43 73 26 28 31 30 25 34 30 14 38 12 14 28 23 25 40 CF SS LF 2B SS 1B RF 1B 44 3 7 0 0 3 1 3 3 4 1 0 0 1 2 1 3 3 3 5 45 13 21 74 128 138 75 114 117 83 88 143 156 156 138 150 140 155 127 52 147 A B 23 Bader, Ha STL 24 Baez, Javi CHC 25 Barnes, A LAD 26 Barnhart, CIN 27 Bauers, Ja CLE 28 Beckham, DET 29 Beckham, SEA 30 Bell, Josh PIT 31 Bellinger, LAD 32 Belt, Bran SF 33 Benintenc BOS 34 Betts, Mo BOS 35 Blackmor COL 36 Bogaerts, BOS 37 Bote, Day CHC 38 Bour, Just LAA 39 Bradley, J BOS 40 Brantley, HOU 41 Braun, Ry MIL 42 Bregman, HOU 43 Brinson, I MIA 44 Bruce, Jay SEA 45 Bryant, K CHC 46 Buxton, B MIN 0.366 0.531 0.34 0.38 0.371 0.372 0.461 0.569 0.629 28 25 32 26 28 34 28 27 32 30 33 37 26 26 LF 347 531 212 316 372 223 304 527 558 526 541 597 580 614 303 151 494 575 459 554 226 165 543 271 54 89 28 32 46 29 39 94 121 76 72 135 112 110 47 18 69 88 70 122 15 27 12 29 5 11 12 6 15 37 47 17 13 29 32 33 11 8 84 48 72 146 170 123 144 176 182 190 78 26 111 179 131 164 39 35 153 71 16 13 21 37 34 32 40 40 42 52 17 5 28 40 31 37 9 43 15 47 116 115 57 68 80 86 117 41 RF CF SS 3B 1B CF LF LF 3B CF RF 3B CF 1 5 3 3 3 5 2 1 11 11 3 1 3 3 1 0 15 4 10 16 2 4 5 0 8 3 11 5 1 1 4 4 14 117 156 56 83 115 68 102 118 108 127 140 101 104 122 93 52 155 66 105 83 5 7 0 0 0 95 83 59 97 40 76 44 17 56 51 34 119 13 16 Q 0 0.205 0.281 0.203 0.231 0.226 0.215 0.237 0.277 0.305 0.234 0.266 0.295 0.314 0.309 0.257 0.172 0.225 0.311 0.285 0.296 0.173 0.212 0.282 0.262 R 0.314 0.316 0.293 0.328 0.312 0.271 0.293 0.367 0.406 0.339 0.343 0.391 0.364 0.384 0.362 0.259 0.317 0.372 0.343 0.423 0.236 0.283 0.382 0.314 T U 0.68 578300 0.847 5200000 0.633 575000 0.708 4000000 0.683 560400 0.643 700000 0.754 1750000 0.936 587000 1.035 605000 0.742 1.5E+07 0.774 717500 0.915 2E+07 0.94 1.8E+07 0.939 1.2E+07 0.784 561500 0.623 2500000 0.738 8550000 0.875 1.6E+07 0.848 1.2E+07 1.015 640500 0.457 570000 0.816 1.3E+07 0.903 1.3E+07 0.827 1750000 0 6 26 62 90 3 2 2 0.403 0.431 0.524 0.576 0.555 0.422 0.364 0.421 0.503 0.505 0.592 0.221 0.533 0.521 0.513 148 21 22 22 41 0 14 144 2 1 1 1 74 156 75 47 147 87 33 29 27 75 112 15 28 77 46 2 1 0 1 4 11 35 30 108 48 31 10 0 0 3 74 19 53 145 68 E F G H 1 J L M N O w X G Position Age 1B LF SS 1B 33 23 25 32 R 634 626 531 H 85 127 69 2B 180 175 135 70 55 3B 38 22 25 14 HR 1 2 1 0 3 0 0 6 RBI 33 41 20 20 5 8 SB 123 101 52 56 CS 2 37 4 BB 2 9 2 0 2 SO 36 76 46 20 42 SS 1B SS 3B 2B OF 31 30 30 28 24 27 27 34 26 79 62 102 44 22 34 82 51 0 0 0 8 4 15 A B 1 Player Team 2 Abreu, Jos CWS 3 Acuna, Rc ATL 4 Adames, \ TB 5 Adams, M WSH 6 Adrianza, MIN 7 Aguilar, J. MIL 8 Ahmed, N ARI 9 Alberto, BAL 10 Albies, O: ATL 11 Alfaro, Jo MIA 12 Allen, Gre CLE 13 Almora, A CHC 14 Alonso, P NYM 15 Alonso, Y. CWS 16 Altuve, Jo HOU 17 Anderson MIA 18 Anderson CWS 19 Andrus, E TEX 20 Arcia, Orl MIL 21 Arenado, COL 22 Avila, Ale ARI 23 Bader, Ha STL 24 Baez, Javi CHC 0 2 4 4 4 2 50 141 160 189 113 53 AB 159 156 152 111 84 94 158 139 160 130 89 130 161 67 124 126 123 147 152 155 63 128 8 1 20 31 52 16 54 22 11 8 9 33 21 43 14 9 11 30 6 OF 310 202 222 556 524 640 431 231 339 597 219 500 459 498 600 494 588 164 26 3 1 2 16 26 Q R S S T AVG OBP SLG OPS Ave. Annual Salary 152 0.284 0.33 0.503 0.833 1.6E+07 188 0.28 0.365 0.518 0.883 560000 153 0.254 0.317 0.418 0.735 562400 115 0.226 0.276 0.465 0.741 4000000 40 0.272 0.349 0.416 0.765 1300000 59 0.225 0.32 0.374 0.694 637500 113 0.254 0.316 0.437 0.753 3662500 50 0.305 0.329 0.422 0.751 578000 112 0.295 0.352 0.5 0.852 575000 154 0.262 0.312 0.425 0.737 570000 53 0.229 0.29 0.346 0.636 560400 62 0.236 0.271 0.381 0.652 615500 183 0.26 0.358 0.583 0.941 555000 53 0.178 0.275 0.301 0.576 8000000 82 0.298 0.353 0.55 0.903 2.3E+07 114 0.261 0.342 0.468 0.81 585000 109 0.335 0.357 0.508 0.865 4166667 96 0.275 0.313 0.393 0.706 1.5E+07 109 0.223 0.283 0.35 0.633 565700 93 0.315 0.379 0.583 0.962 2.6E+07 68 0.207 0.353 0.421 0.774 4125000 117 0.205 0.314 0.366 0.68 578300 156 0.281 0.316 0.531 0.847 5200000 0 72 29 41 3 1B DH 2B 3B SS SS SS 3B CF SS 44 30 41 103 23 89 57 81 81 51 102 22 54 89 33 30 27 27 32 26 19 12 24 18 4 12 53 7 31 20 18 12 15 41 9 12 29 80 155 39 149 120 167 165 110 185 34 27 33 32 27 16 31 8 14 38 57 27 32 120 27 74 66 56 72 59 118 24 39 85 1 0 4 1 2 8 2 2 1 0 6 5 17 31 8 3 1 11 11 4 2 1 0 1 5 1 5 8 5 2 0 3 7 15 34 43 0 29 33 26 28 62 36 46 28 347 71 149 3 4 138 531 Exercise 3 - Baseball Statistic D E F G H 1 J K L M N o P S V 46 39 85 71 149 43 73 26 28 31 30 25 34 30 14 38 12 14 28 23 25 40 CF SS LF 2B SS 1B RF 1B 44 3 7 0 0 3 1 3 3 4 1 0 0 1 2 1 3 3 3 5 45 13 21 74 128 138 75 114 117 83 88 143 156 156 138 150 140 155 127 52 147 A B 23 Bader, Ha STL 24 Baez, Javi CHC 25 Barnes, A LAD 26 Barnhart, CIN 27 Bauers, Ja CLE 28 Beckham, DET 29 Beckham, SEA 30 Bell, Josh PIT 31 Bellinger, LAD 32 Belt, Bran SF 33 Benintenc BOS 34 Betts, Mo BOS 35 Blackmor COL 36 Bogaerts, BOS 37 Bote, Day CHC 38 Bour, Just LAA 39 Bradley, J BOS 40 Brantley, HOU 41 Braun, Ry MIL 42 Bregman, HOU 43 Brinson, I MIA 44 Bruce, Jay SEA 45 Bryant, K CHC 46 Buxton, B MIN 0.366 0.531 0.34 0.38 0.371 0.372 0.461 0.569 0.629 28 25 32 26 28 34 28 27 32 30 33 37 26 26 LF 347 531 212 316 372 223 304 527 558 526 541 597 580 614 303 151 494 575 459 554 226 165 543 271 54 89 28 32 46 29 39 94 121 76 72 135 112 110 47 18 69 88 70 122 15 27 12 29 5 11 12 6 15 37 47 17 13 29 32 33 11 8 84 48 72 146 170 123 144 176 182 190 78 26 111 179 131 164 39 35 153 71 16 13 21 37 34 32 40 40 42 52 17 5 28 40 31 37 9 43 15 47 116 115 57 68 80 86 117 41 RF CF SS 3B 1B CF LF LF 3B CF RF 3B CF 1 5 3 3 3 5 2 1 11 11 3 1 3 3 1 0 15 4 10 16 2 4 5 0 8 3 11 5 1 1 4 4 14 117 156 56 83 115 68 102 118 108 127 140 101 104 122 93 52 155 66 105 83 5 7 0 0 0 95 83 59 97 40 76 44 17 56 51 34 119 13 16 Q 0 0.205 0.281 0.203 0.231 0.226 0.215 0.237 0.277 0.305 0.234 0.266 0.295 0.314 0.309 0.257 0.172 0.225 0.311 0.285 0.296 0.173 0.212 0.282 0.262 R 0.314 0.316 0.293 0.328 0.312 0.271 0.293 0.367 0.406 0.339 0.343 0.391 0.364 0.384 0.362 0.259 0.317 0.372 0.343 0.423 0.236 0.283 0.382 0.314 T U 0.68 578300 0.847 5200000 0.633 575000 0.708 4000000 0.683 560400 0.643 700000 0.754 1750000 0.936 587000 1.035 605000 0.742 1.5E+07 0.774 717500 0.915 2E+07 0.94 1.8E+07 0.939 1.2E+07 0.784 561500 0.623 2500000 0.738 8550000 0.875 1.6E+07 0.848 1.2E+07 1.015 640500 0.457 570000 0.816 1.3E+07 0.903 1.3E+07 0.827 1750000 0 6 26 62 90 3 2 2 0.403 0.431 0.524 0.576 0.555 0.422 0.364 0.421 0.503 0.505 0.592 0.221 0.533 0.521 0.513 148 21 22 22 41 0 14 144 2 1 1 1 74 156 75 47 147 87 33 29 27 75 112 15 28 77 46 2 1 0 1 4 11 35 30 108 48 31 10 0 0 3 74 19 53 145 68

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_2

Step: 3

blur-text-image_3

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

Discuss the five contemporary communication issues facing managers.

Answered: 1 week ago