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
Use real arguments instead of **kwargs where possible #801
Labels
bug
Something isn't working
doc
Issue relates to documentation
filler
Small task that can be picked up and completed quickly
sg-library
Comments
huonw
added
bug
Something isn't working
sg-library
doc
Issue relates to documentation
labels
Feb 6, 2020
huonw
added a commit
that referenced
this issue
Feb 10, 2020
The headers for the `GCN` and `GraphConvolution` classes now shows all the information about the class: ``` class stellargraph.layer.gcn.GCN(layer_sizes, generator, bias=True, dropout=0.0, activations=None, kernel_initializer=None, kernel_regularizer=None, kernel_constraint=None, bias_initializer=None, bias_regularizer=None, bias_constraint=None) class stellargraph.layer.gcn.GraphConvolution(units, activation=None, use_bias=True, final_layer=False, input_dim=None, kernel_initializer='glorot_uniform', kernel_regularizer=None, kernel_constraint=None, bias_initializer='zeros', bias_regularizer=None, bias_constraint=None, **kwargs) ``` Especially for GCN, this will reduce the chance of misspelled arguments being silently ignored. See: #801
huonw
added a commit
that referenced
this issue
Mar 19, 2020
If we're going to support this argument, we should include it as a real argument. This PR switches it to a real argument (and documents it) in the classes for which it is the only `kwargs` that StellarGraph uses; that is, after this patch the `kwargs` parameter is not used for anything in these classes except for passing through to `tf.keras.Layer`. See: #801
This was referenced Mar 20, 2020
kjun9
added a commit
that referenced
this issue
Mar 24, 2020
kjun9
added a commit
that referenced
this issue
Mar 24, 2020
kjun9
added a commit
that referenced
this issue
Mar 24, 2020
This was referenced Mar 24, 2020
kjun9
added a commit
that referenced
this issue
Mar 24, 2020
This fixes GCN to use correct kernel and bias related defaults that match the defaults for the `GraphConvolution` class Related to #801
kjun9
added a commit
that referenced
this issue
Mar 24, 2020
kjun9
added a commit
that referenced
this issue
Mar 24, 2020
kjun9
added a commit
that referenced
this issue
Mar 25, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
doc
Issue relates to documentation
filler
Small task that can be picked up and completed quickly
sg-library
Describe the bug
Many of the layers have layer-specific required or optional arguments that are passed by manipulating
**kwargs
, e.g., in GCN:stellargraph/stellargraph/layer/gcn.py
Lines 54 to 99 in 2c513c1
For a specific example, the
kernel_initializer
argument defaults to"glorot_uniform"
; the current set up is unfortunate because:If the argument was specified in the
__init__
itself similar tobias
anddropout
, the documentation would list the default automatically, and tooling would be able to reason about it:https://stellargraph.readthedocs.io/en/latest/api.html#stellargraph.layer.gcn.GCN
This is similar to Keras, which has Layer-specific arguments explicitly listed, and arguments for the Layer super-class passed in
**kwargs
: e.g. https://www.tensorflow.org/api_docs/python/tf/keras/layers/DenseA list of probable suspects
(A search for
kwargs[
,kwargs.get
,kwargs.pop
)Here's a checklist (if you choose to work on one, edit this to put your name next to the row, but only check it once the PR merges):
To Reproduce
N/A
Observed behavior
N/A
Expected behavior
Use of
**kwargs
should be minimised.Environment
Operating system:
Darwin-18.6.0-x86_64-i386-64bit
Python version:
Package versions:
Additional context
N/A
The text was updated successfully, but these errors were encountered: