Fast implementation of node2vec
Project description
fastnode2vec
Really fast implementation of node2vec based on numba and gensim.
API
Node2Vec
inherits from gensim's Word2Vec
, all its APi is valid.
from fastnode2vec import Graph, Node2Vec
graph = Graph([("a", "b"), ("b", "c"), ("c", "a"), ("a", "d")],
directed=False)
n2v = Node2Vec(graph, dim=10, walk_length=100, context=10, p=2.0, q=0.5, workers=2)
n2v.train(epochs=100)
print(n2v.wv["a"])
CLI
Compute embeddings of the Gnutella peer-to-peer network:
wget https://snap.stanford.edu/data/p2p-Gnutella08.txt.gz
fastnode2vec p2p-Gnutella08.txt.gz --dim 16 --walk-length 100 --epochs 10 --workers 2
Load embeddings produced by the CLI
Just use the Word2Vec
API.
from gensim.models import KeyedVectors
wv = KeyedVectors.load("p2p-Gnutella08.txt.gz.wv", mmap='r')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastnode2vec-0.0.1.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for fastnode2vec-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948923587f9939ddfc685f60b46ed4a5742ff8deab4777eb99dcb3bb62636a24 |
|
MD5 | 51fc2bb53027e89ba62917b761193edd |
|
BLAKE2b-256 | 33dd4ad5a3658728b67128a6d1bbf838a15a52ace645e57c59c8dc8710d995f1 |