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

Version 1.0 #581

Merged
merged 56 commits into from
Jul 10, 2024
Merged

Version 1.0 #581

merged 56 commits into from
Jul 10, 2024

Conversation

cliffckerr
Copy link
Contributor

@cliffckerr cliffckerr commented Jul 5, 2024

Description

  • Official release of Starsim!
  • Adds a Calibration class, based on Optuna, to facilitate the calibration of Starsim models.
  • Adds mean(), median(), and plot() methods to MultiSim.
  • Adds low and high attributes to Result objects.
  • Adds a flatten() method to Results, allowing nested Results objects to be turned into flat dictionaries.
  • Removes duplicate UIDs among new infections, and adds a unique() method to ss.uids.
  • Fixes a bug that prevented ss.lognorm_im() from using callable parameters.
  • Updates the default Sim string representation to be a single line; the more verbose version is available via sim.disp().

Checklist

  • Code commented & docstrings added
  • New tests were needed and have been added
  • A new version number was needed & changelog has been updated
  • A new PyPI version needs to be released

kaa2102 and others added 25 commits June 5, 2024 12:01
Improves EmbeddingNet() performance time by 100% where n_agents > 10_000 and extends functionality without termination up to n_agents=100_000.
Updates code and removes omergeleft() and replaces with updated default_pars().
Updated add_pairs() to align with main branch.
Expands test coverage to 79%.
…ameter even if using a subclass. Now `self.pars.p_fertility` in `init_pre` rather than doing everything in `__init__`.

Also changing `uint64` to signed `int64` in test_randomness.
…ecause `fertility_rate[max_age+1] = 0` and the fertility rate had indices of -inf and 0:

```python
index = pd.MultiIndex.from_arrays([[default_year, default_year], [-np.inf, 0]], names=['year','age'])
        return pd.Series(index=index, data=[out_of_range, data])
```
I don't like this approach, too complied and confusing, but at least it seems to work now.
@cliffckerr cliffckerr added this to the v1.0: MVP release milestone Jul 5, 2024
@cliffckerr cliffckerr marked this pull request as ready for review July 6, 2024 23:34
Copy link
Contributor

@robynstuart robynstuart left a comment

Choose a reason for hiding this comment

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

Looks great!!!

README.rst Outdated Show resolved Hide resolved
starsim/disease.py Show resolved Hide resolved
@robynstuart
Copy link
Contributor

Playing around with the new repr:

sir = ss.SIR(init_prev=ss.bernoulli(0.3))
sim = ss.Sim(diseases=sir)
/Users/robynstuart/Documents/git/starsim/starsim/sim.py:72: RuntimeWarning: 
Error displaying custom sim repr, falling back to default: object of type 'SIR' has no len()
  ss.warn(f'Error displaying custom sim repr, falling back to default: {E}')

Copy link
Contributor

@daniel-klein daniel-klein left a comment

Choose a reason for hiding this comment

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

Exiting to be so close to 1.0! I've added lots of comments in the new calibration code. Other changes seem great, just some minor suggestions here and there. Calibration changes will likely get push post 1.0 release.

@@ -295,8 +295,9 @@ def make_new_cases(self):
# Tidy up
if len(new_cases) and len(sources):
new_cases = ss.uids.cat(new_cases)
sources = ss.uids.cat(sources)
networks = np.concatenate(networks)
new_cases, inds = new_cases.unique(return_index=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on passing an allow_superinfection argument somewhere that would default to False? Honestly, I think taking unique is the right think to do in 99% of applications, but it's not 100%.

starsim/distributions.py Outdated Show resolved Hide resolved
starsim/network.py Outdated Show resolved Hide resolved

__all__ = ['__version__', '__versiondate__', '__license__']

__version__ = '0.5.10'
__versiondate__ = '2024-07-03'
__version__ = '1.0.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels good!

Comment on lines +39 to +40
skestimator (str): if provided, use this scikit-learn estimator instead
estimator (func): if provided, use this custom estimator instead
Copy link
Contributor

Choose a reason for hiding this comment

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

Could these be combined? Call if function and otherwise try sk?

),
networks = dict(
randomnet = dict(
n_contacts = [4, 2, 10],
Copy link
Contributor

Choose a reason for hiding this comment

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

What if these were ss.poisson instead of scalars?

@@ -18,14 +18,18 @@ class Result(np.ndarray):
'module', # The name of the module (e.g. hiv)
'scale', # Whether or not the result scales with population size (e.g. True)
'label', # The human-readable label for the result (e.g. Number of infections)
'low', # The lower bound for the values (used with MultiSim)
Copy link
Contributor

Choose a reason for hiding this comment

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

Mention these low and high values are used for plotting confidence intervals. If not used for any other purpose, perhaps better to move into the MultiSim class?

README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
@cliffckerr cliffckerr merged commit f22971a into main Jul 10, 2024
3 checks passed
@cliffckerr cliffckerr deleted the rc1.0 branch July 10, 2024 08:02
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.

4 participants