Created
December 23, 2018 09:05
-
-
Save dice89/96607b5a6567fed831e00f8f8cfdcbed to your computer and use it in GitHub Desktop.
This file contains hidden or 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 pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import numpy as np | |
from sklearn.datasets import load_breast_cancer | |
sns.set() | |
data = load_breast_cancer() | |
breast_cancer_df = pd.DataFrame(data['data']) | |
breast_cancer_df.columns = data['feature_names'] | |
breast_cancer_df['target'] = data['target'] | |
breast_cancer_df['diagnosis'] = [data['target_names'][x] for x in data['target']] | |
sns.set() | |
corr = breast_cancer_df[list(data['feature_names'])].corr(method='pearson') | |
f, ax = plt.subplots(figsize=(11, 9)) | |
cmap = sns.diverging_palette(220, 10, as_cmap=True) | |
mask = np.zeros_like(corr, dtype=np.bool) | |
mask[np.triu_indices_from(mask)] = True | |
sns.heatmap(corr,mask=mask, cmap=cmap, vmax=.3, center=0, | |
square=True, linewidths=.5, cbar_kws={"shrink": .5}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment