Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Trigonometry

Authors: Cynthia Y Young

5th Edition

1119820928, 9781119820925

More Books

Students also viewed these Mathematics questions