-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/node2vec for issue Word2Vec in StellarGraph #255 #536
Conversation
…BiasedRandomWalk interface
… changed BiasedRandomWalk interface
…pdated BiasedRandomWalk interface
…mbedding learning with keras node2vec implementation
…xample of node classification with keras node2vec implementation
…tting the edge type to 'cites'
Check out this pull request on You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB. |
stellargraph/data/explorer.py
Outdated
self.edge_weight_label = edge_weight_label | ||
self._check_weights(self.p, self.q, self.weighted, self.edge_weight_label) | ||
|
||
def run(self, nodes=None, n=None, length=None, seed=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor this function to reduce its Cognitive Complexity from 56 to the 15 allowed.
sample_counter += 1 | ||
|
||
# If the batch_size number of samples are accumulated, yield. | ||
if sample_counter == batch_size: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid deeply nested control flow statements.
|
||
yield edge_ids, edge_labels | ||
|
||
if self.bidirectional is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid deeply nested control flow statements.
""" | ||
|
||
def __init__(self, G, nodes=None, length=2, number_of_walks=1, seed=None): | ||
def __init__( | ||
self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method "init" has 9 parameters, which is greater than the 7 authorized.
Code Climate has analyzed commit 18274d2 and detected 2 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Hi @kjun9 , Thanks for your careful review! I have made necessary changes as per your suggestions. You can start the next round review now. Best regards! |
Thanks for the explanation, that makes sense 👍 This looks good to me now, just one last thing to update that I can see is that in the demo notebooks, we're trying to keep the first markdown cell only contain the title (for example https://github.com/stellargraph/stellargraph/blob/develop/demos/node-classification/graphsage/graphsage-cora-node-classification-example.ipynb) since this lets us render the colab/binder buttons right underneath the title. So I'd suggest just moving the rest of the markdown in that first cell to a second markdown cell! |
Hi @kjun9 , The notebooks have been formatted as you requested. Thanks and best regards! |
@daokunzhang Hi daokun, sorry for the delay I'll take a look now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @daokunzhang looks great 👍
Before merging, could you revert the mode change on scripts/notebook_text_checker.py
using chmod 664
like you did for the previous ones? I'm guessing you might have something in your setup that keeps automatically changing this 😅
Also, there's been a number of updates to how we document each notebook (they're all now included in our API docs https://stellargraph.readthedocs.io/en/latest/demos/index.html ) which means there's a couple of additional steps to add these new notebooks to the API documentation, but I think we can do this separately after landing this first - could you file an issue with a title like "Add keras node2vec demos to API documentation"? And feel free to paste some of the details below in the issue:
- Create new files that allow us to include these notebooks in the API docs:
docs/demos/embeddings/keras-node2vec-embeddings.nblink
docs/demos/node-classification/keras-node2vec-node-classification.nblink
Both of these should contain something like (you can look at another one as reference):
{
"path": "../../../demos/embeddings/keras-node2vec-embeddings.ipynb"
}
and there should be symlinks for the images being used by the demo notebooks, similar to https://github.com/stellargraph/stellargraph/blob/develop/docs/demos/node-classification/Cora-features.png
- Update the tables in demo README and
index.rst
files to include an entry for each of these notebooks - I think this is done automatically (or semi-automatically?) usingscripts/demo_indexing.py
, I can double check exactly what should be done here.
Thanks @kjun9 , I have revised the scripts/notebook_text_checker.py file mode change problem. I have created the nblink files for the keras-node2vec-node-classification and keras-node2vec-embeddings demo files in the docs folder and added the word2vec_illustration image file to the docs folder. After that I added the component about keras node2vec to the For my part, I cannot merge this pull request. Maybe it is caused by that Yuriy ever requested changes but he haven't approved yet. Could you please help me merge it on your part if you are convenient? Best regards! |
Thanks @daokunzhang I can see the notebook in the API documentation 👍 I'll merge this now. I think the demo-indexing could still be tweaked a bit, so I might still file an issue about that - I think this is the first time where we have two versions of an algorithm presented as demos ( |
Thanks @kjun9 ! |
This is the pull request for adding Keras Node2Vec layer to StellarGraph library.
I mainly made the following changes:
__init__
andrun
function of BiasedRandomWalk to make UnSupervisedSampler support BiasedRandomWalk