-
Notifications
You must be signed in to change notification settings - Fork 39
Add lazy init to packets for partial tree expansion #96
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
Conversation
|
I was merging, but then I thought that not computing the entire tree immediately should never be a problem. We eagerly computed the entire tree because we knew we needed it for the deepfake detection project. But generally speaking, we don't know which parts of the tree a user might want to expand. So I am thinking we should never compute the entire tree by default. |
|
If that's true, we don't need the |
|
I merged main into this PR. The product of the tested parameters gets quite high, running the full test suite show 11227 test for the packets module alone. We might want to consider reducing this |
|
I think we should not have the |
|
We could change the default value of |
|
But then we have to keep all of the old eager code. I don't see why we would do that. It just adds extra complexity. |
|
Wait, let's not duplicate work. @felixblanke, are you doing this already? |
|
okay I am doing it. |
|
Ah, wait. I am on it :D |
|
Okay I am done and running the tests. |
|
It looks like we can just remove the old recursive code without too much of a hassle. |
|
Turns out it works in most cases: FAILED tests/test_packets.py::test_partial_expansion_1d[zero-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_1d[zero-db4] - assert False
FAILED tests/test_packets.py::test_partial_expansion_1d[reflect-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_1d[reflect-db4] - assert False
FAILED tests/test_packets.py::test_partial_expansion_1d[constant-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_1d[constant-db4] - assert False
FAILED tests/test_packets.py::test_partial_expansion_1d[boundary-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_1d[boundary-db4] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[zero-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[zero-db4] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[reflect-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[reflect-db4] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[constant-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[constant-db4] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[boundary-haar] - assert False
FAILED tests/test_packets.py::test_partial_expansion_2d[boundary-db4] - assert False
FAILED tests/test_packets.py::test_inverse_boundary_packet_1d - KeyError: 'Key da not found'
FAILED tests/test_packets.py::test_inverse_boundary_packet_2d - KeyError: 'Key aa not found'failed with the current code. |
|
I am leaving for today, but am happy to look at this again tomorrow. |
|
I added the function |
|
I am convinced this works. Lets merge. |
Adds lazy initialization to wavelet packet objects and addresses #91.
Adds the option to lazy initialize a wavelet packet object by passing
lazy_init=Trueto__init__ortransform.In the case, we avoid doing a expansion of the full packet tree.
If the user tries to access access a key not yet contained in the dict, we calculate the missing coeffs on the fly.
This allows for siginificant speedups if we are not interested in the full tree but only a subset of the nodes
The example of issue #69 is presented below:
which outputs