FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update Labour to get specific properties when getting person by tamuri · Pull Request #1829 · UCL/TLOmodel · GitHub

/ TLOmodel Public

Update Labour to get specific properties when getting person - #1829

Open
tamuri wants to merge 12 commits into
masterfrom
tamuri/labour-performance
Open

tamuri wants to merge 12 commits into
masterfrom
tamuri/labour-performance

Conversation

tamuri commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator

Profiling finds that repeated df.loc[[person_id]], where all properties are retrieved, is a bottleneck in the Labour module. This PR updates the module to only retrieve those properties necessary.

Joe - although each labour linear model only uses a few of these properties, grabbing everything necessary for all of them is an easy change for now.

I'm running profiling again to see if further improvements can be made.

tbhallett left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This makes good sense to me.

- the decorator allows us to list none or more properties needed to evaluate the function
- does not change the logic inside the function, but is a bit of metadata that can be used by callers

tamuri commented Feb 27, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator Author

Trying a different approach to speed this up further. This is has reduced runtime of predict from 4% to <0.3%

A decorator person_properties in labour_lm adds metadata to the function specifying exactly which person properties from the population dataframe (if any) are needed to evaluate the function. If nothing it needed, it is set to an empty list.

The labour module uses this metadata to grab only those specified properties from the population dataframe.

Sometimes the required modules are not available and we have to remove their properties from the list.

Sorry, @tbhallett @joehcollins, do you mind looking at this again.

tamuri requested a review from tbhallett February 27, 2026 22:16
… then new simulations in the same process may fail.

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL