paramm-team / pybamm-param

Parameter optimisation for PyBaMM.
BSD 3-Clause "New" or "Revised" License
38 stars 8 forks source link

Allowing custom weights for cost functions #36

Closed muhammedsogut closed 1 year ago

muhammedsogut commented 1 year ago

Description

At the moment, cost function treats all the points equally but this might not be the case for every application. This is to allow user to define weight matrix for cost function.

Fixes # (issue)

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

Key checklist:

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 95.34% and project coverage change: +1.22% :tada:

Comparison is base (b8f69b7) 82.41% compared to head (4b6811f) 83.63%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #36 +/- ## =========================================== + Coverage 82.41% 83.63% +1.22% =========================================== Files 13 13 Lines 307 336 +29 =========================================== + Hits 253 281 +28 - Misses 54 55 +1 ``` | [Files Changed](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team) | Coverage Δ | | |---|---|---| | [pbparam/optimisation\_problems/gitt.py](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team#diff-cGJwYXJhbS9vcHRpbWlzYXRpb25fcHJvYmxlbXMvZ2l0dC5weQ==) | `0.00% <0.00%> (ø)` | | | [pbparam/optimisation\_problems/OCP\_balance.py](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team#diff-cGJwYXJhbS9vcHRpbWlzYXRpb25fcHJvYmxlbXMvT0NQX2JhbGFuY2UucHk=) | `98.48% <92.85%> (-1.52%)` | :arrow_down: | | [pbparam/cost\_functions/base\_cost\_function.py](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team#diff-cGJwYXJhbS9jb3N0X2Z1bmN0aW9ucy9iYXNlX2Nvc3RfZnVuY3Rpb24ucHk=) | `100.00% <100.00%> (ø)` | | | [pbparam/cost\_functions/mle.py](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team#diff-cGJwYXJhbS9jb3N0X2Z1bmN0aW9ucy9tbGUucHk=) | `100.00% <100.00%> (ø)` | | | [pbparam/cost\_functions/rmse.py](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team#diff-cGJwYXJhbS9jb3N0X2Z1bmN0aW9ucy9ybXNlLnB5) | `100.00% <100.00%> (ø)` | | | [...optimisation\_problems/base\_optimisation\_problem.py](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team#diff-cGJwYXJhbS9vcHRpbWlzYXRpb25fcHJvYmxlbXMvYmFzZV9vcHRpbWlzYXRpb25fcHJvYmxlbS5weQ==) | `96.96% <100.00%> (+0.89%)` | :arrow_up: | | [pbparam/optimisation\_problems/data\_fit.py](https://app.codecov.io/gh/paramm-team/pybamm-param/pull/36?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paramm-team#diff-cGJwYXJhbS9vcHRpbWlzYXRpb25fcHJvYmxlbXMvZGF0YV9maXQucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

brosaplanella commented 1 year ago

I tried using the warnings package and they seem to work fine now (also, they are easier to test).