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

CAFDI-7 - Create Multi TLD Gravity Model MVP #7

Merged
merged 95 commits into from
Jan 24, 2024
Merged

Conversation

wsp-mbuckley
Copy link
Contributor

@wsp-mbuckley wsp-mbuckley commented Sep 7, 2023

Describe Changes

Add class to calibrate gravity model to multiple cost distributions.

  • CAFDI-20 - Move gravity and jacobian functions to single_Core
  • CAFDI-21 - implement multi_cost_distribution Class
  • CAFDI-25 - implement MultiGravityModelResults
  • CAFDI-22 - refactor _calibrate function
  • CAFDI-23 - implement _gravity_function
  • CAFDI-24 - implement _jacobian_function
  • CAFDI-26 - Write multiTLD tests for run
  • CAFDI-27 - Write tests for calibration
  • CAFDI-28 - Write tests for error checking

Task Checklist

  • Have unittests been added (testing individual functions and their edge cases)
  • Have integration tests been added (if applicable, to test modules of functionality)
  • Updated RELEASE.md to reflect changes in PR
  • Have new dependencies been added?
    • Have they been added to either requirements.txt or requirements_dev.txt.
    • Have they been added to setup.cfg

Added TODO items and plans for the Multi area gravity model.
@wsp-mbuckley wsp-mbuckley added the enhancement New feature or request label Sep 7, 2023
@wsp-mbuckley wsp-mbuckley self-assigned this Sep 7, 2023
@BenTaylor-TfN
Copy link
Member

BenTaylor-TfN commented Sep 20, 2023

Finished #6 now. Also updated the packaging system in #8.

Rebased this off of the new main to keep the commit messages in here a bit clearer. No significant changes that you weren't already aware of.

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

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

Comparison is base (30e4c8c) 85.09% compared to head (e9672b2) 81.38%.

Files Patch % Lines
src/caf/distribute/gravity_model/multi_area.py 81.63% 36 Missing ⚠️
src/caf/distribute/gravity_model/core.py 26.66% 22 Missing ⚠️
src/caf/distribute/gravity_model/single_area.py 82.75% 20 Missing ⚠️
src/caf/distribute/utils.py 52.17% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #7      +/-   ##
==========================================
- Coverage   85.09%   81.38%   -3.71%     
==========================================
  Files           7        9       +2     
  Lines         416      634     +218     
==========================================
+ Hits          354      516     +162     
- Misses         62      118      +56     

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

Added TODO items and plans for the Multi area gravity model.
wsp-mbuckley and others added 22 commits November 10, 2023 09:20
Moved `_gravity_function` and `_jacobian_function` methods from base
gravity model to single area and replaced with abstract method
definitions.
Will need a lot of testing and tinkering
Params aren't changing after 4 or 5 outer iterations and it's quite quick:

- Tidy code
- Better convergence checks
- Translate from df to array
- Initial guess of params?
- Work out zero div error
Distributions converge as well on a final furness as they do in internal loops. This is good for most but bad for external, trying to work out if this is inherent to the distribution or a problem with the code.
Currently only one function for infilling cost matrices
This all needs testing. Especially make sure everything is always in the right order
This could be used to improve performance on large matrices in MVP+
Old methods deleted, return to previous commit to find them if needed
Fixed index page to match style of toolkit. Added pages for new classes/modules
Refactored to avoid ugly inheritances from core
Copy link
Member

@BenTaylor-TfN BenTaylor-TfN left a comment

Choose a reason for hiding this comment

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

Dont forget to add to .gitblame to ignore the isort changes, just so you're not the one in the blame if something goes wrong with the isort changes!

There's still a few comments that need addressing from the previous review

src/caf/distribute/utils.py Show resolved Hide resolved
tests/gravity_model/test_multi_area.py Show resolved Hide resolved
docs/conf.py Outdated Show resolved Hide resolved
docs/conf.py Outdated Show resolved Hide resolved
@isaac-tfn
Copy link
Contributor

@BenTaylor-TfN I think I've made those changes now

@BenTaylor-TfN BenTaylor-TfN merged commit 33c82e6 into main Jan 24, 2024
14 of 16 checks passed
@BenTaylor-TfN BenTaylor-TfN deleted the multi_tld_mvp branch January 24, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants