Created
March 12, 2020 06:49
-
-
Save aniruddha27/579153e1c77773d7a7038b548f929b57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import library for VIF | |
from statsmodels.stats.outliers_influence import variance_inflation_factor | |
def calc_vif(X): | |
# Calculating VIF | |
vif = pd.DataFrame() | |
vif["variables"] = X.columns | |
vif["VIF"] = [variance_inflation_factor(X.values, i) for i in range(X.shape[1])] | |
return(vif) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment