Support alternate point estimate functions#65
Merged
Conversation
Updates the CLI test for run-model to check the contents of the resulting model JSON for a key describing the point estimator function to use for summarizing the central point of the posterior distributions. The default estimator is the median.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
==========================================
+ Coverage 27.13% 27.35% +0.21%
==========================================
Files 57 57
Lines 3213 3228 +15
==========================================
+ Hits 872 883 +11
- Misses 2341 2345 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds support for scalar values in the metadata dictionaries passed to the `combine_sites_tidy` function and adds a test for this support. This function is not used internally by evofr, but it is used externally by forecasts-flu and forecasts-ncov. Without this change, the new "ps_point_estimator" key gets converted from a string like "mean" to a list of single characters like `['m', 'e', 'a', 'n']`.
huddlej
added a commit
to nextstrain/forecasts-flu
that referenced
this pull request
Feb 6, 2026
Adds logic to parse a `ps_point_estimator` function name from the model config YAML and pass that estimator name to the evofr function for generating tidy data frames. This interface allows users to choose one of the available point estimates generated by evofr as the representative value to plot in evofr-viz and other downstream tools. Updates the configs for all three subtypes to use the "mean" instead of the "median" for reporting frequencies and GAs. Updates the local JSON parsing script to export mean along with median in the data frame output. Closes #32 Requires blab/evofr#65 Requires nextstrain/forecasts-viz#33
huddlej
added a commit
to nextstrain/forecasts-flu
that referenced
this pull request
Feb 6, 2026
Adds logic to parse a `ps_point_estimator` function name from the model config YAML and pass that estimator name to the evofr function for generating tidy data frames. This interface allows users to choose one of the available point estimates generated by evofr as the representative value to plot in evofr-viz and other downstream tools. Updates the configs for all three subtypes to use the "mean" instead of the "median" for reporting frequencies and GAs. Updates the local JSON parsing script to export mean along with median in the data frame output. Closes #32 Requires blab/evofr#65 Requires nextstrain/forecasts-viz#33
2 tasks
Closed
Closed
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds logic to calculate the mean of posterior distributions along with the existing calculations of median and user-specified percentiles (
ps) and exposes a new user configuration option (ps_point_estimator) to allow users to specify which point estimator function should be used by tools that consume the model JSONs. This option passes through to the model JSON's metadata section allowing downstream tools to choose thedataentries that match the requested point estimator function.The following is an example of the new configuration one can provide to the
evofr run-modelcommand:These changes are backward compatible, but they will produce a slightly larger JSON file by adding entries for mean frequencies and GAs to all outputs. Tools that consume the model JSONs like evofr-viz will need their own updates to support the new
ps_point_estimatormetadata key.Required for nextstrain/forecasts-flu#32