`ScatteringBase1D` kwargs should be passed via `dict`'s
See original GitHub issuefrom the ScatteringBase1D
frontend to compute_meta_scattering
, precompute_size_scattering
, and scattering_filter_factory
This dict
could be named filterbank_kwargs
and eventually also contain the spinned
boolean (#807)
This will lead to a reduction in the number of positional arguments in these prototypes. More importantly, it will better decouple hyperparameters from the choice of wavelet shape.
For me to be able to start working on this, i need #833 #842 #848 #850 to be reviewed, rebased, and merged.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Converting Python dict to kwargs? - Stack Overflow
Here is a complete example showing how to use the ** operator to pass values from a dictionary as keyword ...
Read more >How to pass a dict when a Python function expects **kwargs
Many Python functions have a ** kwargs parameter — a dict whose keys and values are populated via keyword arguments. But what if...
Read more >Python args and kwargs: Demystified
When you execute the script above, concatenate() will iterate through the Python kwargs dictionary and concatenate all the values it finds:.
Read more >A Guide to Args, Kwargs, Packing and Unpacking in Python
Args have been packed into a tuple and kwargs a dictionary. ... They must be passed in the correct order and position.
Read more >How To Use *args and **kwargs in Python 3 - DigitalOcean
In this tutorial, we will cover the syntax of working with *args and **kwargs as parameters within functions to pass a variable number...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cyrusvahidi i’m trying my best (so far with success) not to introduce new object-oriented classes. So a compromise i had in mind would be a two-element tuple with the callable as first element and its kwargs as second elements.
Something like
(gauss_1d, {"sigma0": sigma})
or(morlet_1d, {"r_psi": r_psi})
.For a Gammatone, it would become
(gammatone_1d, {"r_psi": r_psi, "gammatone_order": 4})
or something like that. The prototype ofgammatone_1d
would much resemblemorlet_1d
:I don’t think it’s necessary to have a new class where that class would basically implement
__init__
,__call__
, and maybe (maybe!) some methodT_from_sigma
which computes the temporal support as a function of thesigma
bandwidth parameter. But we have no such method right now, as we work empirically (compute_temporal_support
) on thephi
so estimate ourmin_to_pad
. Therefore i don’t believe an OO interface is necessary … yet.So i see my solution as one step in the journey but not the final destination. In any case this will need to be discussed with @eickenberg, who i know has thought about this for a while now.
Update: a more concise version that should work out of the box in v0.3:
Note that the last function prepares for a number of features that could happen in v0.4 if we deem it useful:
scatnet_generator
by something elseIt also allows to skip filterbank construction in a very concise way:
This idiom is useful for maintaining
utils.compute_meta_scattering
andutils.precompute_size_scattering
. I also believe it will improve our approach to padding