Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

truncate_mode = None #13

Open
wangjiawen2013 opened this issue Nov 21, 2023 · 2 comments
Open

truncate_mode = None #13

wangjiawen2013 opened this issue Nov 21, 2023 · 2 comments

Comments

@wangjiawen2013
Copy link

Hi,
truncate_mode=None will cause error when creating_dendrogram using idd.create_dendrogram(truncate_mode=None)

@kamicollo
Copy link
Owner

Could you share an example and the error it produces? I cannot reproduce it, e.g - using the dataset from the other issue you posted works without issues:

x, y = np.meshgrid(range(-5, 5), range(-5, 5))
z = x ** 2 + y ** 2
#Convert this grid to columnar data expected by Altair

source = pd.DataFrame({'x': x.ravel(),
'y': y.ravel(),
'z': z.ravel()})

df = source.pivot(columns='y',index='x',values='z')
column_linkage_matrix = sch.linkage(df.drop_duplicates(), method='single', metric='euclidean')
column_flat_clusters = sch.fcluster(column_linkage_matrix, t=0, criterion='distance')
column_cl_data = idendrogram.ClusteringData(
linkage_matrix = column_linkage_matrix,
cluster_assignments = column_flat_clusters
)
column_idd = idendrogram.idendrogram()
column_idd.set_cluster_info(column_cl_data)

column_dendrogram = column_idd.create_dendrogram(truncate_mode=None).plot(
backend='altair',
orientation='top',
height=30, width=200,
show_nodes=False).interactive()
column_dendrogram

@wangjiawen2013
Copy link
Author

I know why. I thought it was caused by truncate_mode=None, but it's the same error caused by duplicates. When the duplicated data was removed, truncate=None worked well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants