Assignment due tonight. Attached
Question 1: predicting the battery power of a mobile phone: Step 1: Load the Sample Dataset (sample.csv) Step 2: Train a linear regression model using the following variables: Dependent variable (y) = battery_power we are trying to predict this variable using the linear regression model First independent variable (X1) = int_memory (it measures the internal memory of the phone) Second independent variable (X2) = mobile_wt (it measures the weight of the phone) Third independent variable (X3) = ram (it measures the phone ram) Fourth independent variable (X4) = talk_time Step 3: provide a list of all parameters (coefficients) of the trained model. Provide a brief explanation of your findings (what is the explanation of the coefficients). Step 4: predict the battery power for the following observation: X_new= [int_memory=20, mobile_wt=150, ram=2,000, talk_time=15] Question 2: predicting the price range of phones: Step 1: Load the Sample Dataset (sample.csv) Step 2: Train a decision tree to predict range of a phone’s price using the following variables: Dependent variable (y) = price_range First Independent variable (X1) = blue (it indicates whether the phone has the Bluetooth technology or not) Second Independent variable (X2) = four_g (does the phone support 4G technology?) Third Independent variable (X3) = n_cores (number of processing cores) Step 3: briefly explain your finding (explain how you have formed the tree and what is the order of questions being asked at each branch of the tree) Step 4: make a prediction for the following observation: X_new=[blue:1, four_g:0, n_core:5] Step 5: draw the tree using the visualization method discussed in the presentation number 10. Submission: For each question, upload the python code (Jupyter notebook or other python formats), in addition to a word document explaining the trained model (coefficients for the linear regression model, and the structure of the decision tree for the second question). For both questions, attach a screenshot of the predicted values for new observations. battery_power,blue,clock_speed,dual_sim,fc,four_g,int_memory,m_dep,mobile_wt,n_cores,pc,px_height,px_width,ram,sc_h,sc_w,talk_time,three_g,touch_screen,wifi,price_range 842,0,2.2,0,1,0,7,0.6,188,2,2,20,756,2549,9,7,19,0,0,1,1 1021,1,0.5,1,0,1,53,0.7,136,3,6,905,1988,2631,17,3,7,1,1,0,2 563,1,0.5,1,2,1,41,0.9,145,5,6,1263,1716,2603,11,2,9,1,1,0,2 615,1,2.5,0,0,0,10,0.8,131,6,9,1216,1786,2769,16,8,11,1,0,0,2 1821,1,1.2,0,13,1,44,0.6,141,2,14,1208,1212,1411,8,2,15,1,1,0,1 1859,0,0.5,1,3,0,22,0.7,164,1,7,1004,1654,1067,17,1,10,1,0,0,1 1821,0,1.7,0,4,1,10,0.8,139,8,10,381,1018,3220,13,8,18,1,0,1,3 1954,0,0.5,1,0,0,24,0.8,187,4,0,512,1149,700,16,3,5,1,1,1,0 1445,1,0.5,0,0,0,53,0.7,174,7,14,386,836,1099,17,1,20,1,0,0,0 509,1,0.6,1,2,1,9,0.1,93,5,15,1137,1224,513,19,10,12,1,0,0,0 769,1,2.9,1,0,0,9,0.1,182,5,1,248,874,3946,5,2,7,0,0,0,3 1520,1,2.2,0,5,1,33,0.5,177,8,18,151,1005,3826,14,9,13,1,1,1,3 1815,0,2.8,0,2,0,33,0.6,159,4,17,607,748,1482,18,0,2,1,0,0,1 803,1,2.1,0,7,0,17,1,198,4,11,344,1440,2680,7,1,4,1,0,1,2 1866,0,0.5,0,13,1,52,0.7,185,1,17,356,563,373,14,9,3,1,0,1,0 775,0,1,0,3,0,46,0.7,159,2,16,862,1864,568,17,15,11,1,1,1,0 838,0,0.5,0,1,1,13,0.1,196,8,4,984,1850,3554,10,9,19,1,0,1,3 595,0,0.9,1,7,1,23,0.1,121,3,17,441,810,3752,10,2,18,1,1,0,3 1131,1,0.5,1,11,0,49,0.6,101,5,18,658,878,1835,19,13,16,1,1,0,1 682,1,0.5,0,4,0,19,1,121,4,11,902,1064,2337,11,1,18,0,1,1,1 772,0,1.1,1,12,0,39,0.8,81,7,14,1314,1854,2819,17,15,3,1,1,0,3 1709,1,2.1,0,1,0,13,1,156,2,2,974,1385,3283,17,1,15,1,0,0,3 1949,0,2.6,1,4,0,47,0.3,199,4,7,407,822,1433,11,5,20,0,0,1,1 1602,1,2.8,1,4,1,38,0.7,114,3,20,466,788,1037,8,7,20,1,0,0,0 503,0,1.2,1,5,1,8,0.4,111,3,13,201,1245,2583,11,0,12,1,0,0,1 961,1,1.4,1,0,1,57,0.6,114,8,3,291,1434,2782,18,9,7,1,1,1,2 519,1,1.6,1,7,1,51,0.3,132,4,19,550,645,3763,16,1,4,1,0,1,3 956,0,0.5,0,1,1,41,1,143,7,6,511,1075,3286,17,8,12,1,1,0,3 1453,0,1.6,1,12,1,52,0.3,96,2,18,187,1311,2373,10,1,10,1,1,1,2 851,0,0.5,0,3,0,21,0.4,200,5,7,1171,1263,478,12,7,10,1,0,1,0 1579,1,0.5,1,0,0,5,0.2,88,7,9,1358,1739,3532,17,11,12,0,0,1,3 1568,1,0.5,0,16,0,33,1,150,8,20,413,654,508,5,1,6,1,1,1,0 1319,1,0.9,0,3,1,41,0.9,107,1,18,85,1152,2227,18,5,3,1,1,1,1 1310,1,2.2,1,0,1,51,0.6,100,4,0,178,1919,3845,7,0,12,1,1,0,3 644,1,2.7,0,0,0,22,0.7,157,8,3,311,881,1262,12,1,15,1,0,0,0 725,0,1.3,1,16,0,60,0.4,160,8,17,1134,1249,1326,10,4,15,1,0,0,1 589,1,2.3,1,1,0,61,0.6,160,4,10,429,815,2113,13,7,2,1,0,1,1 1725,1,1.6,1,6,1,6,0.5,119,2,18,609,1307,3429,6,5,4,1,1,0,3 790,0,2,1,16,1,11,0.3,87,6,17,347,730,3169,6,1,2,1,0,1,2 560,0,0.5,1,15,0,50,0.3,159,2,20,1448,1613,2150,18,12,11,1,1,0,2 1347,0,2.9,0,5,0,44,0.6,132,1,14,434,967,2484,18,2,11,1,0,1,2 1646,1,2.3,0,8,1,41,0.2,185,2,10,1725,1932,3339,18,10,19,1,1,0,3 1253,1,0.5,1,5,1,5,0.2,152,2,19,685,714,1878,15,0,4,1,1,0,1 1656,0,1,0,5,1,34,0.1,166,3,7,880,1456,1629,15,12,14,1,1,0,1 1195,1,2.8,0,1,1,20,0.8,110,2,14,1580,1652,504,9,3,12,1,1,0,0 1514,0,2.9,0,0,0,27,0.2,118,3,1,186,1810,1152,8,3,20,0,1,1,1 1723,1,1.1,1,1,0,42,1,164,8,14,202,1791,3587,10,5,3,1,0,0,3 1054,1,1.8,1,3,1,40,0.8,196,7,10,27,774,2296,16,12,12,1,0,1,1 578,1,2.6,1,2,1,57,0.2,162,8,8,1025,1433,1270,15,3,5,1,0,1,0 596,0,2.1,1,9,0,64,0.8,111,8,15,885,1854,3238,16,13,10,0,0,0,3 1547,1,3,1,2,1,14,0.7,198,3,19,1042,1832,2059,5,0,15,1,0,1,2 1760,0,1.4,1,5,0,63,0.8,127,8,19,1382,1383,2053,19,12,16,0,1,0,2 1654,1,1.5,1,0,1,43,0.3,109,2,0,546,629,3112,12,5,10,1,1,0,3 1457,0,1.9,1,1,1,16,0.3,102,3,10,1013,1287,1440,17,8,12,1,0,1,1 1073,1,0.5,1,0,0,51,0.5,145,7,0,690,804,2908,6,0,18,0,1,0,2 1936,0,2.1,1,10,1,46,0.6,104,3,20,667,1036,2552,14,7,13,1,0,0,2 823,1,2.7,1,13,0,60,0.5,148,8,19,822,1449,905,14,11,17,1,1,1,0 987,0,1.3,1,0,1,61,0.4,107,3,9,581,820,3963,9,4,20,1,0,1,3 1757,0,0.5,0,8,0,49,0.5,180,6,14,265,713,2056,7,5,4,0,0,0,1 1063,0,1.4,1,2,1,48,1,128,5,4,127,683,2910,15,13,9,1,1,1,2 1484,0,3,0,3,0,12,0.6,134,3,5,916,969,1457,14,4,20,1,1,0,1 799,1,2.3,0,1,1,63,0.8,144,8,6,361,975,431,15,6,6,1,1,1,0 1156,1,1.2,1,0,1,50,0.8,159,2,0,322,547,470,7,0,15,1,1,0,0 1720,0,2,0,15,1,55,0.5,168,2,18,753,1353,2148,14,2,5,1,1,1,2 702,0,2.6,1,2,1,9,0.7,141,3,3,504,1570,2955,10,4,19,1,0,0,2 616,0,1.9,1,13,1,44,0.8,81,3,17,651,1618,3366,18,8,13,1,1,0,3 1358,1,0.5,0,11,1,36,0.3,155,4,14,1565,1858,3068,9,4,4,1,1,0,3 1866,0,1.4,0,0,0,30,0.5,182,3,0,108,1781,3834,16,11,8,0,0,0,3 1242,0,1.1,1,0,0,10,0.6,165,2,1,459,1225,1050,11,1,4,1,0,1,0 1166,0,1.5,1,0,1,43,0.8,80,4,1,205,603,3993,7,1,7,1,1,0,3 1448,1,0.5,1,6,1,45,0.8,138,7,11,570,1724,3378,13,11,2,1,1,1,3 1407,1,2.4,0,1,1,22,0.7,104,4,4,1172,1217,2192,9,7,13,1,0,1