Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created March 12, 2020 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniruddha27/579153e1c77773d7a7038b548f929b57 to your computer and use it in GitHub Desktop.
Save aniruddha27/579153e1c77773d7a7038b548f929b57 to your computer and use it in GitHub Desktop.
# 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