diff --git a/your-code/auto-mpg.csv b/your-code/auto-mpg.csv new file mode 100644 index 0000000..b10c25b --- /dev/null +++ b/your-code/auto-mpg.csv @@ -0,0 +1,399 @@ +mpg,cylinders,displacement,horse_power,weight,acceleration,model_year,car_name +18,8,307,130,3504,12,70," ""chevrolet chevelle malibu""" +15,8,350,165,3693,11.5,70," ""buick skylark 320""" +18,8,318,150,3436,11,70," ""plymouth satellite""" +16,8,304,150,3433,12,70," ""amc rebel sst""" +17,8,302,140,3449,10.5,70," ""ford torino""" +15,8,429,198,4341,10,70," ""ford galaxie 500""" +14,8,454,220,4354,9,70," ""chevrolet impala""" +14,8,440,215,4312,8.5,70," ""plymouth fury iii""" +14,8,455,225,4425,10,70," ""pontiac catalina""" +15,8,390,190,3850,8.5,70," ""amc ambassador dpl""" +15,8,383,170,3563,10,70," ""dodge challenger se""" +14,8,340,160,3609,8,70," ""plymouth 'cuda 340""" +15,8,400,150,3761,9.5,70," ""chevrolet monte carlo""" +14,8,455,225,3086,10,70," ""buick estate wagon (sw)""" +24,4,113,95,2372,15,70," ""toyota corona mark ii""" +22,6,198,95,2833,15.5,70," ""plymouth duster""" +18,6,199,97,2774,15.5,70," ""amc hornet""" +21,6,200,85,2587,16,70," ""ford maverick""" +27,4,97,88,2130,14.5,70," ""datsun pl510""" +26,4,97,46,1835,20.5,70," ""volkswagen 1131 deluxe sedan""" +25,4,110,87,2672,17.5,70," ""peugeot 504""" +24,4,107,90,2430,14.5,70," ""audi 100 ls""" +25,4,104,95,2375,17.5,70," ""saab 99e""" +26,4,121,113,2234,12.5,70," ""bmw 2002""" +21,6,199,90,2648,15,70," ""amc gremlin""" +10,8,360,215,4615,14,70," ""ford f250""" +10,8,307,200,4376,15,70," ""chevy c20""" +11,8,318,210,4382,13.5,70," ""dodge d200""" +9,8,304,193,4732,18.5,70," ""hi 1200d""" +27,4,97,88,2130,14.5,71," ""datsun pl510""" +28,4,140,90,2264,15.5,71," ""chevrolet vega 2300""" +25,4,113,95,2228,14,71," ""toyota corona""" +25,4,98,,2046,19,71," ""ford pinto""" +19,6,232,100,2634,13,71," ""amc gremlin""" +16,6,225,105,3439,15.5,71," ""plymouth satellite custom""" +17,6,250,100,3329,15.5,71," ""chevrolet chevelle malibu""" +19,6,250,88,3302,15.5,71," ""ford torino 500""" +18,6,232,100,3288,15.5,71," ""amc matador""" +14,8,350,165,4209,12,71," ""chevrolet impala""" +14,8,400,175,4464,11.5,71," ""pontiac catalina brougham""" +14,8,351,153,4154,13.5,71," ""ford galaxie 500""" +14,8,318,150,4096,13,71," ""plymouth fury iii""" +12,8,383,180,4955,11.5,71," ""dodge monaco (sw)""" +13,8,400,170,4746,12,71," ""ford country squire (sw)""" +13,8,400,175,5140,12,71," ""pontiac safari (sw)""" +18,6,258,110,2962,13.5,71," ""amc hornet sportabout (sw)""" +22,4,140,72,2408,19,71," ""chevrolet vega (sw)""" +19,6,250,100,3282,15,71," ""pontiac firebird""" +18,6,250,88,3139,14.5,71," ""ford mustang""" +23,4,122,86,2220,14,71," ""mercury capri 2000""" +28,4,116,90,2123,14,71," ""opel 1900""" +30,4,79,70,2074,19.5,71," ""peugeot 304""" +30,4,88,76,2065,14.5,71," ""fiat 124b""" +31,4,71,65,1773,19,71," ""toyota corolla 1200""" +35,4,72,69,1613,18,71," ""datsun 1200""" +27,4,97,60,1834,19,71," ""volkswagen model 111""" +26,4,91,70,1955,20.5,71," ""plymouth cricket""" +24,4,113,95,2278,15.5,72," ""toyota corona hardtop""" +25,4,97.5,80,2126,17,72," ""dodge colt hardtop""" +23,4,97,54,2254,23.5,72," ""volkswagen type 3""" +20,4,140,90,2408,19.5,72," ""chevrolet vega""" +21,4,122,86,2226,16.5,72," ""ford pinto runabout""" +13,8,350,165,4274,12,72," ""chevrolet impala""" +14,8,400,175,4385,12,72," ""pontiac catalina""" +15,8,318,150,4135,13.5,72," ""plymouth fury iii""" +14,8,351,153,4129,13,72," ""ford galaxie 500""" +17,8,304,150,3672,11.5,72," ""amc ambassador sst""" +11,8,429,208,4633,11,72," ""mercury marquis""" +13,8,350,155,4502,13.5,72," ""buick lesabre custom""" +12,8,350,160,4456,13.5,72," ""oldsmobile delta 88 royale""" +13,8,400,190,4422,12.5,72," ""chrysler newport royal""" +19,3,70,97,2330,13.5,72," ""mazda rx2 coupe""" +15,8,304,150,3892,12.5,72," ""amc matador (sw)""" +13,8,307,130,4098,14,72," ""chevrolet chevelle concours (sw)""" +13,8,302,140,4294,16,72," ""ford gran torino (sw)""" +14,8,318,150,4077,14,72," ""plymouth satellite custom (sw)""" +18,4,121,112,2933,14.5,72," ""volvo 145e (sw)""" +22,4,121,76,2511,18,72," ""volkswagen 411 (sw)""" +21,4,120,87,2979,19.5,72," ""peugeot 504 (sw)""" +26,4,96,69,2189,18,72," ""renault 12 (sw)""" +22,4,122,86,2395,16,72," ""ford pinto (sw)""" +28,4,97,92,2288,17,72," ""datsun 510 (sw)""" +23,4,120,97,2506,14.5,72," ""toyouta corona mark ii (sw)""" +28,4,98,80,2164,15,72," ""dodge colt (sw)""" +27,4,97,88,2100,16.5,72," ""toyota corolla 1600 (sw)""" +13,8,350,175,4100,13,73," ""buick century 350""" +14,8,304,150,3672,11.5,73," ""amc matador""" +13,8,350,145,3988,13,73," ""chevrolet malibu""" +14,8,302,137,4042,14.5,73," ""ford gran torino""" +15,8,318,150,3777,12.5,73," ""dodge coronet custom""" +12,8,429,198,4952,11.5,73," ""mercury marquis brougham""" +13,8,400,150,4464,12,73," ""chevrolet caprice classic""" +13,8,351,158,4363,13,73," ""ford ltd""" +14,8,318,150,4237,14.5,73," ""plymouth fury gran sedan""" +13,8,440,215,4735,11,73," ""chrysler new yorker brougham""" +12,8,455,225,4951,11,73," ""buick electra 225 custom""" +13,8,360,175,3821,11,73," ""amc ambassador brougham""" +18,6,225,105,3121,16.5,73," ""plymouth valiant""" +16,6,250,100,3278,18,73," ""chevrolet nova custom""" +18,6,232,100,2945,16,73," ""amc hornet""" +18,6,250,88,3021,16.5,73," ""ford maverick""" +23,6,198,95,2904,16,73," ""plymouth duster""" +26,4,97,46,1950,21,73," ""volkswagen super beetle""" +11,8,400,150,4997,14,73," ""chevrolet impala""" +12,8,400,167,4906,12.5,73," ""ford country""" +13,8,360,170,4654,13,73," ""plymouth custom suburb""" +12,8,350,180,4499,12.5,73," ""oldsmobile vista cruiser""" +18,6,232,100,2789,15,73," ""amc gremlin""" +20,4,97,88,2279,19,73," ""toyota carina""" +21,4,140,72,2401,19.5,73," ""chevrolet vega""" +22,4,108,94,2379,16.5,73," ""datsun 610""" +18,3,70,90,2124,13.5,73," ""maxda rx3""" +19,4,122,85,2310,18.5,73," ""ford pinto""" +21,6,155,107,2472,14,73," ""mercury capri v6""" +26,4,98,90,2265,15.5,73," ""fiat 124 sport coupe""" +15,8,350,145,4082,13,73," ""chevrolet monte carlo s""" +16,8,400,230,4278,9.5,73," ""pontiac grand prix""" +29,4,68,49,1867,19.5,73," ""fiat 128""" +24,4,116,75,2158,15.5,73," ""opel manta""" +20,4,114,91,2582,14,73," ""audi 100ls""" +19,4,121,112,2868,15.5,73," ""volvo 144ea""" +15,8,318,150,3399,11,73," ""dodge dart custom""" +24,4,121,110,2660,14,73," ""saab 99le""" +20,6,156,122,2807,13.5,73," ""toyota mark ii""" +11,8,350,180,3664,11,73," ""oldsmobile omega""" +20,6,198,95,3102,16.5,74," ""plymouth duster""" +21,6,200,,2875,17,74," ""ford maverick""" +19,6,232,100,2901,16,74," ""amc hornet""" +15,6,250,100,3336,17,74," ""chevrolet nova""" +31,4,79,67,1950,19,74," ""datsun b210""" +26,4,122,80,2451,16.5,74," ""ford pinto""" +32,4,71,65,1836,21,74," ""toyota corolla 1200""" +25,4,140,75,2542,17,74," ""chevrolet vega""" +16,6,250,100,3781,17,74," ""chevrolet chevelle malibu classic""" +16,6,258,110,3632,18,74," ""amc matador""" +18,6,225,105,3613,16.5,74," ""plymouth satellite sebring""" +16,8,302,140,4141,14,74," ""ford gran torino""" +13,8,350,150,4699,14.5,74," ""buick century luxus (sw)""" +14,8,318,150,4457,13.5,74," ""dodge coronet custom (sw)""" +14,8,302,140,4638,16,74," ""ford gran torino (sw)""" +14,8,304,150,4257,15.5,74," ""amc matador (sw)""" +29,4,98,83,2219,16.5,74," ""audi fox""" +26,4,79,67,1963,15.5,74," ""volkswagen dasher""" +26,4,97,78,2300,14.5,74," ""opel manta""" +31,4,76,52,1649,16.5,74," ""toyota corona""" +32,4,83,61,2003,19,74," ""datsun 710""" +28,4,90,75,2125,14.5,74," ""dodge colt""" +24,4,90,75,2108,15.5,74," ""fiat 128""" +26,4,116,75,2246,14,74," ""fiat 124 tc""" +24,4,120,97,2489,15,74," ""honda civic""" +26,4,108,93,2391,15.5,74," ""subaru""" +31,4,79,67,2000,16,74," ""fiat x1.9""" +19,6,225,95,3264,16,75," ""plymouth valiant custom""" +18,6,250,105,3459,16,75," ""chevrolet nova""" +15,6,250,72,3432,21,75," ""mercury monarch""" +15,6,250,72,3158,19.5,75," ""ford maverick""" +16,8,400,170,4668,11.5,75," ""pontiac catalina""" +15,8,350,145,4440,14,75," ""chevrolet bel air""" +16,8,318,150,4498,14.5,75," ""plymouth grand fury""" +14,8,351,148,4657,13.5,75," ""ford ltd""" +17,6,231,110,3907,21,75," ""buick century""" +16,6,250,105,3897,18.5,75," ""chevroelt chevelle malibu""" +15,6,258,110,3730,19,75," ""amc matador""" +18,6,225,95,3785,19,75," ""plymouth fury""" +21,6,231,110,3039,15,75," ""buick skyhawk""" +20,8,262,110,3221,13.5,75," ""chevrolet monza 2+2""" +13,8,302,129,3169,12,75," ""ford mustang ii""" +29,4,97,75,2171,16,75," ""toyota corolla""" +23,4,140,83,2639,17,75," ""ford pinto""" +20,6,232,100,2914,16,75," ""amc gremlin""" +23,4,140,78,2592,18.5,75," ""pontiac astro""" +24,4,134,96,2702,13.5,75," ""toyota corona""" +25,4,90,71,2223,16.5,75," ""volkswagen dasher""" +24,4,119,97,2545,17,75," ""datsun 710""" +18,6,171,97,2984,14.5,75," ""ford pinto""" +29,4,90,70,1937,14,75," ""volkswagen rabbit""" +19,6,232,90,3211,17,75," ""amc pacer""" +23,4,115,95,2694,15,75," ""audi 100ls""" +23,4,120,88,2957,17,75," ""peugeot 504""" +22,4,121,98,2945,14.5,75," ""volvo 244dl""" +25,4,121,115,2671,13.5,75," ""saab 99le""" +33,4,91,53,1795,17.5,75," ""honda civic cvcc""" +28,4,107,86,2464,15.5,76," ""fiat 131""" +25,4,116,81,2220,16.9,76," ""opel 1900""" +25,4,140,92,2572,14.9,76," ""capri ii""" +26,4,98,79,2255,17.7,76," ""dodge colt""" +27,4,101,83,2202,15.3,76," ""renault 12tl""" +17.5,8,305,140,4215,13,76," ""chevrolet chevelle malibu classic""" +16,8,318,150,4190,13,76," ""dodge coronet brougham""" +15.5,8,304,120,3962,13.9,76," ""amc matador""" +14.5,8,351,152,4215,12.8,76," ""ford gran torino""" +22,6,225,100,3233,15.4,76," ""plymouth valiant""" +22,6,250,105,3353,14.5,76," ""chevrolet nova""" +24,6,200,81,3012,17.6,76," ""ford maverick""" +22.5,6,232,90,3085,17.6,76," ""amc hornet""" +29,4,85,52,2035,22.2,76," ""chevrolet chevette""" +24.5,4,98,60,2164,22.1,76," ""chevrolet woody""" +29,4,90,70,1937,14.2,76," ""vw rabbit""" +33,4,91,53,1795,17.4,76," ""honda civic""" +20,6,225,100,3651,17.7,76," ""dodge aspen se""" +18,6,250,78,3574,21,76," ""ford granada ghia""" +18.5,6,250,110,3645,16.2,76," ""pontiac ventura sj""" +17.5,6,258,95,3193,17.8,76," ""amc pacer d/l""" +29.5,4,97,71,1825,12.2,76," ""volkswagen rabbit""" +32,4,85,70,1990,17,76," ""datsun b-210""" +28,4,97,75,2155,16.4,76," ""toyota corolla""" +26.5,4,140,72,2565,13.6,76," ""ford pinto""" +20,4,130,102,3150,15.7,76," ""volvo 245""" +13,8,318,150,3940,13.2,76," ""plymouth volare premier v8""" +19,4,120,88,3270,21.9,76," ""peugeot 504""" +19,6,156,108,2930,15.5,76," ""toyota mark ii""" +16.5,6,168,120,3820,16.7,76," ""mercedes-benz 280s""" +16.5,8,350,180,4380,12.1,76," ""cadillac seville""" +13,8,350,145,4055,12,76," ""chevy c10""" +13,8,302,130,3870,15,76," ""ford f108""" +13,8,318,150,3755,14,76," ""dodge d100""" +31.5,4,98,68,2045,18.5,77," ""honda accord cvcc""" +30,4,111,80,2155,14.8,77," ""buick opel isuzu deluxe""" +36,4,79,58,1825,18.6,77," ""renault 5 gtl""" +25.5,4,122,96,2300,15.5,77," ""plymouth arrow gs""" +33.5,4,85,70,1945,16.8,77," ""datsun f-10 hatchback""" +17.5,8,305,145,3880,12.5,77," ""chevrolet caprice classic""" +17,8,260,110,4060,19,77," ""oldsmobile cutlass supreme""" +15.5,8,318,145,4140,13.7,77," ""dodge monaco brougham""" +15,8,302,130,4295,14.9,77," ""mercury cougar brougham""" +17.5,6,250,110,3520,16.4,77," ""chevrolet concours""" +20.5,6,231,105,3425,16.9,77," ""buick skylark""" +19,6,225,100,3630,17.7,77," ""plymouth volare custom""" +18.5,6,250,98,3525,19,77," ""ford granada""" +16,8,400,180,4220,11.1,77," ""pontiac grand prix lj""" +15.5,8,350,170,4165,11.4,77," ""chevrolet monte carlo landau""" +15.5,8,400,190,4325,12.2,77," ""chrysler cordoba""" +16,8,351,149,4335,14.5,77," ""ford thunderbird""" +29,4,97,78,1940,14.5,77," ""volkswagen rabbit custom""" +24.5,4,151,88,2740,16,77," ""pontiac sunbird coupe""" +26,4,97,75,2265,18.2,77," ""toyota corolla liftback""" +25.5,4,140,89,2755,15.8,77," ""ford mustang ii 2+2""" +30.5,4,98,63,2051,17,77," ""chevrolet chevette""" +33.5,4,98,83,2075,15.9,77," ""dodge colt m/m""" +30,4,97,67,1985,16.4,77," ""subaru dl""" +30.5,4,97,78,2190,14.1,77," ""volkswagen dasher""" +22,6,146,97,2815,14.5,77," ""datsun 810""" +21.5,4,121,110,2600,12.8,77," ""bmw 320i""" +21.5,3,80,110,2720,13.5,77," ""mazda rx-4""" +43.1,4,90,48,1985,21.5,78," ""volkswagen rabbit custom diesel""" +36.1,4,98,66,1800,14.4,78," ""ford fiesta""" +32.8,4,78,52,1985,19.4,78," ""mazda glc deluxe""" +39.4,4,85,70,2070,18.6,78," ""datsun b210 gx""" +36.1,4,91,60,1800,16.4,78," ""honda civic cvcc""" +19.9,8,260,110,3365,15.5,78," ""oldsmobile cutlass salon brougham""" +19.4,8,318,140,3735,13.2,78," ""dodge diplomat""" +20.2,8,302,139,3570,12.8,78," ""mercury monarch ghia""" +19.2,6,231,105,3535,19.2,78," ""pontiac phoenix lj""" +20.5,6,200,95,3155,18.2,78," ""chevrolet malibu""" +20.2,6,200,85,2965,15.8,78," ""ford fairmont (auto)""" +25.1,4,140,88,2720,15.4,78," ""ford fairmont (man)""" +20.5,6,225,100,3430,17.2,78," ""plymouth volare""" +19.4,6,232,90,3210,17.2,78," ""amc concord""" +20.6,6,231,105,3380,15.8,78," ""buick century special""" +20.8,6,200,85,3070,16.7,78," ""mercury zephyr""" +18.6,6,225,110,3620,18.7,78," ""dodge aspen""" +18.1,6,258,120,3410,15.1,78," ""amc concord d/l""" +19.2,8,305,145,3425,13.2,78," ""chevrolet monte carlo landau""" +17.7,6,231,165,3445,13.4,78," ""buick regal sport coupe (turbo)""" +18.1,8,302,139,3205,11.2,78," ""ford futura""" +17.5,8,318,140,4080,13.7,78," ""dodge magnum xe""" +30,4,98,68,2155,16.5,78," ""chevrolet chevette""" +27.5,4,134,95,2560,14.2,78," ""toyota corona""" +27.2,4,119,97,2300,14.7,78," ""datsun 510""" +30.9,4,105,75,2230,14.5,78," ""dodge omni""" +21.1,4,134,95,2515,14.8,78," ""toyota celica gt liftback""" +23.2,4,156,105,2745,16.7,78," ""plymouth sapporo""" +23.8,4,151,85,2855,17.6,78," ""oldsmobile starfire sx""" +23.9,4,119,97,2405,14.9,78," ""datsun 200-sx""" +20.3,5,131,103,2830,15.9,78," ""audi 5000""" +17,6,163,125,3140,13.6,78," ""volvo 264gl""" +21.6,4,121,115,2795,15.7,78," ""saab 99gle""" +16.2,6,163,133,3410,15.8,78," ""peugeot 604sl""" +31.5,4,89,71,1990,14.9,78," ""volkswagen scirocco""" +29.5,4,98,68,2135,16.6,78," ""honda accord lx""" +21.5,6,231,115,3245,15.4,79," ""pontiac lemans v6""" +19.8,6,200,85,2990,18.2,79," ""mercury zephyr 6""" +22.3,4,140,88,2890,17.3,79," ""ford fairmont 4""" +20.2,6,232,90,3265,18.2,79," ""amc concord dl 6""" +20.6,6,225,110,3360,16.6,79," ""dodge aspen 6""" +17,8,305,130,3840,15.4,79," ""chevrolet caprice classic""" +17.6,8,302,129,3725,13.4,79," ""ford ltd landau""" +16.5,8,351,138,3955,13.2,79," ""mercury grand marquis""" +18.2,8,318,135,3830,15.2,79," ""dodge st. regis""" +16.9,8,350,155,4360,14.9,79," ""buick estate wagon (sw)""" +15.5,8,351,142,4054,14.3,79," ""ford country squire (sw)""" +19.2,8,267,125,3605,15,79," ""chevrolet malibu classic (sw)""" +18.5,8,360,150,3940,13,79," ""chrysler lebaron town @ country (sw)""" +31.9,4,89,71,1925,14,79," ""vw rabbit custom""" +34.1,4,86,65,1975,15.2,79," ""maxda glc deluxe""" +35.7,4,98,80,1915,14.4,79," ""dodge colt hatchback custom""" +27.4,4,121,80,2670,15,79," ""amc spirit dl""" +25.4,5,183,77,3530,20.1,79," ""mercedes benz 300d""" +23,8,350,125,3900,17.4,79," ""cadillac eldorado""" +27.2,4,141,71,3190,24.8,79," ""peugeot 504""" +23.9,8,260,90,3420,22.2,79," ""oldsmobile cutlass salon brougham""" +34.2,4,105,70,2200,13.2,79," ""plymouth horizon""" +34.5,4,105,70,2150,14.9,79," ""plymouth horizon tc3""" +31.8,4,85,65,2020,19.2,79," ""datsun 210""" +37.3,4,91,69,2130,14.7,79," ""fiat strada custom""" +28.4,4,151,90,2670,16,79," ""buick skylark limited""" +28.8,6,173,115,2595,11.3,79," ""chevrolet citation""" +26.8,6,173,115,2700,12.9,79," ""oldsmobile omega brougham""" +33.5,4,151,90,2556,13.2,79," ""pontiac phoenix""" +41.5,4,98,76,2144,14.7,80," ""vw rabbit""" +38.1,4,89,60,1968,18.8,80," ""toyota corolla tercel""" +32.1,4,98,70,2120,15.5,80," ""chevrolet chevette""" +37.2,4,86,65,2019,16.4,80," ""datsun 310""" +28,4,151,90,2678,16.5,80," ""chevrolet citation""" +26.4,4,140,88,2870,18.1,80," ""ford fairmont""" +24.3,4,151,90,3003,20.1,80," ""amc concord""" +19.1,6,225,90,3381,18.7,80," ""dodge aspen""" +34.3,4,97,78,2188,15.8,80," ""audi 4000""" +29.8,4,134,90,2711,15.5,80," ""toyota corona liftback""" +31.3,4,120,75,2542,17.5,80," ""mazda 626""" +37,4,119,92,2434,15,80," ""datsun 510 hatchback""" +32.2,4,108,75,2265,15.2,80," ""toyota corolla""" +46.6,4,86,65,2110,17.9,80," ""mazda glc""" +27.9,4,156,105,2800,14.4,80," ""dodge colt""" +40.8,4,85,65,2110,19.2,80," ""datsun 210""" +44.3,4,90,48,2085,21.7,80," ""vw rabbit c (diesel)""" +43.4,4,90,48,2335,23.7,80," ""vw dasher (diesel)""" +36.4,5,121,67,2950,19.9,80," ""audi 5000s (diesel)""" +30,4,146,67,3250,21.8,80," ""mercedes-benz 240d""" +44.6,4,91,67,1850,13.8,80," ""honda civic 1500 gl""" +40.9,4,85,,1835,17.3,80," ""renault lecar deluxe""" +33.8,4,97,67,2145,18,80," ""subaru dl""" +29.8,4,89,62,1845,15.3,80," ""vokswagen rabbit""" +32.7,6,168,132,2910,11.4,80," ""datsun 280-zx""" +23.7,3,70,100,2420,12.5,80," ""mazda rx-7 gs""" +35,4,122,88,2500,15.1,80," ""triumph tr7 coupe""" +23.6,4,140,,2905,14.3,80," ""ford mustang cobra""" +32.4,4,107,72,2290,17,80," ""honda accord""" +27.2,4,135,84,2490,15.7,81," ""plymouth reliant""" +26.6,4,151,84,2635,16.4,81," ""buick skylark""" +25.8,4,156,92,2620,14.4,81," ""dodge aries wagon (sw)""" +23.5,6,173,110,2725,12.6,81," ""chevrolet citation""" +30,4,135,84,2385,12.9,81," ""plymouth reliant""" +39.1,4,79,58,1755,16.9,81," ""toyota starlet""" +39,4,86,64,1875,16.4,81," ""plymouth champ""" +35.1,4,81,60,1760,16.1,81," ""honda civic 1300""" +32.3,4,97,67,2065,17.8,81," ""subaru""" +37,4,85,65,1975,19.4,81," ""datsun 210 mpg""" +37.7,4,89,62,2050,17.3,81," ""toyota tercel""" +34.1,4,91,68,1985,16,81," ""mazda glc 4""" +34.7,4,105,63,2215,14.9,81," ""plymouth horizon 4""" +34.4,4,98,65,2045,16.2,81," ""ford escort 4w""" +29.9,4,98,65,2380,20.7,81," ""ford escort 2h""" +33,4,105,74,2190,14.2,81," ""volkswagen jetta""" +34.5,4,100,,2320,15.8,81," ""renault 18i""" +33.7,4,107,75,2210,14.4,81," ""honda prelude""" +32.4,4,108,75,2350,16.8,81," ""toyota corolla""" +32.9,4,119,100,2615,14.8,81," ""datsun 200sx""" +31.6,4,120,74,2635,18.3,81," ""mazda 626""" +28.1,4,141,80,3230,20.4,81," ""peugeot 505s turbo diesel""" +30.7,6,145,76,3160,19.6,81," ""volvo diesel""" +25.4,6,168,116,2900,12.6,81," ""toyota cressida""" +24.2,6,146,120,2930,13.8,81," ""datsun 810 maxima""" +22.4,6,231,110,3415,15.8,81," ""buick century""" +26.6,8,350,105,3725,19,81," ""oldsmobile cutlass ls""" +20.2,6,200,88,3060,17.1,81," ""ford granada gl""" +17.6,6,225,85,3465,16.6,81," ""chrysler lebaron salon""" +28,4,112,88,2605,19.6,82," ""chevrolet cavalier""" +27,4,112,88,2640,18.6,82," ""chevrolet cavalier wagon""" +34,4,112,88,2395,18,82," ""chevrolet cavalier 2-door""" +31,4,112,85,2575,16.2,82," ""pontiac j2000 se hatchback""" +29,4,135,84,2525,16,82," ""dodge aries se""" +27,4,151,90,2735,18,82," ""pontiac phoenix""" +24,4,140,92,2865,16.4,82," ""ford fairmont futura""" +23,4,151,,3035,20.5,82," ""amc concord dl""" +36,4,105,74,1980,15.3,82," ""volkswagen rabbit l""" +37,4,91,68,2025,18.2,82," ""mazda glc custom l""" +31,4,91,68,1970,17.6,82," ""mazda glc custom""" +38,4,105,63,2125,14.7,82," ""plymouth horizon miser""" +36,4,98,70,2125,17.3,82," ""mercury lynx l""" +36,4,120,88,2160,14.5,82," ""nissan stanza xe""" +36,4,107,75,2205,14.5,82," ""honda accord""" +34,4,108,70,2245,16.9,82," ""toyota corolla""" +38,4,91,67,1965,15,82," ""honda civic""" +32,4,91,67,1965,15.7,82," ""honda civic (auto)""" +38,4,91,67,1995,16.2,82," ""datsun 310 gx""" +25,6,181,110,2945,16.4,82," ""buick century limited""" +38,6,262,85,3015,17,82," ""oldsmobile cutlass ciera (diesel)""" +26,4,156,92,2585,14.5,82," ""chrysler lebaron medallion""" +22,6,232,112,2835,14.7,82," ""ford granada l""" +32,4,144,96,2665,13.9,82," ""toyota celica gt""" +36,4,135,84,2370,13,82," ""dodge charger 2.2""" +27,4,151,90,2950,17.3,82," ""chevrolet camaro""" +27,4,140,86,2790,15.6,82," ""ford mustang gl""" +44,4,97,52,2130,24.6,82," ""vw pickup""" +32,4,135,84,2295,11.6,82," ""dodge rampage""" +28,4,120,79,2625,18.6,82," ""ford ranger""" +31,4,119,82,2720,19.4,82," ""chevy s-10""" diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 8a9fa9e..196d8d4 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -12,11 +12,14 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ - "# Import your libraries:\n" + "# Import your libraries:\n", + "import pandas as pd\n", + "import numpy as np\n", + "from sklearn.datasets import load_diabetes" ] }, { @@ -37,11 +40,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "\n", + "diabetes = load_diabetes()" ] }, { @@ -53,11 +58,92 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'data': array([[ 0.03807591, 0.05068012, 0.06169621, ..., -0.00259226,\n", + " 0.01990749, -0.01764613],\n", + " [-0.00188202, -0.04464164, -0.05147406, ..., -0.03949338,\n", + " -0.06833155, -0.09220405],\n", + " [ 0.08529891, 0.05068012, 0.04445121, ..., -0.00259226,\n", + " 0.00286131, -0.02593034],\n", + " ...,\n", + " [ 0.04170844, 0.05068012, -0.01590626, ..., -0.01107952,\n", + " -0.04688253, 0.01549073],\n", + " [-0.04547248, -0.04464164, 0.03906215, ..., 0.02655962,\n", + " 0.04452873, -0.02593034],\n", + " [-0.04547248, -0.04464164, -0.0730303 , ..., -0.03949338,\n", + " -0.00422151, 0.00306441]]),\n", + " 'target': array([151., 75., 141., 206., 135., 97., 138., 63., 110., 310., 101.,\n", + " 69., 179., 185., 118., 171., 166., 144., 97., 168., 68., 49.,\n", + " 68., 245., 184., 202., 137., 85., 131., 283., 129., 59., 341.,\n", + " 87., 65., 102., 265., 276., 252., 90., 100., 55., 61., 92.,\n", + " 259., 53., 190., 142., 75., 142., 155., 225., 59., 104., 182.,\n", + " 128., 52., 37., 170., 170., 61., 144., 52., 128., 71., 163.,\n", + " 150., 97., 160., 178., 48., 270., 202., 111., 85., 42., 170.,\n", + " 200., 252., 113., 143., 51., 52., 210., 65., 141., 55., 134.,\n", + " 42., 111., 98., 164., 48., 96., 90., 162., 150., 279., 92.,\n", + " 83., 128., 102., 302., 198., 95., 53., 134., 144., 232., 81.,\n", + " 104., 59., 246., 297., 258., 229., 275., 281., 179., 200., 200.,\n", + " 173., 180., 84., 121., 161., 99., 109., 115., 268., 274., 158.,\n", + " 107., 83., 103., 272., 85., 280., 336., 281., 118., 317., 235.,\n", + " 60., 174., 259., 178., 128., 96., 126., 288., 88., 292., 71.,\n", + " 197., 186., 25., 84., 96., 195., 53., 217., 172., 131., 214.,\n", + " 59., 70., 220., 268., 152., 47., 74., 295., 101., 151., 127.,\n", + " 237., 225., 81., 151., 107., 64., 138., 185., 265., 101., 137.,\n", + " 143., 141., 79., 292., 178., 91., 116., 86., 122., 72., 129.,\n", + " 142., 90., 158., 39., 196., 222., 277., 99., 196., 202., 155.,\n", + " 77., 191., 70., 73., 49., 65., 263., 248., 296., 214., 185.,\n", + " 78., 93., 252., 150., 77., 208., 77., 108., 160., 53., 220.,\n", + " 154., 259., 90., 246., 124., 67., 72., 257., 262., 275., 177.,\n", + " 71., 47., 187., 125., 78., 51., 258., 215., 303., 243., 91.,\n", + " 150., 310., 153., 346., 63., 89., 50., 39., 103., 308., 116.,\n", + " 145., 74., 45., 115., 264., 87., 202., 127., 182., 241., 66.,\n", + " 94., 283., 64., 102., 200., 265., 94., 230., 181., 156., 233.,\n", + " 60., 219., 80., 68., 332., 248., 84., 200., 55., 85., 89.,\n", + " 31., 129., 83., 275., 65., 198., 236., 253., 124., 44., 172.,\n", + " 114., 142., 109., 180., 144., 163., 147., 97., 220., 190., 109.,\n", + " 191., 122., 230., 242., 248., 249., 192., 131., 237., 78., 135.,\n", + " 244., 199., 270., 164., 72., 96., 306., 91., 214., 95., 216.,\n", + " 263., 178., 113., 200., 139., 139., 88., 148., 88., 243., 71.,\n", + " 77., 109., 272., 60., 54., 221., 90., 311., 281., 182., 321.,\n", + " 58., 262., 206., 233., 242., 123., 167., 63., 197., 71., 168.,\n", + " 140., 217., 121., 235., 245., 40., 52., 104., 132., 88., 69.,\n", + " 219., 72., 201., 110., 51., 277., 63., 118., 69., 273., 258.,\n", + " 43., 198., 242., 232., 175., 93., 168., 275., 293., 281., 72.,\n", + " 140., 189., 181., 209., 136., 261., 113., 131., 174., 257., 55.,\n", + " 84., 42., 146., 212., 233., 91., 111., 152., 120., 67., 310.,\n", + " 94., 183., 66., 173., 72., 49., 64., 48., 178., 104., 132.,\n", + " 220., 57.]),\n", + " 'frame': None,\n", + " 'DESCR': '.. _diabetes_dataset:\\n\\nDiabetes dataset\\n----------------\\n\\nTen baseline variables, age, sex, body mass index, average blood\\npressure, and six blood serum measurements were obtained for each of n =\\n442 diabetes patients, as well as the response of interest, a\\nquantitative measure of disease progression one year after baseline.\\n\\n**Data Set Characteristics:**\\n\\n :Number of Instances: 442\\n\\n :Number of Attributes: First 10 columns are numeric predictive values\\n\\n :Target: Column 11 is a quantitative measure of disease progression one year after baseline\\n\\n :Attribute Information:\\n - age age in years\\n - sex\\n - bmi body mass index\\n - bp average blood pressure\\n - s1 tc, total serum cholesterol\\n - s2 ldl, low-density lipoproteins\\n - s3 hdl, high-density lipoproteins\\n - s4 tch, total cholesterol / HDL\\n - s5 ltg, possibly log of serum triglycerides level\\n - s6 glu, blood sugar level\\n\\nNote: Each of these 10 feature variables have been mean centered and scaled by the standard deviation times the square root of `n_samples` (i.e. the sum of squares of each column totals 1).\\n\\nSource URL:\\nhttps://www4.stat.ncsu.edu/~boos/var.select/diabetes.html\\n\\nFor more information see:\\nBradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani (2004) \"Least Angle Regression,\" Annals of Statistics (with discussion), 407-499.\\n(https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf)\\n',\n", + " 'feature_names': ['age',\n", + " 'sex',\n", + " 'bmi',\n", + " 'bp',\n", + " 's1',\n", + " 's2',\n", + " 's3',\n", + " 's4',\n", + " 's5',\n", + " 's6'],\n", + " 'data_filename': 'diabetes_data_raw.csv.gz',\n", + " 'target_filename': 'diabetes_target.csv.gz',\n", + " 'data_module': 'sklearn.datasets.data'}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "diabetes" ] }, { @@ -73,13 +159,61 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { "scrolled": false }, - "outputs": [], - "source": [ - "# Your code here:\n" + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + ".. _diabetes_dataset:\n", + "\n", + "Diabetes dataset\n", + "----------------\n", + "\n", + "Ten baseline variables, age, sex, body mass index, average blood\n", + "pressure, and six blood serum measurements were obtained for each of n =\n", + "442 diabetes patients, as well as the response of interest, a\n", + "quantitative measure of disease progression one year after baseline.\n", + "\n", + "**Data Set Characteristics:**\n", + "\n", + " :Number of Instances: 442\n", + "\n", + " :Number of Attributes: First 10 columns are numeric predictive values\n", + "\n", + " :Target: Column 11 is a quantitative measure of disease progression one year after baseline\n", + "\n", + " :Attribute Information:\n", + " - age age in years\n", + " - sex\n", + " - bmi body mass index\n", + " - bp average blood pressure\n", + " - s1 tc, total serum cholesterol\n", + " - s2 ldl, low-density lipoproteins\n", + " - s3 hdl, high-density lipoproteins\n", + " - s4 tch, total cholesterol / HDL\n", + " - s5 ltg, possibly log of serum triglycerides level\n", + " - s6 glu, blood sugar level\n", + "\n", + "Note: Each of these 10 feature variables have been mean centered and scaled by the standard deviation times the square root of `n_samples` (i.e. the sum of squares of each column totals 1).\n", + "\n", + "Source URL:\n", + "https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html\n", + "\n", + "For more information see:\n", + "Bradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani (2004) \"Least Angle Regression,\" Annals of Statistics (with discussion), 407-499.\n", + "(https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf)\n", + "\n" + ] + } + ], + "source": [ + "# Your code here:\n", + "\n", + "print(diabetes[\"DESCR\"])" ] }, { @@ -97,11 +231,15 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ - "# Enter your answer here:\n" + "# Enter your answer here:\n", + "\n", + "# 1 - Ten baseline variables, age, sex, body mass index, average blood pressure, and six blood serum measurements\n", + "# 2 - Based on the former data the latter data (target) is caused (or predicted when running the model)\n", + "# 3 - 442" ] }, { @@ -115,11 +253,44 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(442, 10)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "diabetes[\"data\"].shape" + ] + }, + { + "cell_type": "code", + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(442,)" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# Your code here:\n" + "diabetes[\"target\"].shape" ] }, { @@ -156,11 +327,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "from sklearn.linear_model import LinearRegression" ] }, { @@ -172,11 +344,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "\n", + "diabetes_model = LinearRegression()" ] }, { @@ -190,11 +364,14 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "from sklearn.model_selection import train_test_split\n", + "\n", + "diabetes_data_train, diabetes_data_test, diabetes_target_train, diabetes_target_test = train_test_split(diabetes[\"data\"], diabetes[\"target\"], test_size = 0.2)" ] }, { @@ -206,11 +383,27 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
LinearRegression()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "LinearRegression()" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "diabetes_model.fit(diabetes_data_train, diabetes_target_train)" ] }, { @@ -231,11 +424,46 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([124.48837636, 82.95703739, 179.27915692, 89.91551512,\n", + " 135.26646041, 114.33807269, 78.61673903, 52.6496655 ,\n", + " 252.08073044, 104.86850728, 115.17357375, 80.4694378 ,\n", + " 122.84168123, 160.12278671, 152.06773963, 180.12436318,\n", + " 118.45760798, 133.23491682, 139.80611823, 149.90364351,\n", + " 54.43593935, 132.56289429, 150.05140168, 168.22928243,\n", + " 167.78330834, 217.4635251 , 143.46996913, 72.06233752,\n", + " 155.21892202, 188.75360215, 144.86617584, 98.82668362,\n", + " 90.95501914, 91.63541946, 224.67455762, 74.8365555 ,\n", + " 194.27481772, 196.38019901, 173.5934069 , 127.82013478,\n", + " 123.81722274, 224.35411612, 155.90067244, 88.58497273,\n", + " 105.12870112, 116.19589291, 124.83027714, 120.79181039,\n", + " 57.09637084, 70.41907684, 114.71108951, 152.66328709,\n", + " 136.73892569, 165.73168318, 160.77928458, 80.12469142,\n", + " 168.28663367, 161.75625961, 177.65982173, 189.6106847 ,\n", + " 68.63803476, 172.07991924, 157.85547546, 232.16632043,\n", + " 186.48709863, 287.32437971, 56.32424838, 146.79434222,\n", + " 255.0926594 , 94.16108012, 170.0788033 , 126.39647803,\n", + " 223.74571002, 195.4536252 , 245.39751551, 139.2794066 ,\n", + " 209.00712594, 190.75212935, 102.22448402, 129.27856191,\n", + " 221.17107805, 228.68263103, 189.24226698, 160.73697774,\n", + " 257.82092496, 89.47026114, 183.37297877, 112.2991051 ,\n", + " 252.2236205 ])" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "diabetes_model.predict(diabetes_data_test)" ] }, { @@ -247,11 +475,51 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[168. 53. 180. 93. 59. 71. 77. 90. 336. 129. 87. 71. 113. 198.\n", + " 55. 277. 68. 214. 50. 150. 63. 49. 200. 131. 141. 192. 116. 104.\n", + " 200. 67. 202. 118. 113. 115. 257. 75. 292. 221. 190. 191. 44. 208.\n", + " 185. 96. 84. 160. 51. 214. 65. 59. 64. 246. 219. 109. 262. 89.\n", + " 235. 196. 143. 272. 39. 91. 131. 280. 241. 270. 85. 172. 310. 94.\n", + " 122. 111. 225. 233. 310. 83. 288. 78. 97. 74. 180. 246. 178. 110.\n", + " 242. 101. 84. 72. 306.]\n" + ] + } + ], + "source": [ + "# Your code here:\n", + "\n", + "print(diabetes_target_test)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.5053651114394639" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# checking the model score\n", + "\n", + "diabetes_model.score(diabetes_data_train, diabetes_target_train)" ] }, { @@ -263,11 +531,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ - "# Your explanation here:\n" + "# Your explanation here:\n", + "\n", + "# The model score is relatively low and actually the prediction result differs from diabetes_target_test in many values." ] }, { @@ -302,7 +572,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -326,7 +596,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -351,11 +621,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "\n", + "auto = pd.read_csv(\"auto-mpg.csv\")" ] }, { @@ -367,11 +639,125 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
mpgcylindersdisplacementhorse_powerweightaccelerationmodel_yearcar_name
018.08307.0130.0350412.070\\t\"chevrolet chevelle malibu\"
115.08350.0165.0369311.570\\t\"buick skylark 320\"
218.08318.0150.0343611.070\\t\"plymouth satellite\"
316.08304.0150.0343312.070\\t\"amc rebel sst\"
417.08302.0140.0344910.570\\t\"ford torino\"
\n", + "
" + ], + "text/plain": [ + " mpg cylinders displacement horse_power weight acceleration \\\n", + "0 18.0 8 307.0 130.0 3504 12.0 \n", + "1 15.0 8 350.0 165.0 3693 11.5 \n", + "2 18.0 8 318.0 150.0 3436 11.0 \n", + "3 16.0 8 304.0 150.0 3433 12.0 \n", + "4 17.0 8 302.0 140.0 3449 10.5 \n", + "\n", + " model_year car_name \n", + "0 70 \\t\"chevrolet chevelle malibu\" \n", + "1 70 \\t\"buick skylark 320\" \n", + "2 70 \\t\"plymouth satellite\" \n", + "3 70 \\t\"amc rebel sst\" \n", + "4 70 \\t\"ford torino\" " + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "auto.head(5)" ] }, { @@ -383,11 +769,35 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "RangeIndex: 398 entries, 0 to 397\n", + "Data columns (total 8 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 mpg 398 non-null float64\n", + " 1 cylinders 398 non-null int64 \n", + " 2 displacement 398 non-null float64\n", + " 3 horse_power 392 non-null float64\n", + " 4 weight 398 non-null int64 \n", + " 5 acceleration 398 non-null float64\n", + " 6 model_year 398 non-null int64 \n", + " 7 car_name 398 non-null object \n", + "dtypes: float64(4), int64(3), object(1)\n", + "memory usage: 25.0+ KB\n" + ] + } + ], + "source": [ + "# Your code here:\n", + "\n", + "auto.info()" ] }, { @@ -399,11 +809,44 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "82" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "max(auto[\"model_year\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "70" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# Your code here:\n" + "min(auto[\"model_year\"])" ] }, { @@ -415,11 +858,61 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "mpg 0\n", + "cylinders 0\n", + "displacement 0\n", + "horse_power 6\n", + "weight 0\n", + "acceleration 0\n", + "model_year 0\n", + "car_name 0\n", + "dtype: int64" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "auto.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "mpg 0\n", + "cylinders 0\n", + "displacement 0\n", + "horse_power 0\n", + "weight 0\n", + "acceleration 0\n", + "model_year 0\n", + "car_name 0\n", + "dtype: int64" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "auto.dropna(how=\"any\", inplace=True)\n", + "auto.isnull().sum()" ] }, { @@ -431,11 +924,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4 199\n", + "8 103\n", + "6 83\n", + "3 4\n", + "5 3\n", + "Name: cylinders, dtype: int64" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "auto[\"cylinders\"].value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Answer : 5 values" ] }, { @@ -451,11 +971,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "auto.drop(\"car_name\", axis=1, inplace=True)\n", + "\n", + "features = auto.drop(\"mpg\", axis=1)\n", + "target = auto[\"mpg\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "X_train, X_test, y_train, y_test = train_test_split(features, target, test_size = 0.2, random_state=1)" ] }, { @@ -469,11 +1001,28 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
LinearRegression()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "LinearRegression()" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "auto_model = LinearRegression()\n", + "auto_model.fit(X_train, y_train)" ] }, { @@ -493,11 +1042,26 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.8058948552137569" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from sklearn.metrics import r2_score\n", + "\n", + "y_pred = auto_model.predict(X_train)\n", + "\n", + "r2_score(y_train, y_pred)" ] }, { @@ -513,11 +1077,26 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.8144902542572596" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "y_test_pred = auto_model.predict(X_test)\n", + "\n", + "r2_score(y_test, y_test_pred)" ] }, { @@ -542,11 +1121,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "\n", + "X_train09, X_test09, y_train09, y_test09 = train_test_split(features, target, test_size = 0.1)" ] }, { @@ -558,11 +1139,28 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
LinearRegression()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "LinearRegression()" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "auto_model09 = LinearRegression()\n", + "auto_model09.fit(X_train09, y_train09)" ] }, { @@ -574,11 +1172,26 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.8148068327585701" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "y_pred09 = auto_model09.predict(X_train09)\n", + "\n", + "r2_score(y_train09, y_pred09)" ] }, { @@ -590,11 +1203,26 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here:\n" + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.7430263823061456" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here:\n", + "\n", + "y_test_pred09 = auto_model09.predict(X_test09)\n", + "\n", + "r2_score(y_test09, y_test_pred09)" ] }, { @@ -610,7 +1238,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ @@ -626,7 +1254,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ @@ -642,7 +1270,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, "outputs": [], "source": [ @@ -660,7 +1288,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -676,7 +1304,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 41, "metadata": {}, "outputs": [], "source": [ @@ -703,7 +1331,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -717,7 +1345,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.9" + "version": "3.11.3" } }, "nbformat": 4,