-
Notifications
You must be signed in to change notification settings - Fork 425
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/graphwave chebyshev #920
Conversation
- refactored embedding calculation - added `scales="auto"` option
# Conflicts: # stellargraph/mapper/__init__.py
…d added GraphWave info into the readme
Co-Authored-By: Huon Wilson <Huon.Wilson@data61.csiro.au>
…o feature/graphwave-chebyshev # Conflicts: # tests/mapper/test_graphwave_generator.py
(num_scales, num_nodes) tensor of the wavelets for each scale for the specified node. | ||
""" | ||
|
||
def y(vector): |
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.
Rename function "y" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
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.
Looking good!
""" | ||
Args: | ||
G (StellarGraph): the StellarGraph object. | ||
scales (iterable of floats): the wavelet scales to use. Smaller values embed smaller scale structural | ||
features, and larger values embed larger structural features. | ||
deg: the degree of the Chebyshev polynomial to use. Higher degrees yield more accurate results but at a | ||
higher computational cost. The default value of `20` is accurate enough for most applications. |
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.
Maybe we could note it, so that users (and us) can remember where the assertion comes from:
higher computational cost. The default value of `20` is accurate enough for most applications. | |
higher computational cost. According to [1], the default value of `20` is accurate enough for most applications. |
With a citation somewhere in this doc string:
[1] D. I. Shuman, P. Vandergheynst, and P. Frossard, “Chebyshev Polynomial Approximation for Distributed Signal Processing,” https://arxiv.org/abs/1105.1891
cheby_polys.append(cheby_poly) | ||
|
||
cheby_polys = K.squeeze(tf.stack(cheby_polys, axis=0), axis=-1) | ||
return tf.matmul(coeffs, cheby_polys) |
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.
It would be good to note, because it's different to the paper we're using for reference.
# Conflicts: # stellargraph/mapper/graphwave_generator.py
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.
Only a few very tiny things, and then I think it's good.
Also, it's a bit buried now, but I replied to #920 (comment) .
stellargraph/core/validation.py
Outdated
min_val: the minimum value that `x` can attain | ||
min_val: the maximum value that `x` can attain | ||
""" | ||
if min_val == -np.inf: |
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.
It would be very slightly better for this to be inside the if x < min_val or ...:
branch, so that we don't waste time doing these checks or string formatting if x
is valid.
Co-Authored-By: Huon Wilson <Huon.Wilson@data61.csiro.au>
Co-Authored-By: Huon Wilson <Huon.Wilson@data61.csiro.au>
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.
Looks good, other than the merge conflict from #879.
# Conflicts: # CHANGELOG.md
This PR adds unit tests and Chebyshev polynomials for GraphWave, and removes the experimental tag from GraphWave.
Chebyshev polynomials are used approximate spectral graph filtering for GraphWave instead of calculating all the eigenvalues explicitly. This decreases the computational complexity from
O(N^3)
toO(kEn)
where:N
is the number of nodesk
is the order of the Chebyshev polynomialE
is the number of edges in the graphn
is the number of nodes to calculate embeddings for (length ofnode_ids
passed togenerator.flow
in this caseReviewer checklist:
test_chebyshev
by comparing the approximation to the exact value)