Skip to content

Instantly share code, notes, and snippets.

@notha99y
Created December 21, 2018 10:47
Show Gist options
  • Save notha99y/06cb086f38c562b16aea063d678abf6c to your computer and use it in GitHub Desktop.
Save notha99y/06cb086f38c562b16aea063d678abf6c to your computer and use it in GitHub Desktop.
from scipy.cluster.hierarchy import linkage
from scipy.cluster.hierarchy import dendrogram
sample_train,sample_val, gt_train, gt_val = train_test_split(train_df,
train_df['Survived'],
test_size=0.05,
random_state=99)
sample_val_processed = simple_preprocessing(sample_val, train = False)
sample_val_processed = scaler.fit_transform(sample_val_processed)
mergings = linkage(sample_val_processed, method='complete')
fig = plt.figure(figsize = (16,10))
dendrogram(mergings,
labels=np.array(sample_val['Name']),
leaf_rotation=90,
leaf_font_size=10)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment