GithubHelp home page GithubHelp logo

Comments (4)

yl-1993 avatar yl-1993 commented on August 19, 2024

@yossibiton Thanks for reporting. What is your python version? And do you mind changing this line to assigned_cluster = G[node][nbr]['cluster']? As the graph is successfully built, the error may be raised by the way of fetching node.

from learn-to-cluster.

yossibiton avatar yossibiton commented on August 19, 2024

hello @yl-1993 , thanks for your response.

My python version is 3.6.9, and networkx package version is 2.4 - did you use other version ?
I already try your suggestion, and then i got another error on the same line :

  File "/Users/yossib/Dev/learn_to_cluster/baseline/chinese_whispers.py", line 57, in chinese_whispers
    assigned_cluster = G[node][nbr]['cluster']
KeyError: 'cluster'

I checked G[node][nbr] and it only has the 'weight' key.
So i guess something is broken with this script, and it's not just node fetching problem.

from learn-to-cluster.

yl-1993 avatar yl-1993 commented on August 19, 2024

@yossibiton Thanks for the message. I am sorry that the new error is due to my previous suggestion. The reason lies in that G.node is networkx.classes.reportviews.NodeView while G[node] is networkx.classes.coreviews.AtlasView.

I figured out the problem is related to the version of networkx, as reported in stackoverflow. There are two possible solutions:

  1. Downgrade your networkx via pip install --upgrade networkx==2.3.
  2. Use the fixed version in PR #49

The second solution is suggested as it works fine under both 2.3 and 2.4 in my test.

from learn-to-cluster.

yossibiton avatar yossibiton commented on August 19, 2024

Thank you very much, i took your PR and it works

from learn-to-cluster.

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.