Question: # import the necessary modules house = # read in the csv file y , X = # create matrices y , from the price

# import the necessary modules
house = # read in the csv file
y, X = # create matrices y, from the price column, and X, from the bedrooms, bathrooms, sqft_living, sqft_lot, yr_built, and sqft_living15 columns
vif = # calculate the VIF for each X_i
result =[round(num,6) for num in vif]
print(result)2.11 LAB: Calculating VIF using variance_inflation_factor()
The kc_house_data dataset contains information on house sale prices in King County, Washington from May 2014 and May 2015. The
columns include sale price, and a number of variables that might affect the price.
Load the data set into a data frame.
Create matrices y, from the price column, and x, from the bedrooms, bathrooms, sqft_living, sqft_lot, yr_built, and sqft_living15
columns
calculate the VIF for each predictor variable.
Ex: If sqft_lot15 is used instead of sqft_living15 the output is:
1.563916,2.961241,2.742922,2.076869,1.382412,2.094995
 # import the necessary modules house = # read in the

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 Databases Questions!