Skip to content
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

Fix how sample function handles Processed inputs #25

Merged
merged 8 commits into from
May 28, 2024

Conversation

denismelanson
Copy link
Contributor

Fixes #22

@denismelanson
Copy link
Contributor Author

We should write tests to ensure that these different types of inputs are handled properly going forward. I'm still new to this repo, so I would like some guidance as to how to write the tests for these functions.

@KaelanDt
Copy link
Contributor

We should write tests to ensure that these different types of inputs are handled properly going forward. I'm still new to this repo, so I would like some guidance as to how to write the tests for these functions.

Indeed this wasn't properly tested, so good idea. I realise we don't really have tests for the sampler functions by themselves (only by proxy in the test_log_prob.py file, so it could be good to write one an include an example with ProcessedDriftMatrix and ProcessedDiffusionMatrix if you want! You can look at these tests https://github.com/normal-computing/thermox/blob/main/tests/test_log_prob.py for inspiration

@SamDuffield
Copy link
Contributor

Tests could definitely do with an upgrade, I would be in favour of having refactoring to have test file for each code file, i.e. test_linalg.py, test_prob.py, test_sampler.py, test_utils.py

@denismelanson
Copy link
Contributor Author

denismelanson commented May 15, 2024

I see a potential problem with how this function handles ProcessedDriftMatrix.
Reading the docs, it seems like for the A argument, one can use an array representing the drift matrix or a ProcessedDriftMatrix instance generated by utils.preprocess_drift_matrix. However, the code actually needs the transformed and preprocessed A_y matrix generated by utils.preprocess. This seemed unintuitive to me and caused me some confusion, so I imagine it could for other users as well.

I'm wondering if we could fix this by simply adding more details in the docstring of the function. Alternatively, we could remove the support for Processed inputs and always ensure we preprocess the inputs the correct way.

@denismelanson denismelanson marked this pull request as ready for review May 22, 2024 14:49
thermox/prob.py Outdated Show resolved Hide resolved
thermox/utils.py Show resolved Hide resolved
@SamDuffield SamDuffield merged commit 2f395b0 into main May 28, 2024
2 checks passed
@SamDuffield SamDuffield deleted the fix_solve_processed_inputs branch May 28, 2024 16:37
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.

sample function not handling Processed input matrices
3 participants