Hoosier-Clusters / clusim

An extended package for clustering similarity
MIT License
63 stars 15 forks source link

Clustering constructor is fickle #30

Closed jg-you closed 5 years ago

jg-you commented 5 years ago

Last issue I swear! While testing the code for PR #29 , I noticed that the constructor of the Clustering object is very sensitive to the type of input given.

For example, when I construct a clustering from the following dictionary mapping clusters to elements

x = {0: [0,1,2,3,4], 1:[5,6,7,8,9]}
clu  = Clustering(clu2elm_dict=x)   

no warning are raised, yet a bunch of functions in the sim subpackage break down, because they expect a dictionary of sets.

I think that it would be easy to cast all iterables to sets at construction time, but I don't know whether this would affect other parts of the code?

ajgates42 commented 5 years ago

Geez! I guess close to release I started to get sloppy ; ). I'll take another pass to clean things up.

jg-you commented 5 years ago

Nice! While at it, it would probably be useful to support scikit style construction with clusterings declared as [0,0,0,0,0,0,1,1,1,0,0,0] etc. I can put a PR in for that.