Comments (8)
from nodevectors.
Looking at the code, it seems to be related to the particular way the nodes are passed for prediction inside the fit_transform method in the node2vec implementation. Not sure why, but the predictions are performed using a np.arange. This range won't reflect the actual nodes in the graph, so an exception is raised.
The other embedders don't do that.
from nodevectors.
Thanks, I'll take a look this week.
from nodevectors.
should be fixed in latest release, please update and confirm
from nodevectors.
Still not working.
>pip show nodevectors
Name: nodevectors
Version: 0.1.23
Summary: Fast network node embeddings
Home-page: https://github.com/VHRanger/nodevectors/
Author: Matt Ranger
Author-email: UNKNOWN
License: MIT
Location: e:\users\user\miniconda3\envs\graph\lib\site-packages
Requires: scipy, networkx, csrgraph, gensim, pandas, numpy, scikit-learn, numba
Required-by:
>python
Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from nodevectors import Node2Vec
>>> import networkx as nx
>>> G = nx.Graph()
>>> G.add_edge("1", "2")
>>> n2v = Node2Vec(n_components=128)
>>> n2v.fit_transform(G)
Making walks... Done, T=2.98
Mapping Walk Names... Done, T=0.04
Training W2V... Done, T=0.05
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "E:\Users\user\miniconda3\envs\graph\lib\site-packages\nodevectors\node2vec.py", line 155, in fit_transform
.apply(self.predict)
File "E:\Users\user\AppData\Roaming\Python\Python37\site-packages\pandas\core\series.py", line 3848, in apply
mapped = lib.map_infer(values, f, convert=convert_dtype)
File "pandas\_libs\lib.pyx", line 2329, in pandas._libs.lib.map_infer
File "E:\Users\user\miniconda3\envs\graph\lib\site-packages\nodevectors\node2vec.py", line 170, in predict
return self.model.wv.__getitem__(node_name)
File "E:\Users\user\miniconda3\envs\graph\lib\site-packages\gensim\models\keyedvectors.py", line 353, in __getitem__
return self.get_vector(entities)
File "E:\Users\user\miniconda3\envs\graph\lib\site-packages\gensim\models\keyedvectors.py", line 471, in get_vector
return self.word_vec(word)
File "E:\Users\user\miniconda3\envs\graph\lib\site-packages\gensim\models\keyedvectors.py", line 468, in word_vec
raise KeyError("word '%s' not in vocabulary" % word)
KeyError: "word '0' not in vocabulary"
I can see there is still a np.arrange
being passed to the predict
function.
from nodevectors.
Any new info about this problem? im having the exact same issue..
from nodevectors.
or one might know a way around it?
from nodevectors.
Not working for me! Will do fit and predict.
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.