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

Release v24.9.0 #491

Merged
merged 541 commits into from
Sep 11, 2024
Merged
Changes from 6 commits
Commits
Show all changes
541 commits
Select commit Hold shift + click to select a range
a5244a4
Merge branch 'refs/heads/develop' into monte-carlo-methods
BradyPlanden Aug 7, 2024
15d21b1
Fix parameter set logic and allow FittingProblem to take init_ocv rat…
NicolaCourtier Aug 7, 2024
255aa5d
Merge branch 'refs/heads/develop' into monte-carlo-methods
BradyPlanden Aug 7, 2024
3861461
Initial examples
BradyPlanden Aug 5, 2024
e2816bd
Update problem.evaluate failure object type, add IDAKLU logic to Base…
BradyPlanden Aug 8, 2024
1cd175a
Update solver examples, property
BradyPlanden Aug 8, 2024
a921c8f
Add changelog entry, tidy.
BradyPlanden Aug 8, 2024
993e576
feat: refactor cost.compute/S1 into single method, refactor cost.eval…
BradyPlanden Aug 8, 2024
dac1e08
fix: update tests, correct cost call across codebase
BradyPlanden Aug 8, 2024
dca3984
tests: align multi-signal spm parameterisation, fix incorrect MLE exa…
BradyPlanden Aug 8, 2024
10b24d7
fix: Incorrect likelihood calculation, add dynamic bounds to sigma, r…
BradyPlanden Aug 9, 2024
95cea43
feat: updated cost.compute method for arg only calc (no-longer via se…
BradyPlanden Aug 9, 2024
df429f7
Merge model build and rebuild (#451)
NicolaCourtier Aug 9, 2024
73b38b7
refactor: construct fail return attrs in BaseCost, fix unit test, upd…
BradyPlanden Aug 9, 2024
ace4846
Add changelog entry
BradyPlanden Aug 9, 2024
61bf719
fix: tidy BaseCost.__call__
BradyPlanden Aug 9, 2024
47d8e59
Merge branch 'refs/heads/develop' into 436-refactor-cost_evaluate-met…
BradyPlanden Aug 9, 2024
e07118a
Apply suggestions from code review
BradyPlanden Aug 9, 2024
ef37872
tests: increase bounds for better stability for initial samples with …
BradyPlanden Aug 12, 2024
5303d45
tests: Add test for grad compute w/o dy
BradyPlanden Aug 12, 2024
21e9d38
Merge branch 'refs/heads/develop' into 410-bug-incorrect-axis-symbol-…
BradyPlanden Aug 12, 2024
a3260c6
notebooks: rerun after merge
BradyPlanden Aug 12, 2024
778a72f
Add MultiFittingProblem class and example (#364)
NicolaCourtier Aug 12, 2024
debf890
apply fixes from code review
BradyPlanden Aug 12, 2024
c3bde2d
Merge branch 'refs/heads/develop' into 160-idaklu-solver
BradyPlanden Aug 12, 2024
7156181
Merge branch 'refs/heads/develop' into 436-refactor-cost_evaluate-met…
BradyPlanden Aug 12, 2024
65c1c6c
examples: updt state of solver_selection.ipynbgi
BradyPlanden Aug 12, 2024
6de9d66
chore: update pre-commit hooks
pre-commit-ci[bot] Aug 12, 2024
68774e4
Merge pull request #450 from pybop-team/160-idaklu-solver
BradyPlanden Aug 13, 2024
2042cf4
Merge pull request #456 from pybop-team/pre-commit-ci-update-config
BradyPlanden Aug 13, 2024
f1061e1
fix: updates benchmarks for recent API changes, adds quick benchmarki…
BradyPlanden Aug 13, 2024
9f859a7
fix: update workflow with machine name
BradyPlanden Aug 13, 2024
809b682
fix: update workflow with machine name, dependencies
BradyPlanden Aug 13, 2024
a57e165
fix: update asv positional args
BradyPlanden Aug 13, 2024
6569639
fix: add asv commit arg
BradyPlanden Aug 13, 2024
c0be8af
fix: add checkout develop command to asv
BradyPlanden Aug 13, 2024
2cd5f2f
test ubuntu-latest for clarity
BradyPlanden Aug 13, 2024
13a6c0a
revert ubuntu-latest, add fetch-depth to checkout-actions
BradyPlanden Aug 13, 2024
5c36f09
test for shell variants, update target to HEAD
BradyPlanden Aug 13, 2024
c9946da
Merge branch 'refs/heads/develop' into monte-carlo-methods
BradyPlanden Aug 13, 2024
45d84cd
fix: remove verbose output
BradyPlanden Aug 13, 2024
2539538
Catch attribute error when trying to sample from constant parameter
MarkBlyth Aug 13, 2024
cd07072
refactor: ComposedLogPrior -> JointLogPrior, prior.evaluateS1 -> logp…
BradyPlanden Aug 13, 2024
08dc407
fix: update tests for low convergence sampler
BradyPlanden Aug 13, 2024
c225065
refactor: update priors, refactor JointLogPrior
BradyPlanden Aug 14, 2024
4df0885
tests: update unit tests and increase coverage.
BradyPlanden Aug 14, 2024
e50812a
refactor: base_sampler init, update docstrings, update tests, remove …
BradyPlanden Aug 14, 2024
cdb724d
tests: add new_copy() unit test for model.pybamm_model == None
BradyPlanden Aug 14, 2024
0ea98c2
Merge branch 'develop' into 410-bug-incorrect-axis-symbol-rendering-f…
BradyPlanden Aug 14, 2024
0999f61
Merge branch 'refs/heads/develop' into 436-refactor-cost_evaluate-met…
BradyPlanden Aug 14, 2024
0698db1
Merge branch 'refs/heads/develop' into 269-add-eis-parameter-identifi…
BradyPlanden Aug 14, 2024
bd6a820
fix: post merge additions
BradyPlanden Aug 14, 2024
6203281
feat: removes EISProblem, updates FittingProblem
BradyPlanden Aug 14, 2024
085a282
Merge branch 'develop' into 454-bug-fix-failing-benchmarks
BradyPlanden Aug 14, 2024
958dfa0
tests: adds eis unit tests, refactors
BradyPlanden Aug 14, 2024
7a000cf
tests: increase coverage, remove redundant ValueError, sampler.chains…
BradyPlanden Aug 14, 2024
b6375f9
refactor: SymbolReplacer for clarity, adds pre-commit skips for req. …
BradyPlanden Aug 14, 2024
711dcc8
tests: restore parallel optimisation with thread limit to 1
BradyPlanden Aug 14, 2024
363d25a
tests: Adds install_plotly() as static method, used for test_plots.py
BradyPlanden Aug 14, 2024
e571b8d
tests: Adds nyquist plot tests
BradyPlanden Aug 15, 2024
d519429
Update CHANGELOG.md
Dibyendu-IITKGP Aug 15, 2024
6479a18
Merge branch 'develop' into 454-bug-fix-failing-benchmarks
BradyPlanden Aug 15, 2024
a5ce284
Merge pull request #457 from pybop-team/454-bug-fix-failing-benchmarks
BradyPlanden Aug 16, 2024
563737e
tests: adds integration tests for eis fitting, update problem.evaluat…
BradyPlanden Aug 16, 2024
d8f0be9
lychee - add exclusion link for w3.org, increase n_frequency for eis …
BradyPlanden Aug 19, 2024
000ba88
lychee fix, increase increase eis iterations arg, remove try-except
BradyPlanden Aug 19, 2024
bab82a6
Merge branch 'refs/heads/develop' into 269-add-eis-parameter-identifi…
BradyPlanden Aug 19, 2024
823cc4b
tests: increase coverage, try-except, infeasible parameter values
BradyPlanden Aug 19, 2024
9e74e1a
feat: adds multi-dimensional sigma0 values to AdamW, updates integrat…
BradyPlanden Aug 19, 2024
9b84c1e
tests: adds direct try-except coverage, w/ verbose
BradyPlanden Aug 19, 2024
100d65e
tests: adds tests for frequency dataset.check(), nyquist w/o inputs
BradyPlanden Aug 19, 2024
9ce312e
chore: update pre-commit hooks
pre-commit-ci[bot] Aug 19, 2024
a4b00fd
Merge pull request #463 from pybop-team/pre-commit-ci-update-config
BradyPlanden Aug 20, 2024
beb28d1
add changelog entry, remove redundant builds()
BradyPlanden Aug 20, 2024
44f50f7
Remove inputs from compute()
NicolaCourtier Aug 20, 2024
ed51bd8
Merge branch 'develop' into 436-refactor-cost_evaluate-methods-to-acc…
NicolaCourtier Aug 20, 2024
61b6f72
apply changes from review
BradyPlanden Aug 20, 2024
ebc0446
Fix typo
NicolaCourtier Aug 20, 2024
4bf4e76
Merge branch 'develop' into 269-add-eis-parameter-identification-methods
BradyPlanden Aug 20, 2024
8cada6f
Merge pull request #455 from pybop-team/436-refactor-cost_evaluate-me…
BradyPlanden Aug 20, 2024
d66e206
Merge branch 'refs/heads/develop' into 269-add-eis-parameter-identifi…
BradyPlanden Aug 21, 2024
b53a95b
fix: missed merge items, update docstrings
BradyPlanden Aug 21, 2024
a8b0d10
Refactor update_capacity
NicolaCourtier Aug 21, 2024
158666f
Update CHANGELOG.md
NicolaCourtier Aug 21, 2024
9f4bd11
Update test_weighted_cost.py
NicolaCourtier Aug 21, 2024
4f74374
Update notebook
NicolaCourtier Aug 21, 2024
d7b939f
Add checks on warnings
NicolaCourtier Aug 21, 2024
b46239b
Update time_data along with target
NicolaCourtier Aug 21, 2024
2935911
Reset time_data setter
NicolaCourtier Aug 21, 2024
395363f
Use time_data setter in test_observers
NicolaCourtier Aug 21, 2024
d798870
Update set_formation_concentrations
NicolaCourtier Aug 21, 2024
904fd77
adds Thevenin EIS args, small cleanup
BradyPlanden Aug 21, 2024
f6530d5
fix: extends eis integration parameter bounds, clips ground truth sam…
BradyPlanden Aug 21, 2024
6a6b7dd
tests: removes sigma assert for GaussianLogLikehood w/ eis parameteri…
BradyPlanden Aug 21, 2024
d414460
Merge pull request #405 from pybop-team/269-add-eis-parameter-identif…
BradyPlanden Aug 22, 2024
df1cc73
Merge branch 'refs/heads/develop' into monte-carlo-methods
BradyPlanden Aug 22, 2024
bca3bbb
Merge branch 'refs/heads/develop' into monte-carlo-methods
BradyPlanden Aug 22, 2024
f71693c
Merge branch 'develop' into 464-design-updating
NicolaCourtier Aug 22, 2024
acd00a4
Fix merge
NicolaCourtier Aug 22, 2024
1762182
Merge branch 'develop' into master
MarkBlyth Aug 22, 2024
86aa8fd
style: pre-commit fixes
pre-commit-ci[bot] Aug 22, 2024
d1e84b9
Produce warning when solver terminates prematurely
MarkBlyth Aug 22, 2024
ec0e12f
Merge branch 'master' of https://github.com/MarkBlyth/PyBOP_develop
MarkBlyth Aug 22, 2024
cc73a4b
examples: adds example for cost/likelihood class evaluation and compute
BradyPlanden Aug 22, 2024
0bf3009
Create creating_a_model.ipynb
Aug 22, 2024
0388795
Add missing string formatter
MarkBlyth Aug 22, 2024
7237673
style: pre-commit fixes
pre-commit-ci[bot] Aug 22, 2024
9e45768
Move ecm_trust-constr example from script to notebook
MarkBlyth Aug 22, 2024
1f7c3b7
Remove solver termination warning
MarkBlyth Aug 22, 2024
ce19560
Update check_params to new API
MarkBlyth Aug 22, 2024
76d3b9a
style: pre-commit fixes
pre-commit-ci[bot] Aug 22, 2024
add7cf2
#222 add electrode balancing example
brosaplanella Aug 22, 2024
261449b
style: pre-commit fixes
pre-commit-ci[bot] Aug 22, 2024
373d1f0
Add code coverage for no-prior handling
MarkBlyth Aug 22, 2024
42a5f93
Merge branch 'master' of https://github.com/MarkBlyth/PyBOP_develop
MarkBlyth Aug 22, 2024
1a76470
Add functional parameter example (#442)
NicolaCourtier Aug 22, 2024
211b417
Rescale cost value before logging
MarkBlyth Aug 22, 2024
2c401ed
Merge branch 'develop' into master
MarkBlyth Aug 22, 2024
19b46cf
style: pre-commit fixes
pre-commit-ci[bot] Aug 22, 2024
e691ebe
Merge branch 'develop' into issue-222-electrode-balancing
brosaplanella Aug 22, 2024
5de70d1
Update cost descriptions
NicolaCourtier Aug 22, 2024
46e5748
Move error catches to optimiser cost_call
NicolaCourtier Aug 22, 2024
302024d
Update pybop/optimisers/scipy_optimisers.py
MarkBlyth Aug 23, 2024
267c9e0
style: pre-commit fixes
pre-commit-ci[bot] Aug 23, 2024
2b3d45b
Import warnings
MarkBlyth Aug 23, 2024
7621916
style: pre-commit fixes
pre-commit-ci[bot] Aug 23, 2024
18337c9
Update pybop/optimisers/scipy_optimisers.py
MarkBlyth Aug 23, 2024
b4bc92d
style: pre-commit fixes
pre-commit-ci[bot] Aug 23, 2024
c0466df
Lower sample rate for speed
MarkBlyth Aug 23, 2024
e143e33
Merge branch 'master' of https://github.com/MarkBlyth/PyBOP_develop
MarkBlyth Aug 23, 2024
1eebc18
style: pre-commit fixes
pre-commit-ci[bot] Aug 23, 2024
3c4efee
Add apply_transform and log_update
NicolaCourtier Aug 23, 2024
f2f05c1
Update parameter.py
NicolaCourtier Aug 23, 2024
ad978a7
Merge branch 'develop' into 473-fix-transformations
NicolaCourtier Aug 23, 2024
d4b5092
Convert transformation to _transformation
NicolaCourtier Aug 23, 2024
b3a272d
Fix typo
NicolaCourtier Aug 23, 2024
417530f
Update scipy_optimisers.py
NicolaCourtier Aug 23, 2024
73bc851
Update optim.sigma0 default
NicolaCourtier Aug 23, 2024
3be6e9f
Update cost_call
NicolaCourtier Aug 23, 2024
84f8abb
Use Log gradient from PINTS
NicolaCourtier Aug 23, 2024
22e29d6
Use ScaledTransformation in test
NicolaCourtier Aug 23, 2024
d0c2f49
Update parameter rvs and add tests
NicolaCourtier Aug 24, 2024
e4fdedf
Remove unused line
NicolaCourtier Aug 24, 2024
4856cf0
Update parameter set descriptions
NicolaCourtier Aug 25, 2024
a4d1ee3
Remove unused input
NicolaCourtier Aug 25, 2024
093fe88
Fix predict parameter_set update
NicolaCourtier Aug 25, 2024
0017fcf
Allow skip if formation concentrations
NicolaCourtier Aug 25, 2024
db7d53c
Update notebook
NicolaCourtier Aug 25, 2024
1908765
#222 fix lychee failing link
brosaplanella Aug 25, 2024
4b1728d
Merge remote-tracking branch 'upstream/develop' into issue-222-electr…
brosaplanella Aug 25, 2024
19ad1b7
Merge branch 'issue-222-electrode-balancing' of github.com:brosaplane…
brosaplanella Aug 25, 2024
efe3c1c
#222 implement Nicola's comments
brosaplanella Aug 25, 2024
23a2c69
#222 add CHANGELOG line
brosaplanella Aug 25, 2024
b2ed501
style: pre-commit fixes
pre-commit-ci[bot] Aug 25, 2024
765ed67
chore: update pre-commit hooks
pre-commit-ci[bot] Aug 26, 2024
0e29ef0
Merge pull request #475 from pybop-team/pre-commit-ci-update-config
BradyPlanden Aug 27, 2024
30b6101
fix: updates scipy bounds with keep_feasible, clipping groundtruth fo…
BradyPlanden Aug 27, 2024
553d478
tests: increase coverage
BradyPlanden Aug 27, 2024
e20379c
Merge pull request #431 from pybop-team/all-contributors/add-MarkBlyth
BradyPlanden Aug 27, 2024
478a6bd
docs: update README.md [skip ci]
allcontributors[bot] Aug 27, 2024
cc2dd2e
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Aug 27, 2024
d063d0b
Merge branch 'develop' into 436-adds-compute-example
BradyPlanden Aug 27, 2024
f2afac6
Rename quick_plot.py to standard_plots.py (#469)
NicolaCourtier Aug 27, 2024
ae4404a
Merge pull request #472 from brosaplanella/issue-222-electrode-balancing
BradyPlanden Aug 27, 2024
df96cd0
Merge pull request #477 from pybop-team/all-contributors/add-brosapla…
BradyPlanden Aug 27, 2024
5b53ba7
Merge branch 'develop' into master
BradyPlanden Aug 28, 2024
83d5f09
examples: updates formatting and grammar
BradyPlanden Aug 28, 2024
cd07b14
Merge pull request #371 from MarkBlyth/master
BradyPlanden Aug 28, 2024
ee72d00
Merge branch 'develop' into 410-bug-incorrect-axis-symbol-rendering-f…
BradyPlanden Aug 28, 2024
3d29829
examples: update notebooks
BradyPlanden Aug 28, 2024
d734b3f
fix: remove kaleido/svg from nyquist.py
BradyPlanden Aug 28, 2024
f5135b8
Merge branch 'develop' into 464-design-updating
NicolaCourtier Aug 28, 2024
ac2075d
Merge branch 'develop' into 473-fix-transformations
NicolaCourtier Aug 28, 2024
d2cee47
style: pre-commit fixes
pre-commit-ci[bot] Aug 28, 2024
248b161
Merge branch 'refs/heads/develop' into monte-carlo-methods
BradyPlanden Aug 29, 2024
e80ee17
Merge branch 'develop' into 436-adds-compute-example
BradyPlanden Aug 29, 2024
503af19
Refactor and bugfixes. Adds gradient-based integration sampling tests…
BradyPlanden Aug 29, 2024
85e1ce1
Remainder review suggestions, update assert tolerances, small array d…
BradyPlanden Aug 30, 2024
af577a5
fix: update typehints for Python 3.9
BradyPlanden Aug 30, 2024
5a7be15
Merge pull request #480 from pybop-team/479-bug-type-hints-in-ecm_tau…
BradyPlanden Sep 2, 2024
8a928af
tests: increment iterations from scheduled test run
BradyPlanden Sep 2, 2024
855b606
Merge pull request #340 from pybop-team/monte-carlo-methods
BradyPlanden Sep 2, 2024
f580fc8
Update creating_a_model.ipynb
Sep 2, 2024
1dca584
Merge branch 'Try-Example-for-model-creation-#282' of https://github.…
Sep 2, 2024
990fc04
style: pre-commit fixes
pre-commit-ci[bot] Sep 2, 2024
081b157
chore: update pre-commit hooks
pre-commit-ci[bot] Sep 2, 2024
ab6eca5
Merge pull request #482 from pybop-team/pre-commit-ci-update-config
BradyPlanden Sep 3, 2024
0e3a1c0
refactor: removes pybop.MAP with replacement pybop.LogPosterior, adds…
BradyPlanden Sep 4, 2024
2dc511e
fix: updates for pybamm v24.9, adds IDAKLU t_interp functionality
BradyPlanden Sep 5, 2024
09c9dfb
feat: adds notebook renderer for plotly.pio, decreasing notebook sizes
BradyPlanden Sep 5, 2024
9d6d04d
Merge branch 'refs/heads/develop' into 410-bug-incorrect-axis-symbol-…
BradyPlanden Sep 5, 2024
a1a94ff
examples: restore scripts
BradyPlanden Sep 5, 2024
936e5e9
Update notebook, add type hints + docstring update
BradyPlanden Sep 5, 2024
7c9fd5f
tests: adds observer integration tests, small tidy to observer unit test
BradyPlanden Sep 6, 2024
8e9dacc
fix: convergence improvement for tau constrained thevenin example
BradyPlanden Sep 6, 2024
f4bb17b
Update pybop/models/lithium_ion/base_echem.py
NicolaCourtier Sep 6, 2024
9bfd948
examples: reduces runtime across examples
BradyPlanden Sep 6, 2024
dbbe820
Merge pull request #470 from pybop-team/436-adds-compute-example
Dibyendu-IITKGP Sep 6, 2024
7a140bb
Merge branch 'develop' into fix-pybamm-v249-breaking
BradyPlanden Sep 6, 2024
aaa5851
Merge pull request #485 from pybop-team/fix-pybamm-v249-breaking
BradyPlanden Sep 6, 2024
2abc0f2
Merge branch 'develop' into 464-design-updating
BradyPlanden Sep 6, 2024
03e096c
fix: updates for pybamm v24.9, adds IDAKLU t_interp functionality
BradyPlanden Sep 5, 2024
843d471
examples: restore scripts
BradyPlanden Sep 5, 2024
a3b2a54
tests: adds observer integration tests, small tidy to observer unit test
BradyPlanden Sep 6, 2024
47365f0
fix: convergence improvement for tau constrained thevenin example
BradyPlanden Sep 6, 2024
3760fac
examples: reduces runtime across examples
BradyPlanden Sep 6, 2024
831bc90
examples: adds example for cost/likelihood class evaluation and compute
BradyPlanden Aug 22, 2024
f9a1c23
examples: updates formatting and grammar
BradyPlanden Aug 28, 2024
3b0d43d
examples: update MAP notebook
BradyPlanden Sep 6, 2024
eb561fb
examples: adds example for cost/likelihood class evaluation and compute
BradyPlanden Aug 22, 2024
916f974
examples: updates formatting and grammar
BradyPlanden Aug 28, 2024
1fb5bcf
Merge branch 'refs/heads/develop' into 410-bug-incorrect-axis-symbol-…
BradyPlanden Sep 6, 2024
7e3d787
Merge branch 'refs/heads/develop' into 410-bug-incorrect-axis-symbol-…
BradyPlanden Sep 6, 2024
6b83edc
adds changelog entry, plotly notebook renderer to cost-compute-method…
BradyPlanden Sep 6, 2024
59c8c79
Merge pull request #411 from pybop-team/410-bug-incorrect-axis-symbol…
BradyPlanden Sep 6, 2024
121187c
Merge branch 'refs/heads/develop' into 464-design-updating
BradyPlanden Sep 7, 2024
c2333ba
Merge branch 'develop' into update-adamW-multi-dimensional-lr
BradyPlanden Sep 7, 2024
d4d31f5
fix: corrects Minkowski & SumofPower gradient calculations for non-in…
BradyPlanden Sep 7, 2024
856305e
Merge branch 'refs/heads/develop' into 459-replace-MAP-class
BradyPlanden Sep 8, 2024
0c69dad
examples: additions to MAP notebook
BradyPlanden Sep 9, 2024
f3a7b2c
tests: adds non logpdfS1 prior test for LogPosterior class
BradyPlanden Sep 9, 2024
db00871
Merge pull request #465 from pybop-team/464-design-updating
BradyPlanden Sep 9, 2024
79ad4f6
tests: adds parameters.__repr__ tests
BradyPlanden Sep 9, 2024
ef18243
examples: adds "notebook_connect" renderer
BradyPlanden Sep 9, 2024
3eef641
examples: updates to creating_a_model.ipynb
BradyPlanden Sep 9, 2024
970c35d
docs: update README.md [skip ci]
allcontributors[bot] Sep 9, 2024
12b3253
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Sep 9, 2024
04d1d19
examples: small fixes to maximum_a_posteriori.ipynb
BradyPlanden Sep 9, 2024
2d5e96c
Merge pull request #471 from f-g-r-i-m-m/Try-Example-for-model-creati…
BradyPlanden Sep 9, 2024
eb5a632
Merge pull request #486 from pybop-team/all-contributors/add-f-g-r-i-m-m
BradyPlanden Sep 9, 2024
1535fc5
Merge branch 'refs/heads/develop' into update-adamW-multi-dimensional-lr
BradyPlanden Sep 9, 2024
42932dc
tests: apply multi-dimensional step-size for GaussianLogLikelihood
BradyPlanden Sep 9, 2024
83c3621
Merge branch 'refs/heads/develop' into 473-fix-transformations
BradyPlanden Sep 9, 2024
56da0f1
removes try-except for BaseCost, moves cost_call logic into BaseCost.…
BradyPlanden Sep 9, 2024
9018f75
apply suggestions from review
BradyPlanden Sep 9, 2024
814a831
add changelog entry, tidy up.
BradyPlanden Sep 9, 2024
383419c
apply suggestion from review
BradyPlanden Sep 9, 2024
76de36a
chore: update pre-commit hooks
pre-commit-ci[bot] Sep 9, 2024
1822ddb
Merge pull request #483 from pybop-team/459-replace-MAP-class
martinjrobins Sep 9, 2024
0273bee
Merge pull request #488 from pybop-team/473b-fix-transformations
martinjrobins Sep 10, 2024
67a0432
Merge pull request #489 from pybop-team/pre-commit-ci-update-config
martinjrobins Sep 10, 2024
a4384e5
Merge branch 'refs/heads/develop' into 473-fix-transformations
BradyPlanden Sep 10, 2024
9516e78
Merge branch 'refs/heads/develop' into update-adamW-multi-dimensional-lr
BradyPlanden Sep 10, 2024
20b62ed
Adds changelog entry for #483
BradyPlanden Sep 10, 2024
ec58489
Adds changelog entry
BradyPlanden Sep 10, 2024
e0b8d29
Merge pull request #462 from pybop-team/update-adamW-multi-dimensiona…
BradyPlanden Sep 10, 2024
1c6073d
Merge pull request #474 from pybop-team/473-fix-transformations
BradyPlanden Sep 10, 2024
2d8e6e1
increment version to v24.9.0
BradyPlanden Sep 10, 2024
fd4aa76
Merge branch 'refs/heads/main' into release-v24.9
BradyPlanden Sep 10, 2024
061fef9
patch fix: transformation integration test stability
BradyPlanden Sep 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
371 changes: 371 additions & 0 deletions examples/notebooks/cost-compute-methods.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,371 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"source": [
"# Using the Cost/Likelihood classes\n",
"This example will introduce the cost function methods used for both evaluating the output of and predicting the forward model. This example will use a cost class (`pybop.SumofPower`) as an example, but the methods discussed here are transferable to the other cost classes as well as the likelihood classes.\n",
"\n",
"### Setting up the Environment\n",
"\n",
"Before we begin, we need to ensure that we have all the necessary tools. We will install PyBOP and upgrade dependencies:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"%pip install --upgrade pip ipywidgets -q\n",
"%pip install pybop -q"
]
},
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"source": [
"### Importing Libraries\n",
"\n",
"With the environment set up, we can now import PyBOP alongside other libraries we will need:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"import pybop"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"First, to construct a `pybop.Cost` class, we need the following objects:\n",
"- Model\n",
"- Dataset\n",
"- Parameters to identify\n",
"- Problem\n",
"\n",
"Given the above, we will first construct the model, then the parameters and corresponding dataset. Once that is complete, the problem will be created. With the cost class created, we will showcase the different interactions users can have with the class. A small example with evaluation as well as computation is presented."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"parameter_set = pybop.ParameterSet.pybamm(\"Chen2020\")\n",
"model = pybop.lithium_ion.SPM(parameter_set=parameter_set)"
]
},
{
"cell_type": "markdown",
"id": "6",
"metadata": {},
"source": [
"Now that we have the model constructed, let's define the parameters for identification."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"parameters = pybop.Parameters(\n",
" pybop.Parameter(\n",
" \"Negative electrode active material volume fraction\",\n",
" initial_value=0.6,\n",
" ),\n",
" pybop.Parameter(\n",
" \"Positive electrode active material volume fraction\",\n",
" initial_value=0.6,\n",
" ),\n",
")"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"Next, we generate some synthetic data from the model using the `model.predict` method. This then gets corrupted with Gaussian noise and used to create the Dataset."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"metadata": {},
"outputs": [],
"source": [
"t_eval = np.linspace(0, 10, 100)\n",
"values = model.predict(t_eval=t_eval)\n",
"\n",
"dataset = pybop.Dataset(\n",
" {\n",
" \"Time [s]\": t_eval,\n",
" \"Current function [A]\": values[\"Current [A]\"].data,\n",
" \"Voltage [V]\": values[\"Voltage [V]\"].data,\n",
" }\n",
")"
]
},
{
"cell_type": "markdown",
"id": "10",
"metadata": {},
"source": [
"Now that we have the model, parameters, and dataset, we can combine them and construct the problem class. This class forms the basis for evaluating the forward model for the defined fitting process (parameters and operating conditions)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"metadata": {},
"outputs": [],
"source": [
"problem = pybop.FittingProblem(model, parameters, dataset)"
]
},
{
"cell_type": "markdown",
"id": "12",
"metadata": {},
"source": [
"Perfect, let's now construct the cost class and move onto the main point of this example,"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"metadata": {},
"outputs": [],
"source": [
"cost = pybop.SumofPower(problem)"
]
},
{
"cell_type": "markdown",
"id": "14",
"metadata": {},
"source": [
"The conventional way to use the cost class is through the `cost.__call__` method, which is completed below,"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "15",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.08963993888559865"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cost([0.5, 0.5])"
]
},
{
"cell_type": "markdown",
"id": "16",
"metadata": {},
"source": [
"This does two things, it first evaluates the forward model at the given parameter values of `[0.5,0.5]`, then it computes the cost for the forward models prediction compared to the problem target values, which are provided from the dataset we constructed above. \n",
"\n",
"However, there is an alternative method to achieve this which provides the user with more flexibility in their assessment of the cost function, this is done through the `cost.compute` method, as shown below."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.08963993888559865"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"out = problem.evaluate([0.5, 0.5])\n",
"cost.compute(out)"
]
},
{
"cell_type": "markdown",
"id": "18",
"metadata": {},
"source": [
"This splits the evaluation of the forward model and the computation of the cost function into two separate calls, allowing for the model evaluation to be decoupled from the cost computation. This decoupling can be helpful in the case where you want to assess the problem across multiple costs (see pybop.WeightedCost for a PyBOP implementation of this), or want to modify the problem output before assessing a cost.\n",
"\n",
"Next, let's present a few of these use-cases. In the first use-case, the problem is evaluated once, with random noise added and the cost computed."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "19",
"metadata": {},
"outputs": [],
"source": [
"def my_cost(inputs):\n",
" y = problem.evaluate(inputs)\n",
" y[\"Voltage [V]\"] += np.random.normal(0, 0.003, len(t_eval))\n",
" return cost.compute(y)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "20",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.08910088339381227"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_cost([0.5, 0.5])"
]
},
{
"cell_type": "markdown",
"id": "21",
"metadata": {},
"source": [
"The above method showcases how the `cost.__call__` method can be constructed at the user level. Furthermore, the above example can be reimplemented with gradient calculations as well via the `calculate_gradient` argument within the `cost.compute` method."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "22",
"metadata": {},
"outputs": [],
"source": [
"def my_cost_gradient(inputs):\n",
" y, dy = problem.evaluateS1(inputs)\n",
" y[\"Voltage [V]\"] += np.random.normal(0, 0.003, len(t_eval))\n",
" return cost.compute(y, dy=dy, calculate_grad=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "23",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.08917807157201464, array([-0.57688969, -0.48453944]))"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_cost_gradient([0.5, 0.5])"
]
},
{
"cell_type": "markdown",
"id": "24",
"metadata": {},
"source": [
"This provides the computed cost for the parameter values, alongside the gradient with respect to those parameters. This is the exact structure that is used within PyBOP's gradient-based optimisers. Finally, the above can be easily reproduced via the `cost.__call__` method with the corresponding `calculate_gradient=True` argument."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "25",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.08963668887423992, array([-0.58045629, -0.48653053]))"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cost([0.5, 0.5], calculate_grad=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}