Giter Site home page Giter Site logo

Comments (3)

VHRanger avatar VHRanger commented on July 19, 2024

WHen you say example you mean the one in the README?

    import networkx as nx
    from nodevectors import Node2Vec

    # Test Graph
    G = nx.generators.classic.wheel_graph(100)
 
    # Fit embedding model to graph
    g2v = Node2Vec()
    # way faster than other node2vec implementations
    # Graph edge weights are handled automatically
    g2v.fit(G)
 
    # query embeddings for node 42
    g2v.predict(42)

Note first that you have no from nodevectors import Node2Vec in the code you linked. Also note the capital V in the Node2Vec class name whereas what you have is Node2vec

It seems that this is a typo in the example, which I fixed. Try to run it with the correct name

from nodevectors.

ToXP avatar ToXP commented on July 19, 2024

(UPDATED)
Hello Mr. Matt Ranger,

thank you for your kind reply!
The code I run in the python file 'networkx-test.py' it is copied as-it-is from your 'Quick Example:' on your GitHub at URL:

https://github.com/VHRanger/nodevectors

I corrected the (same) lowercase letter error in the given code example (i.e. 'Quick Example') and re-run it in my terminal; now it gives another issue, complaining during load that the created .pckl file is not a .zip file :

=> % python networkx-test.py
Making walks... Done, T=3.09
Mapping Walk Names... Done, T=0.09
Training W2V... Done, T=0.88
Traceback (most recent call last):
File "networkx-test.py", line 19, in
g2v = Node2Vec.load('node2vec.pckl')
File "/userName/lib/python3.8/site-packages/nodevectors/embedders.py", line 70, in load
shutil.unpack_archive(filename, temp_dir, 'zip')
File "/userName/lib/python3.8/shutil.py", line 1218, in unpack_archive
func(filename, extract_dir, **dict(format_info[2]))
File "/userName/lib/python3.8/shutil.py", line 1122, in _unpack_zipfile
raise ReadError("%s is not a zip file" % filename)
shutil.ReadError: node2vec.pckl is not a zip file

PS. I just discovered today your website + blog; the code optimization you are proposing with CSR sparse matrices for graph data analysis is just mind-blowing (thank you for that)

BR
Hyrundo

from nodevectors.

VHRanger avatar VHRanger commented on July 19, 2024

Thanks, the docs are fixed now.

They're quirks (having .zip or not in the method arguments) with the hand-rolled serialization module I wrote a while ago. They come from python's zipfile standard library having these quirks.

Feel free to open an issue relating to these, but I'll close this one for now.

Thanks for the compliments on the code and enjoying my blog!

from nodevectors.

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.