MattJBritton / ExquisiteCorrpse

Tool for visualizing feature correlations and interactions in Jupyter notebooks.
GNU General Public License v3.0
3 stars 0 forks source link

A error of demo #1

Closed TianyiHuang0224 closed 4 years ago

TianyiHuang0224 commented 4 years ago

ValueError Traceback (most recent call last)

in ----> 1 visualize_feature_correlation(boston_df, "heatmap").properties(title="Boston Housing Data Correlation Matrix") in visualize_feature_correlation(data, chart_type, target_name, cluster_scope, user_defined_clusters) 9 corr_condensed = hc.distance.squareform(1 - np.abs(df.corr()) ) # convert to condensed 10 z = hc.linkage(corr_condensed, method='average'); ---> 11 feature_order = hc.dendrogram(z, labels=df.columns, no_plot=True)["ivl"]; 12 if chart_type == "dendrogram": 13 fig = ff.create_dendrogram( D:\Program Files\anaconda3\lib\site-packages\scipy\cluster\hierarchy.py in dendrogram(Z, p, truncate_mode, color_threshold, get_leaves, orientation, labels, count_sort, distance_sort, show_leaf_counts, no_plot, no_labels, leaf_font_size, leaf_rotation, leaf_label_func, show_contracted, link_color_func, ax, above_threshold_color) 3275 "'bottom', or 'right'") 3276 -> 3277 if labels and Z.shape[0] + 1 != len(labels): 3278 raise ValueError("Dimensions of Z and labels must be consistent.") 3279 D:\Program Files\anaconda3\lib\site-packages\pandas\core\indexes\base.py in __nonzero__(self) 2147 2148 def __nonzero__(self): -> 2149 raise ValueError( 2150 f"The truth value of a {type(self).__name__} is ambiguous. " 2151 "Use a.empty, a.bool(), a.item(), a.any() or a.all()." ValueError: The truth value of a Index is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
MattJBritton commented 4 years ago

Hello @TianyiHuang0224! First of all, thanks for taking the time investigate this project of mine. It is greatly appreciated!

It looks like this was caused by an error in SciPy (scipy.cluster.hierarchy.dendrogram). That issue was fixed in v1.5.2, so I'd just update your scipy in conda and you should be good to go.

I should put in a YML file for a conda environment - thanks for bringing that to my attention.