Skip to content

Make Q2 customizable - #854

Merged
lostanlen merged 8 commits into
kymatio:devfrom
changhongw:fix-853
Jun 17, 2022
Merged

Make Q2 customizable#854
lostanlen merged 8 commits into
kymatio:devfrom
changhongw:fix-853

Conversation

@changhongw

@changhongw changhongw commented Jun 8, 2022

Copy link
Copy Markdown
Collaborator

Fix #853

This PR makes it flexible for users to specify the number of wavelets per octave at the first and second order scattering. Both cases are working:

  • Set Q as an integer: Q = Q1. In this case, we use Q1 wavelets per octave at the first order and that for the second order defaults to one.
  • Set Q as a tuple: Q = (Q1, Q2), where users can specify both Q1 and Q2 according to their needs.

@changhongw changhongw added this to the 0.3.alpha milestone Jun 8, 2022
@changhongw
changhongw requested review from janden and lostanlen June 8, 2022 08:24
@changhongw changhongw changed the title Fix 853 Make Q2 customizable Jun 8, 2022
@lostanlen
lostanlen changed the base branch from master to dev June 8, 2022 08:39
@lostanlen

Copy link
Copy Markdown
Collaborator

This is built on top of #850 , which closes #849

@lostanlen lostanlen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice work, have you tested it?

The code looks greatl but the documentation could be improved a bit. See my comments

Thanks!

Comment thread kymatio/scattering1d/frontend/base_frontend.py Outdated
Comment thread kymatio/scattering1d/frontend/base_frontend.py
Comment thread kymatio/scattering1d/frontend/base_frontend.py Outdated
Comment thread kymatio/scattering1d/filter_bank.py Outdated
Comment thread tests/scattering1d/test_torch_scattering1d.py
Comment thread kymatio/scattering1d/filter_bank.py Outdated
Comment thread tests/scattering1d/test_keras_scattering1d.py
@changhongw
changhongw requested review from cyrusasfa and lostanlen June 9, 2022 12:52
Comment thread tests/scattering1d/test_torch_scattering1d.py
Comment thread tests/scattering1d/test_numpy_scattering1d.py
Comment thread tests/scattering1d/test_keras_scattering1d.py
Comment thread kymatio/scattering1d/frontend/base_frontend.py Outdated
@lostanlen

Copy link
Copy Markdown
Collaborator

i have attempted a rebase. fingers crossed

@cyrusasfa

Copy link
Copy Markdown
Collaborator

i have attempted a rebase. fingers crossed

yes the merge with your latest changes on dev should be sufficient

@MuawizChaudhary MuawizChaudhary left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR adds a feature where users can specify the Q parameter of the 2nd order wavelets.

I approve this change.

Comment thread kymatio/scattering1d/filter_bank.py Outdated
Comment thread kymatio/scattering1d/frontend/base_frontend.py
@lostanlen

Copy link
Copy Markdown
Collaborator

we're waiting for @cyrusvahidi to approve the tests

Comment thread tests/scattering1d/test_torch_scattering1d.py Outdated
Comment thread tests/scattering1d/test_torch_scattering1d.py Outdated
@changhongw
changhongw requested a review from cyrusasfa June 13, 2022 15:21

@cyrusasfa cyrusasfa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

still need to check that for a dummy input Scattering1D returns the same thing for Q = (8, ) and Q = (8, 1)

@changhongw

Copy link
Copy Markdown
Collaborator Author

@changhongw changhongw closed this Jun 14, 2022
@changhongw
changhongw deleted the fix-853 branch June 14, 2022 12:51
@changhongw
changhongw restored the fix-853 branch June 14, 2022 12:51
@changhongw changhongw reopened this Jun 14, 2022
Comment thread kymatio/scattering1d/frontend/base_frontend.py Outdated

@lostanlen lostanlen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like tests are passing again. It's just that the current error message is not accurate:

Q should be an integer, a 1-tuple, or a 2-tuple.

Comment thread kymatio/scattering1d/frontend/base_frontend.py Outdated
@lostanlen

Copy link
Copy Markdown
Collaborator
        if not A.is_cuda or not B.is_cuda:
>           raise TypeError('Input and filter must be CUDA tensors.')
E           TypeError: Input and filter must be CUDA tensors.

Comment thread tests/scattering1d/test_torch_scattering1d.py Outdated
Comment thread tests/scattering1d/test_torch_scattering1d.py
@lostanlen

Copy link
Copy Markdown
Collaborator

Thank you so much @changhongw 🎉

@lostanlen
lostanlen merged commit a776d57 into kymatio:dev Jun 17, 2022
lostanlen added a commit to danedane-haider/kymatio that referenced this pull request Jun 19, 2022
in light of kymatio#854 and kymatio#882
enable TeX rendering
lostanlen added a commit that referenced this pull request Jun 20, 2022
by Daniel Haider and Vincent Lostanlen
approved by Muawiz Chaudhary and Joakim Andén

* Update plot_filters.py

* Update plot_filters.py

* Update plot_filters.py

Edits as required:
- original formatting
- line width reduction
- psi <- psi_i

* Update plot_filters.py

* update examples/1d/plot_filters

in light of #854 and #882
enable TeX rendering

Co-authored-by: Vincent Lostanlen <vincent.lostanlen@ls2n.fr>
eickenberg pushed a commit that referenced this pull request Jul 5, 2022
* move Q check to ScatteringBase1D.build

* Tuneable Q2

* test on GPU

* Update base_frontend.py

* Update base_frontend.py

* Update test_torch_scattering1d.py

* skip `_skcuda`

* Update test_torch_scattering1d.py

Co-authored-by: Vincent Lostanlen <vincent.lostanlen@ls2n.fr>
eickenberg pushed a commit that referenced this pull request Jul 5, 2022
by Daniel Haider and Vincent Lostanlen
approved by Muawiz Chaudhary and Joakim Andén

* Update plot_filters.py

* Update plot_filters.py

* Update plot_filters.py

Edits as required:
- original formatting
- line width reduction
- psi <- psi_i

* Update plot_filters.py

* update examples/1d/plot_filters

in light of #854 and #882
enable TeX rendering

Co-authored-by: Vincent Lostanlen <vincent.lostanlen@ls2n.fr>
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.

Q2 is not customizable

4 participants