Updates to #236 to avoid breaking change to pybop.Optimisation#309
Merged
Conversation
…sation APIs, updts where required, moves _optimisation to optimisers/
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 236-scipy-kwargs #309 +/- ##
====================================================
+ Coverage 96.81% 96.98% +0.16%
====================================================
Files 40 41 +1
Lines 2201 2222 +21
====================================================
+ Hits 2131 2155 +24
+ Misses 70 67 -3 ☔ View full report in Codecov by Sentry. |
14 tasks
Member
Author
|
Ugh, the recent file rename messed with the number of changes. Happy to revert it to help with review, it's needed to remove circular import issue in the |
Member
|
Yes please do revert it @BradyPlanden, let's change the filenames at the end once both PRs are ready. |
cde3d07 to
5652597
Compare
NicolaCourtier
approved these changes
May 16, 2024
NicolaCourtier
left a comment
Member
There was a problem hiding this comment.
Thanks @BradyPlanden for the addition of the Optimisation wrapper!
NicolaCourtier
added a commit
that referenced
this pull request
May 22, 2024
* Enable passing of kwargs to SciPy * Update checks on bounds * Add update_options and error for Pints * Rename opt to optim * Remove stray comments * Add BaseSciPyOptimiser and BasePintsOptimiser * Align optimiser option setting * Update notebooks with kwargs * Update scripts with kwargs * Update notebooks * Align optimisers with Optimisation as base class * Update stopping criteria in spm_NelderMead.py Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update stopping criteria in spm_adam.py Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update sigma0 in spm_descent.py Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update GradientDescent * Change update to set and check pints_method * Update test_optimisation_options * Update notebooks * Update set learning rate * Pop threshold * Fix bug in model.simulate * Update notebooks * Update test_models.py * Store SciPy result * Update x0 input and add tests * Update bounds to avoid x0 outside * Re-initialise pints_method on certain options * Update x0_new test * Update test_optimisation.py * Create initialise_method for PINTS optimisers * Align optimisation result * Update checks on bounds * Apply suggestions Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Add standalone optimiser * Simplify optimiser set-up and align _minimising * Update option setting in notebooks * Take abs of cost0 * Implement suggestions from Brady * Update tests and base option setting * Update test_invalid_cost * Increase coverage * Sort out notebook changes * Reset scale parameter * Move settings into arguments * Update comments * Update optimiser call * Move check on jac * Add assertions * Add maxiter to test * Add assertion * Update to lambda functions Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update comment Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update to list comprehension Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Formatting * Revert "Update to lambda functions" This reverts commit aa73bff. * Move minimising out of costs * Update description * Updates to #236 to avoid breaking change to `pybop.Optimisation` (#309) * Splits Optimisation -> BaseOptimiser/Optimisation, enables two optimisation APIs, updts where required, moves _optimisation to optimisers/ * increase coverage * Pass optimiser_kwargs though run() * updt examples * Converts DefaultOptimiser -> Optimisation * split Optimisation and BaseOptimsier classes, loosen standalone cost unit test * add incorrect attr test * fix: updt changelog entry, optimsation_interface notebook, review suggestions * fix: updt notebook state * Updt assertions, optimisation object name --------- Co-authored-by: NicolaCourtier <45851982+NicolaCourtier@users.noreply.github.com> * Rename method to pints_optimiser * Rename base_optimiser to pints_base_optimiser * Rename _optimisation to base_optimiser --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com>
BradyPlanden
added a commit
that referenced
this pull request
Jun 3, 2024
* Enable passing of kwargs to SciPy * Update checks on bounds * Add update_options and error for Pints * Rename opt to optim * Remove stray comments * Add BaseSciPyOptimiser and BasePintsOptimiser * Align optimiser option setting * Update notebooks with kwargs * Update scripts with kwargs * Update notebooks * Align optimisers with Optimisation as base class * Update stopping criteria in spm_NelderMead.py Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update stopping criteria in spm_adam.py Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update sigma0 in spm_descent.py Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update GradientDescent * Change update to set and check pints_method * Update test_optimisation_options * Update notebooks * Update set learning rate * Pop threshold * Fix bug in model.simulate * Update notebooks * Update test_models.py * Store SciPy result * Update x0 input and add tests * Update bounds to avoid x0 outside * Re-initialise pints_method on certain options * Update x0_new test * Update test_optimisation.py * Create initialise_method for PINTS optimisers * Align optimisation result * Update checks on bounds * Apply suggestions Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Add standalone optimiser * Simplify optimiser set-up and align _minimising * Update option setting in notebooks * Take abs of cost0 * Implement suggestions from Brady * Update tests and base option setting * Update test_invalid_cost * Increase coverage * Sort out notebook changes * Reset scale parameter * Move settings into arguments * Update comments * Update optimiser call * Move check on jac * Add assertions * Add maxiter to test * Add assertion * Update to lambda functions Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update comment Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Update to list comprehension Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> * Formatting * Revert "Update to lambda functions" This reverts commit aa73bff. * Move minimising out of costs * Update description * Updates to #236 to avoid breaking change to `pybop.Optimisation` (#309) * Splits Optimisation -> BaseOptimiser/Optimisation, enables two optimisation APIs, updts where required, moves _optimisation to optimisers/ * increase coverage * Pass optimiser_kwargs though run() * updt examples * Converts DefaultOptimiser -> Optimisation * split Optimisation and BaseOptimsier classes, loosen standalone cost unit test * add incorrect attr test * fix: updt changelog entry, optimsation_interface notebook, review suggestions * fix: updt notebook state * Updt assertions, optimisation object name --------- Co-authored-by: NicolaCourtier <45851982+NicolaCourtier@users.noreply.github.com> * Rename method to pints_optimiser * Rename base_optimiser to pints_base_optimiser * Rename _optimisation to base_optimiser --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR applies changes to #236 so that v24.5 does not have breaking changes in the
pybop.OptimisationAPI.Issue reference
Fixes # N/A
Review
Before you mark your PR as ready for review, please ensure that you've considered the following:
Type of change
Key checklist:
$ pre-commit run(or$ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ nox -s tests$ nox -s doctestYou can run integration tests, unit tests, and doctests together at once, using
$ nox -s quick.Further checks:
Thank you for contributing to our project! Your efforts help us to deliver great software.