GithubHelp home page GithubHelp logo

Comments (6)

tbonald avatar tbonald commented on August 22, 2024

Thank you very much for your feedback.
This has been fixed (please check the develop branch; will be available in the next release).

from scikit-network.

ninasachdev avatar ninasachdev commented on August 22, 2024

Thank you so much for your prompt response! I updated the functions in the hierarchy module, but am running into another error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-50-33674d51a39e> in <module>
----> 1 labels = cut_straight_dev(dendrogram, n_clusters=100, return_dendrogram=True)

<ipython-input-7-adb9d8c1d297> in cut_straight_dev(dendrogram, n_clusters, threshold, sort_clusters, return_dendrogram)
     92             cluster[n + t] = cluster.pop(i) + cluster.pop(j)
     93 
---> 94     return get_labels_dev(dendrogram, cluster, sort_clusters, return_dendrogram)

<ipython-input-7-adb9d8c1d297> in get_labels_dev(dendrogram, cluster, sort_clusters, return_dendrogram)
     19         current_cluster_new = len(clusters)
     20         for i, j, height, _ in dendrogram:
---> 21             i_new = cluster_index.pop(int(i))
     22             j_new = cluster_index.pop(int(j))
     23             if i_new != j_new:

KeyError: 59725

Since there are several inf values in the height column of my dendrogram, reorder_dendrogram is comparing two rows with the same inf height, and thus the order of the dendrogram doesn't change. The cut variable in cut_straight() is also equal to inf.

This KeyError occurs the first time if i_new != j_new: is True in get_labels(). Could this have to do with how my dendrogram is ordered?

Please let me know if I can clarify anything!

from scikit-network.

tbonald avatar tbonald commented on August 22, 2024

Hard to debug without the dendrogram variable. Is there a way to share it?

from scikit-network.

ninasachdev avatar ninasachdev commented on August 22, 2024

Yes I just emailed the dendrogram to you, let me know if you have issues with opening it!

from scikit-network.

tbonald avatar tbonald commented on August 22, 2024

Hi @ninasachdev
I seems that there is an inversion in your dendrogram (on row 5663, the merge is done at a height lower that those of the clusters), causing the error in the cut.
So the problem is probably in the generation of the dendrogram. Could you please send me the original graph?
Thanks.

from scikit-network.

tbonald avatar tbonald commented on August 22, 2024

I'm closing this issue. Feel free to reopen it if needed.

from scikit-network.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.