Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Created January 10, 2020 20:36
Show Gist options
  • Select an option

  • Save marcosan93/54d6f7046a35a6059d00c2a97332630f to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/54d6f7046a35a6059d00c2a97332630f to your computer and use it in GitHub Desktop.
# Correlation DF of all classes
corr = final_df.corr().iloc[[-1],:-1]
# Sorting our Correlation DF by their absolute values and selecting the top 10
top10_corr = corr.transpose().apply(abs).sort_values(by='Decision', ascending=False)[:10]
# Creating a new DF with the features from the top10_corr and joing the 'Decision' class labels
top10_corr_df = final_df[top10_corr.index].join(final_df.Decision)
# Pickling the DF for use in our Classification models
with open("top10_corr_df.pkl", "wb") as fp:
pickle.dump(top10_corr_df, fp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment