Skip to content

MAINT deprecate self.N and self.J_pad in 1D #863

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

Merged
merged 38 commits into from
Jun 18, 2022

Conversation

lostanlen
Copy link
Collaborator

@lostanlen lostanlen commented Jun 9, 2022

Fixes #857

An important deprecation to set before we release v0.3 is J_pad. Indeed, there won't be a J_pad_fr in JTFS, so it'd best to plan for symmetry in design.

_N_padded, _N_padded_fr
J, J_fr
Q, Q_fr
T, F
log2_T, log2_F

I have moved the shape check to its own static method. We'll be able to call this method a second time inside self._check_input(x) (recently merged!)

Copy link
Collaborator

@MuawizChaudhary MuawizChaudhary left a comment

Choose a reason for hiding this comment

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

I approve.

@lostanlen lostanlen changed the title Redefine n 1 d bis Redefine self.N in 1D, deprecate self.J_pad Jun 9, 2022
@lostanlen
Copy link
Collaborator Author

next up, fix the newly introduced DeprecationWarning in scattering_filter_factory !

@lostanlen lostanlen marked this pull request as draft June 10, 2022 05:32
@lostanlen lostanlen changed the title Redefine self.N in 1D, deprecate self.J_pad Redefine self.N in 1D, deprecate self.J_pad, new 1D shape checks Jun 10, 2022
@lostanlen lostanlen marked this pull request as ready for review June 10, 2022 15:41
@lostanlen lostanlen changed the title Redefine self.N in 1D, deprecate self.J_pad, new 1D shape checks Redefine self.N in 1D, deprecate self.J_pad Jun 11, 2022
@lostanlen
Copy link
Collaborator Author

i have reduced the PR size. this runtime shape check i experimented with should happen in a separate PR, ideally a backend agnostic one

@codecov-commenter
Copy link

codecov-commenter commented Jun 11, 2022

Codecov Report

Merging #863 (6c1168c) into dev (a776d57) will decrease coverage by 0.14%.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##              dev     #863      +/-   ##
==========================================
- Coverage   88.22%   88.08%   -0.15%     
==========================================
  Files          64       64              
  Lines        2242     2249       +7     
==========================================
+ Hits         1978     1981       +3     
- Misses        264      268       +4     
Flag Coverage Δ
jenkins_main 88.08% <83.33%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
kymatio/scattering1d/frontend/base_frontend.py 92.92% <76.47%> (-3.70%) ⬇️
kymatio/scattering1d/filter_bank.py 94.39% <100.00%> (-0.11%) ⬇️
kymatio/scattering1d/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a776d57...6c1168c. Read the comment docs.

@lostanlen lostanlen requested a review from eickenberg June 12, 2022 05:17
Copy link
Collaborator

@MuawizChaudhary MuawizChaudhary left a comment

Choose a reason for hiding this comment

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

Looking to @janden for a final approval.

@lostanlen lostanlen mentioned this pull request Jun 15, 2022
@lostanlen lostanlen added the 1D Issue with 1D scattering code label Jun 15, 2022
@lostanlen
Copy link
Collaborator Author

@MuawizChaudhary i think @janden already approved the overall idea, and we talked about that during the meeting yesterday. I think i can speak for him that either you or @cyrusvahidi are free to merge it

@cyrusasfa
Copy link
Collaborator

@MuawizChaudhary i think @janden already approved the overall idea, and we talked about that during the meeting yesterday. I think i can speak for him that either you or @cyrusvahidi are free to merge it

can you resolve the conflicts?

@lostanlen
Copy link
Collaborator Author

done

@lostanlen
Copy link
Collaborator Author

Rebased from #854, which was relying on the old semantics (2**J_scattering)

@MuawizChaudhary please, can we make this PR next in line for merging?

@MuawizChaudhary
Copy link
Collaborator

The pull request fulfills the specifications laid out by @lostanlen and @janden in issue #857 . Therefore I am merging.

If there are any complaints about the design proposed here, please make an issue or discuss it during our next weekly meeting.

Copy link
Collaborator

@janden janden left a comment

Choose a reason for hiding this comment

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

Looks good but we're now missing docstring for N, J in scattering_filter_factory.

@janden
Copy link
Collaborator

janden commented Jun 20, 2022

Will make an issue.

@lostanlen
Copy link
Collaborator Author

oops! yes good catch, needs a new doc now.

thanks for merging 🙏🏻

janden added a commit to janden/kymatio that referenced this pull request Jun 23, 2022
lostanlen pushed a commit that referenced this pull request Jun 23, 2022
* FIX Update examples/1d/plot_filters.py

As a consequence of #863.

* FIX Update examples/2d/plot_filters

Add new levels key.
@lostanlen lostanlen deleted the redefine-N-1D-bis branch June 25, 2022 16:23
eickenberg pushed a commit that referenced this pull request Jul 5, 2022
* redefine self.N, deprecate self.J_pad

* deprecationwarning

* restore self.vectorize (temporarily)

* bugfix _get_input_length

* J_pad = int(np.log2(self.N))

* bugfix _check_input

* revert to _check_input, write _get_shapes

* update _get_shapes

* try calling self._get_shapes in frontends

* shape_fn in _get_shapes

* write tensorflow shape_fn

* move _check_input into _get_shapes

* remove self._check_input

* bugfix tensorflow shape check

* reduce PR size

_get_shapes was not a good idea

* reduce PR size (bis)

* reduce PR size (ter)

* (quater)

* convert self.shape to tuple for type stability

* deprecate N, store _N_padded

* call scattering_filter_factory with 2**self._N_padded

* documentation

* bugfix `N(self)` property

* bugfix call to create_filters

* update scattering_filter_factory prototype

* update the numpy test

* bugfix input length check test

* clarify DeprecationWarning

* bugfix

* review by rastegah

* remove unnecessary import

* update DeprecationWarning

* update documentation

* rebase from PR 854
eickenberg pushed a commit that referenced this pull request Jul 5, 2022
* FIX Update examples/1d/plot_filters.py

As a consequence of #863.

* FIX Update examples/2d/plot_filters

Add new levels key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1D Issue with 1D scattering code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants