-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fixes #320 #321
Merged
BradyPlanden
merged 15 commits into
develop
from
320-bug-fix-integration-tests-post-304
May 17, 2024
Merged
Fixes #320 #321
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c7df8c7
fixes parameterisation integration test
BradyPlanden 46d5c46
tighten assertions, split scipy.minimize
BradyPlanden 993c8af
splits integration asserts per pybamm version
BradyPlanden 5943c0a
shift infeasible integration test to pybop.Adam
BradyPlanden 8576c8a
test(integr): Adds x0 resampling to SciPyMinimize
BradyPlanden 44c7bb8
test(integ): Adjusts sigma0, adds coverage for prior updt
BradyPlanden 9e6e4b6
test: increase assert for PSO
BradyPlanden c3bb6ec
test: extend unchanged iterations
BradyPlanden 46791a1
Merge branch 'develop' into 320-bug-fix-integration-tests-post-304
BradyPlanden 1eb817a
fix: docstrings, tests, add changlog entry
BradyPlanden 0c1421c
fix(test): Shrink parameterisation test solution distribution
BradyPlanden 1b522ed
Merge branch 'develop' into 320-bug-fix-integration-tests-post-304
BradyPlanden 0af5a87
fix(test): splits flaky optimisers to simple model, adds flaky plugin
BradyPlanden ecde0d8
Merge branch 'develop' into 320-bug-fix-integration-tests-post-304
BradyPlanden 0d0e214
fix: name change for concistency, revert solution distribution shrink
BradyPlanden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
super().__init__() | ||
self.method = method | ||
self.bounds = bounds | ||
self.num_resamples = 40 | ||
self.tol = tol | ||
self.options = {} | ||
self._max_iterations = maxiter | ||
|
@@ -56,11 +57,21 @@ | |
def callback(x): | ||
self.log.append([x]) | ||
|
||
# Scale the cost function and eliminate nan values | ||
# Check x0 and resample if required | ||
self.cost0 = cost_function(x0) | ||
self.inf_count = 0 | ||
if np.isinf(self.cost0): | ||
raise Exception("The initial parameter values return an infinite cost.") | ||
for i in range(1, self.num_resamples): | ||
x0 = cost_function.problem.sample_initial_conditions(seed=i) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be updated in #322 to work with costs without a problem. |
||
self.cost0 = cost_function(x0) | ||
if not np.isinf(self.cost0): | ||
break | ||
if np.isinf(self.cost0): | ||
raise ValueError( | ||
"The initial parameter values return an infinite cost." | ||
) | ||
|
||
# Scale the cost function and eliminate nan values | ||
self.inf_count = 0 | ||
|
||
def cost_wrapper(x): | ||
cost = cost_function(x) / self.cost0 | ||
|
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is intentionally left without an set/get as #255 enables kwargs to this class, which will be added once that is merged.