Clarify kwargs in feature functions
See original GitHub issueSome of our feature functions (melspectrogram, mfcc, etc) use kwargs to pass through parameters to core functions (stft, filter construction etc). This isn’t terribly well documented, and can be a little difficult for new users to navigate and understand what the options are.
At this point, it’s probably worth replacing some of these kwargs, eg https://github.com/librosa/librosa/blob/25538adb3aed3485a06e60b6dad88be3d540f0c2/librosa/feature/spectral.py#L1767-L1769 by
def mfcc(
*, y=None, sr=22050, S=None, n_mfcc=20, dct_type=2, norm="ortho", lifter=0,
n_mels=128, n_fft=2048, ...
):
Alternatively, if we don’t want to make the API totally redundant, we could at least provide more documentation in the kwarg’ed functions’ docstrings to better explain what options are available.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Python args and kwargs: Demystified
In this step-by-step tutorial, you'll learn how to use args and kwargs in Python to add more flexibility to your functions. You'll also...
Read more >10 Examples to Master *args and **kwargs in Python
The **kwargs collect all the keyword arguments that are not explicitly defined. Thus, it does the same operation as *args but for keyword ......
Read more >*args and **kwargs in Python - GeeksforGeeks
The special syntax **kwargs in function definitions in python is used to pass a keyworded, variable-length argument list. We use the name kwargs...
Read more >Python - Understanding args, kwargs in functions
*args and **kwargs allow you to pass multiple arguments and keyword arguments to a function. Let's explain *args and **kwargs through basic ...
Read more >What is the purpose and use of **kwargs? - Stack Overflow
The usage of the two asterisk before the parameter name, **kwargs, is when one doesn't know how many keyword arguments will be passed...
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
If no one has started working on this issue I’d like to give it a try!
Thanks @Embot2000 - that looks like a good start. I might hold off on the last two since they’re kwargs to external functions in numpy and scipy.
On the feature side, I think you have it covered. We could also look at some other parts of the package after that, eg effects and decompose, but let’s get the feature parts done first.