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

Add MultiFittingProblem class and example #364

Merged
merged 150 commits into from
Aug 12, 2024
Merged

Conversation

NicolaCourtier
Copy link
Member

Description

Add a new Problem class that accepts multiple fitting problems and returns one combined problem for passing to a cost function. This PR builds on and should be merged after #359.

Issue reference

Fixes part of #238.

Review

Before you mark your PR as ready for review, please ensure that you've considered the following:

  • Updated the CHANGELOG.md in reverse chronological order (newest at the top) with a concise description of the changes, including the PR number.
  • Noted any breaking changes, including details on how it might impact existing functionality.

Type of change

  • New Feature: A non-breaking change that adds new functionality.
  • Optimization: A code change that improves performance.
  • Examples: A change to existing or additional examples.
  • Bug Fix: A non-breaking change that addresses an issue.
  • Documentation: Updates to documentation or new documentation for new features.
  • Refactoring: Non-functional changes that improve the codebase.
  • Style: Non-functional changes related to code style (formatting, naming, etc).
  • Testing: Additional tests to improve coverage or confirm functionality.
  • Other: (Insert description of change)

Key checklist:

  • No style issues: $ 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)
  • All unit tests pass: $ nox -s tests
  • The documentation builds: $ nox -s doctest

You can run integration tests, unit tests, and doctests together at once, using $ nox -s quick.

Further checks:

  • Code is well-commented, especially in complex or unclear areas.
  • Added tests that prove my fix is effective or that my feature works.
  • Checked that coverage remains or improves, and added tests if necessary to maintain or increase coverage.

Thank you for contributing to our project! Your efforts help us to deliver great software.

Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 98.82353% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.67%. Comparing base (a921c8f) to head (7eeeb00).
Report is 488 commits behind head on develop.

Files with missing lines Patch % Lines
pybop/models/base_model.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #364      +/-   ##
===========================================
- Coverage    98.68%   98.67%   -0.02%     
===========================================
  Files           46       47       +1     
  Lines         2971     3015      +44     
===========================================
+ Hits          2932     2975      +43     
- Misses          39       40       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, nice work! See my comment on the parameters.

examples/scripts/multi_fitting.py Outdated Show resolved Hide resolved
Base automatically changed from 358-passing-inputs to develop July 4, 2024 14:19
@NicolaCourtier NicolaCourtier marked this pull request as ready for review July 4, 2024 15:13
Copy link
Member

@BradyPlanden BradyPlanden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @NicolaCourtier. I think it's coming along well, I've made a few comments for you to look at. As a more general thought, do you see any reason this couldn't be a MultiProblem class that composes multiple instances ofFittingProblem or DesignProblem? Perhaps even combined instances of both (with an update to BaseOptimiser for minimising logic. This seems to be the logical next step, but we could do it now instead of refactoring this class later.

pybop/problems/fitting_problem.py Outdated Show resolved Hide resolved
pybop/problems/fitting_problem.py Outdated Show resolved Hide resolved
pybop/problems/fitting_problem.py Outdated Show resolved Hide resolved
pybop/problems/fitting_problem.py Outdated Show resolved Hide resolved
examples/scripts/multi_fitting.py Show resolved Hide resolved
pybop/problems/fitting_problem.py Outdated Show resolved Hide resolved
examples/scripts/multi_fitting.py Outdated Show resolved Hide resolved
tests/integration/test_model_experiment_changes.py Outdated Show resolved Hide resolved
pybop/problems/fitting_problem.py Outdated Show resolved Hide resolved
pybop/problems/fitting_problem.py Outdated Show resolved Hide resolved
@NicolaCourtier NicolaCourtier marked this pull request as draft August 8, 2024 12:14
@NicolaCourtier NicolaCourtier marked this pull request as ready for review August 8, 2024 18:07
@NicolaCourtier
Copy link
Member Author

Merge after #451

Copy link
Member

@BradyPlanden BradyPlanden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for the addition @NicolaCourtier!

@BradyPlanden BradyPlanden merged commit 778a72f into develop Aug 12, 2024
30 checks passed
@BradyPlanden BradyPlanden deleted the 238b-multi-fitting branch August 12, 2024 10:36
@NicolaCourtier NicolaCourtier self-assigned this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants