Skip to content

Conversation

@TimothyWillard
Copy link
Collaborator

@TimothyWillard TimothyWillard commented Mar 21, 2025

No description provided.

To begin work on incorporating observations into the model generate an
example dataset of observations from a prior predictive sample.
@TimothyWillard TimothyWillard linked an issue Mar 21, 2025 that may be closed by this pull request
@TimothyWillard TimothyWillard changed the title Generate example observations from prior Observational Model First Pass Mar 21, 2025
Created a sample dataset with both incidence and prevelance values along
with plots.
Added an internal helper to `vaxflux._util` to do some light validations
and formatting of user provided observations, mostly extracted from
`SeasonalUptakeModel.__init__`. Sets stage for observations specific
formatting.
Fixed a bug where only one incidence time series per a season was saved
to the `incidence` dict inside of `SeasonalUptakeModel.build`. Didn't
affect model for sampling since already added to model graph, but need
it for observational model.
* Added extra comments to `SeasonalUptakeModel.build`, and
* Added a custom potential term to constrain prevalence to [0, 1]
  interval when generating incidence time series.
Added
* A value error for missing required columns, and
* Nowcasting provided
for the `vaxflux._util._validate_and_format_observations` function,
along with corresponding unit tests and documentation.
Add validation to `vaxflux._util._validate_and_format_observations` to
ensure a 'season' column is provided.
Added `SeasonalUptakeModel.add_observations` helper method to create a
duplicate instance of `vaxflux.uptake.SeasonalUptakeModel` but with
observations added.
Minor bug fixes throughout to allow for providing observations in the
form of a pandas DataFrame. Most of the bugs arising from pandas
DataFrames not being truthy.
Incorporate observations into the seasonal uptake model created by
`SeasonalUptakeModel.build` with an approximate normal distribution due
to the inability to directly represent the sum of random variables.
Create a concrete well formatted data set of weekly uptake data
generated from one of the prior sample draws. Sampling is done using the
`blackjax` package because the built in PyMC NUTS sampler has trouble
compiling this model. Added benefit is that `blackjax` is pretty fast
anyways.
@TimothyWillard TimothyWillard force-pushed the observational-model-first-pass branch from c9795d5 to 00d5af9 Compare March 31, 2025 20:34
Extract the observational sigma constant to a class constant from a
hard-coded number.
Added the `sample` method to `vaxflux.uptake.SeasonalUptakeModel` as a
wrapper around `pymc.sample` with built in defaults for the random seed
and NUTS sampler.
* Added required columns 'type' and 'value' for type of obs and the obs
  value itself,
* Expanded input checking in `_validate_and_format_observations` for
  observations, and
* Expanded type coercion in `_validate_and_format_observations` for a
  more uniform observations return.
In similar style to scikit-learn changed the
`SeasonalUptakeModel.sample` method to return self instead of the fitted
trace. This allows the instance to have access to the trace for further
work like summarization utilities.
@TimothyWillard TimothyWillard merged commit 5f88d31 into main Apr 1, 2025
3 checks passed
@TimothyWillard TimothyWillard deleted the observational-model-first-pass branch April 1, 2025 18:00
TimothyWillard added a commit that referenced this pull request Apr 15, 2025
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.

Add Observational Model To SeasonalUptakeModel

2 participants