Skip to content
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

Support StellarGraph input and output in EdgeSplitter #1032

Merged
merged 2 commits into from Mar 9, 2020

Conversation

huonw
Copy link
Member

@huonw huonw commented Mar 6, 2020

This adjust the stellargraph.data.EdgeSplitter class so that it can consume and emit a StellarGraph object: if it is constructed like EdgeSplitter(some_stellargraph), then train_test_split will return a StellarGraph object. For backwards-compatibility, EdgeSplitter(some_networkx) still works, and returns a NetworkX object; that is, existing code will not be affected.

For now, this compatibility is useful even just for our own code as there's still quite a few of our demos that would require a lot more code to switch to use this new form, and so I have not switched them here:

However, some notebooks can be updated without too much code, in particular demos/calibration/calibration-pubmed-link-prediction.ipynb and demos/ensembles/ensemble-link-prediction-example.ipynb can move over to using Cora().load() (per #812 and #717) by passing the returned StellarGraph object directly into EdgeSplitter, with not many other code changes required.

See: #174

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

@codeclimate
Copy link

codeclimate bot commented Mar 6, 2020

Code Climate has analyzed commit a4b3cd2 and detected 0 issues on this pull request.

View more on Code Climate.

@stellar-graph-bot
Copy link

stellar-graph-bot commented Mar 6, 2020

Codecov Report

Merging #1032 into develop will decrease coverage by 0.4%.
The diff coverage is 100.0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #1032     +/-   ##
=========================================
- Coverage     85.6%   85.1%   -0.4%     
=========================================
  Files           53      53             
  Lines         5552    5375    -177     
=========================================
- Hits          4751    4576    -175     
+ Misses         801     799      -2     
Impacted Files Coverage Δ
stellargraph/core/graph.py 99.0% <0.0%> (-0.6%) ⬇️
stellargraph/data/edge_splitter.py 90.7% <0.0%> (+1.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecd38f9...a4b3cd2. Read the comment docs.

1 similar comment
@codecov-io
Copy link

codecov-io commented Mar 6, 2020

Codecov Report

Merging #1032 into develop will decrease coverage by 0.4%.
The diff coverage is 100.0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #1032     +/-   ##
=========================================
- Coverage     85.6%   85.1%   -0.4%     
=========================================
  Files           53      53             
  Lines         5552    5375    -177     
=========================================
- Hits          4751    4576    -175     
+ Misses         801     799      -2     
Impacted Files Coverage Δ
stellargraph/core/graph.py 99.0% <0.0%> (-0.6%) ⬇️
stellargraph/data/edge_splitter.py 90.7% <0.0%> (+1.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecd38f9...a4b3cd2. Read the comment docs.

Copy link
Contributor

@PantelisElinas PantelisElinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

this looks good. There is only one update necessary for the ensemble link prediction demo. This is a pre-existing error that can be easily fixed.

When calling model.compile(...) please change weighted_metrics=["acc"] to metrics=["acc"] and then when calling model.fit_generator(...) please change early_stopping_monitor="val_weighted_acc" to early_stopping_monitor="val_acc".

The above will remove the tensorflow warning, WARNING:tensorflow:Early stopping conditioned on metric val_weighted_acc which is not available. Available metrics are: loss,acc,val_loss,val_acc that the call to fit_generator outputs. Our generators do not output sample weights and the call to fit_generator does not specify class_weight so weighted metrics are not available. It looks like this was an error in the original notebook. We can fix it as part of this pull request or have it as a separate ticket if you prefer.

P.

@huonw
Copy link
Member Author

huonw commented Mar 9, 2020

That sort of work is definitely appropriate for a separate ticket. In that particular case, it's #933, which is fixed in #1008.

@huonw huonw merged commit e426586 into develop Mar 9, 2020
@huonw huonw deleted the feature/174-edgesplitter-stellargraph branch March 9, 2020 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants