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 fitting functionality for geometric parameters #169

Merged
merged 19 commits into from
Feb 21, 2024

Conversation

BradyPlanden
Copy link
Member

@BradyPlanden BradyPlanden commented Jan 18, 2024

This PR adds functionality to fit geometric parameters in pybop. This essentially requires a model rebuild every iteration, but a combined effort to minimise the number of objects that get rebuilt. It completes the following:

  • Adds rebuild() method to base_model
  • Adds functionality to classify and store parameters based on their type (requires rebuild or not) via model.rebuild_parameters
  • Adds set_rebuild_parameters() to create the required dictionary of geometric parameters
  • Adds a copy() method to base_model
  • A type change to plot_cost2D()
  • Adds tests needed for coverage

Closes #18

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (45df796) 94.58% compared to head (8a17a99) 94.70%.
Report is 17 commits behind head on develop.

Files Patch % Lines
pybop/models/base_model.py 93.87% 3 Missing ⚠️
pybop/_problem.py 91.66% 1 Missing ⚠️
pybop/parameters/parameter.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #169      +/-   ##
===========================================
+ Coverage    94.58%   94.70%   +0.11%     
===========================================
  Files           44       44              
  Lines         1829     1887      +58     
===========================================
+ Hits          1730     1787      +57     
- Misses          99      100       +1     

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

@BradyPlanden
Copy link
Member Author

Hi @NicolaCourtier, this should now be ready for review. I've updated the spm_CMAES.py example to be geometric as a reference. Seems to be working fine, and isn't a massive hit on performance.

@NicolaCourtier
Copy link
Member

Did you mean to change spm_CMAES as well as add spm_geometric_parameters as a separate example? They look very similar to me. Great to hear that it's up to speed!

Copy link
Member

@NicolaCourtier NicolaCourtier left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @BradyPlanden, don't forget the Changelog!

@BradyPlanden BradyPlanden merged commit ad9a883 into develop Feb 21, 2024
18 of 19 checks passed
@BradyPlanden BradyPlanden deleted the 18-how-to-handle-structural-parameters branch February 21, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to handle structural parameters
2 participants