Question: Fish.csv This data file comes from kaggle.com:https://www.kaggle.com/aungpyaeap/fish-market As stated on the linked page: This dataset is a record of 7 common different fish species in

Fish.csv

This data file comes from kaggle.com:https://www.kaggle.com/aungpyaeap/fish-market

As stated on the linked page: "This dataset is a record of 7 common different fish species in fish market sales. With this dataset, a predictive model can be performed using machine friendly data and estimate the weight of fish can be predicted."

Response:

  • Weight (in grams)

Features:

  • Length1 (vertical length in cm)
  • Length2 (diagonal length in cm)
  • Length3 (cross length in cm)
  • Height (in cm)
  • Width (diagonal width in cm)

The species name of the fish is also given.

Part D: (20 points) Write a functionforward_select(df, resp_str, maxk)that takes in the DataFrame, the name of the column corresponding to the response, and the maximum number of desired features, and returns a list of feature names corresponding to themaxkmost important features via forward selection. At each stage in forward selection you should add the feature whose inclusion in the model would result in the lowest sum of squared errors()

(SSE). Use your function to determine the best=5

k=5features to include in the model. Clearly indicate which feature was added in each stage.

Note: The point of this exercise is to see if you can implementfoward_selectyourself. You may of course use canned routines like statmodels OLS, but you may not call any Python method that explicitly performs forward selection.

Hint: Since you are basing your feature selection on the lowest sum of squared errors, use the following method of computing SSE:np.sum((y-model.predict(X))**2)

def forward_select(df, resp_str="Weight", maxk=3):  

Part E: (10 points) Write down the reduced multiple linear regression model, including estimated parameters, obtained by your forward selection process

 

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

Students Have Also Explored These Related Mathematics Questions!