Comments (3)
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.
(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.
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)
- Embedding a VERY LARGE graph, upcoming? HOT 2
- When saving large graph, creating a temporary folder will cause the system disk resources to be exhausted. HOT 1
- Issue with gensim 4.0.0+ HOT 3
- is it possible to split n2v to generate walks only? HOT 4
- node2vec uses CBOW instead of skip-gram HOT 4
- Setting value of seed to make Node2vec embedding repeatable. HOT 1
- Print training progression (node2vec)? HOT 1
- Continue fitting process HOT 2
- Has node2vec implementation been updated to use skip-gram as default? HOT 3
- About painting HOT 1
- defining random state or seed option parameters HOT 3
- Why is generating walks so slow with non-default parameters? HOT 3
- word2vec parameters changed HOT 3
- Problem with underlying Word2vec HOT 1
- G.mat got an asymmetric sparse matrix
- ProNE option: "inconsistent shapes" error
- Node2Vec:About the return_weight and neighbor_weight
- ProNE multithread HOT 1
- NetworkX 3.0 remove adj_matrix in version HOT 1
- Old parameter shows up in Word2Vec call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodevectors.