Question: 1d) Now, let's make a new feature called 'weight_norm' which is weight normalized by the mean value. [5 pts] Run training with polynomial models with

1d) Now, let's make a new feature called 'weight_norm' which is weight normalized by the mean value. [5 pts]

Run training with polynomial models with polynomial degrees up to 20. Print out each polynomial degree and ????2 value. What do you observe from the result? What are the best_degree and best_r_qaured just based on ????2 value? Inspect model summary from each model. What is the highest order model that makes sense (fill the value for the sound_degree)?

Note: For N-degree polynomial fit, you have to include all orders upto N. This is what my data looks like: columns = ['mpg','cylinders','displacement','horsepower','weight','acceleration','model_year','origin','car_name'] df = pd.read_csv("data/auto-mpg.data", header=None, delimiter=r"\s+", names=columns) print(df.info()) df.describe() I corrected the data type of horsepower and dropped car_name: # replace data frame with cleaned data frame # fix data types, remove null or undefined values, drop the column car_name # NOTE: do not change the column names or add new columns # your code here

#fix data types df['horsepower'].replace('?', np.nan, inplace=True) df['horsepower'] = df['horsepower'].astype(float)

#drop missing values df.dropna(inplace=True)

#drop car name df.drop('car_name', axis=1, inplace=True)

#double check print(df.info()) print(df.head()) I started my answer to 1d with: df['weight_norm'] = df['weight'] / df['weight'].mean() Please use statsmodel to solve

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock