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

feat: utility to match fit results to arbitrary model #288

Merged
merged 9 commits into from
Oct 1, 2021

Conversation

alexander-held
Copy link
Member

@alexander-held alexander-held commented Sep 28, 2021

This adds a new API model_utils.match_fit_results, which takes a model and a fit result and then returns a modified fit result that matches the model as well as possible:

  • re-ordering parameters if needed,
  • removing parameters from fit result that are not in the target model,
  • adding parameters that are in the model but not in the fit result.

When adding new parameters to the fit result, they are assumed to have their pre-fit values as given by model_utils.asimov_parameters, with associated uncertainty given by model_utils.prefit_uncertainties. They are furthermore assumed to not have any correlations with other parameters.

Additional minor changes:

  • pre-commit updated
  • changed np.diag (MATLAB-like API) to np.diagflat
  • minor capitalization changes in readme
  • added warning to model_utils.prediction if parameter names in fit results and model do not match

resolves #284

* added model_utils.match_fit_results function to match fit results to different model
* switched from use of np.diag to np.diagflat
* added warning to model_utils.prediction for mismatch of parameter names in fit results and model
* updated pre-commit 

@codecov
Copy link

codecov bot commented Sep 28, 2021

Codecov Report

Merging #288 (a79410a) into master (b01edb3) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #288   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines         1788      1808   +20     
  Branches       277       283    +6     
=========================================
+ Hits          1788      1808   +20     
Impacted Files Coverage Δ
src/cabinetry/model_utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b01edb3...a79410a. Read the comment docs.

@alexander-held alexander-held merged commit 054c2ef into master Oct 1, 2021
@alexander-held alexander-held deleted the feat/fit-result-matching branch October 1, 2021 12:29
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.

Utility to match fit results to modified model
1 participant