Skip to content

New hardhat quantiles #442

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

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4eecf4e
fix: layer_add_target/forecast_date
dajmcdon Jul 4, 2024
519bed3
tests all pass
dajmcdon Jul 4, 2024
30db68f
fix: .pred is a distribution
dajmcdon Jul 5, 2024
feb81a0
minor fixes in vignettes
dajmcdon Jul 5, 2024
f5d2142
refactor prep.epi_recipe
dajmcdon Aug 12, 2024
f8261b9
merge dev
dajmcdon Aug 12, 2024
aa4e788
remove all instances of epi_recipe, pass checks
dajmcdon Aug 12, 2024
393e20e
suppress warnings
dajmcdon Aug 12, 2024
7523d7c
styler
dajmcdon Aug 12, 2024
9b6cf24
ensure pkgdown builds
dajmcdon Aug 12, 2024
f79aa92
bump version
dajmcdon Aug 13, 2024
904d060
merge dev
dajmcdon Sep 10, 2024
62e2f26
pass checks
dajmcdon Sep 11, 2024
75c5e4e
stylr
dajmcdon Sep 11, 2024
6530c7e
remove an unexported fun
dajmcdon Sep 13, 2024
36034fd
styler again...
dajmcdon Sep 19, 2024
4acbeb0
Merge pull request #370 from cmu-delphi/330-epi_recipe
dajmcdon Sep 20, 2024
a6a71c3
update action versions
dajmcdon Sep 30, 2024
9ed0696
Merge pull request #394 from cmu-delphi/ghactions-versions
dajmcdon Sep 30, 2024
b74c039
skeleton
dajmcdon Sep 30, 2024
5da6410
skeleton
dajmcdon Feb 19, 2025
4a09c07
add math ops and related tests
dajmcdon Feb 19, 2025
db662a2
rename tests
dajmcdon Feb 19, 2025
54eb81c
quantile pred tests pass
dajmcdon Feb 19, 2025
0c08cf2
updates to WIS
dajmcdon Feb 19, 2025
8f31f77
remove the distributional package
dajmcdon Feb 19, 2025
8d87c8e
tests pass, checks don't
dajmcdon Feb 25, 2025
532b0d3
pass local checks
dajmcdon Feb 25, 2025
ee2c9f3
bump news
dajmcdon Feb 25, 2025
233c81d
style: fu
dajmcdon Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: epipredict
Title: Basic epidemiology forecasting methods
Version: 0.1.10
Version: 0.1.11
Authors@R: c(
person("Daniel J.", "McDonald", , "daniel@stat.ubc.ca", role = c("aut", "cre")),
person("Ryan", "Tibshirani", , "ryantibs@cmu.edu", role = "aut"),
Expand Down Expand Up @@ -31,12 +31,11 @@ Depends:
Imports:
checkmate,
cli,
distributional,
dplyr,
generics,
ggplot2,
glue,
hardhat (>= 1.3.0),
hardhat (>= 1.4.1),
lifecycle,
magrittr,
recipes (>= 1.0.4),
Expand All @@ -50,6 +49,7 @@ Imports:
workflows (>= 1.0.0)
Suggests:
data.table,
distributional,
epidatr (>= 1.0.0),
fs,
grf,
Expand Down
49 changes: 20 additions & 29 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

S3method(Add_model,epi_workflow)
S3method(Add_model,workflow)
S3method(Math,dist_quantiles)
S3method(Ops,dist_quantiles)
S3method(Remove_model,epi_workflow)
S3method(Remove_model,workflow)
S3method(Update_model,epi_workflow)
Expand Down Expand Up @@ -40,20 +38,14 @@ S3method(extract_frosting,default)
S3method(extract_frosting,epi_workflow)
S3method(extract_layers,frosting)
S3method(extract_layers,workflow)
S3method(extrapolate_quantiles,dist_default)
S3method(extrapolate_quantiles,dist_quantiles)
S3method(extrapolate_quantiles,distribution)
S3method(extrapolate_quantiles,quantile_pred)
S3method(fit,epi_workflow)
S3method(flusight_hub_formatter,canned_epipred)
S3method(flusight_hub_formatter,data.frame)
S3method(forecast,epi_workflow)
S3method(format,dist_quantiles)
S3method(is.na,dist_quantiles)
S3method(is.na,distribution)
S3method(key_colnames,epi_workflow)
S3method(key_colnames,recipe)
S3method(mean,dist_quantiles)
S3method(median,dist_quantiles)
S3method(mean,quantile_pred)
S3method(predict,epi_workflow)
S3method(predict,flatline)
S3method(prep,check_enough_train_data)
Expand Down Expand Up @@ -97,7 +89,7 @@ S3method(print,step_lag_difference)
S3method(print,step_naomit)
S3method(print,step_population_scaling)
S3method(print,step_training_window)
S3method(quantile,dist_quantiles)
S3method(quantile,quantile_pred)
S3method(refresh_blueprint,default_epi_recipe_blueprint)
S3method(residuals,flatline)
S3method(run_mold,default_epi_recipe_blueprint)
Expand All @@ -114,19 +106,17 @@ S3method(slather,layer_residual_quantiles)
S3method(slather,layer_threshold)
S3method(slather,layer_unnest)
S3method(snap,default)
S3method(snap,dist_default)
S3method(snap,dist_quantiles)
S3method(snap,distribution)
S3method(snap,quantile_pred)
S3method(tidy,check_enough_train_data)
S3method(tidy,frosting)
S3method(tidy,layer)
S3method(update,layer)
S3method(vec_ptype_abbr,dist_quantiles)
S3method(vec_ptype_full,dist_quantiles)
S3method(weighted_interval_score,default)
S3method(weighted_interval_score,dist_default)
S3method(weighted_interval_score,dist_quantiles)
S3method(weighted_interval_score,distribution)
S3method(vec_arith,quantile_pred)
S3method(vec_arith.numeric,quantile_pred)
S3method(vec_arith.quantile_pred,numeric)
S3method(vec_math,quantile_pred)
S3method(vec_proxy_equal,quantile_pred)
S3method(weighted_interval_score,quantile_pred)
export("%>%")
export(Add_model)
export(Remove_model)
Expand All @@ -144,6 +134,7 @@ export(arx_class_epi_workflow)
export(arx_classifier)
export(arx_fcast_epi_workflow)
export(arx_forecaster)
export(as_tibble)
export(autoplot)
export(bake)
export(cdc_baseline_args_list)
Expand All @@ -159,6 +150,7 @@ export(epi_workflow)
export(extract_argument)
export(extract_frosting)
export(extract_layers)
export(extract_quantile_levels)
export(extrapolate_quantiles)
export(fit)
export(flatline)
Expand Down Expand Up @@ -190,6 +182,7 @@ export(new_epi_recipe_blueprint)
export(pivot_quantiles_longer)
export(pivot_quantiles_wider)
export(prep)
export(quantile_pred)
export(quantile_reg)
export(rand_id)
export(remove_epi_recipe)
Expand All @@ -213,7 +206,6 @@ export(update_frosting)
export(update_model)
export(validate_layer)
export(weighted_interval_score)
import(distributional)
import(epidatasets)
import(epiprocess)
import(parsnip)
Expand Down Expand Up @@ -269,9 +261,12 @@ importFrom(ggplot2,geom_linerange)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,geom_ribbon)
importFrom(glue,glue)
importFrom(hardhat,extract_quantile_levels)
importFrom(hardhat,extract_recipe)
importFrom(hardhat,quantile_pred)
importFrom(hardhat,refresh_blueprint)
importFrom(hardhat,run_mold)
importFrom(lifecycle,deprecated)
importFrom(magrittr,"%>%")
importFrom(magrittr,extract2)
importFrom(recipes,bake)
Expand Down Expand Up @@ -300,14 +295,11 @@ importFrom(rlang,list2)
importFrom(rlang,set_names)
importFrom(rlang,sym)
importFrom(stats,as.formula)
importFrom(stats,family)
importFrom(stats,lm)
importFrom(stats,median)
importFrom(stats,model.frame)
importFrom(stats,na.omit)
importFrom(stats,poly)
importFrom(stats,predict)
importFrom(stats,qnorm)
importFrom(stats,quantile)
importFrom(stats,residuals)
importFrom(tibble,as_tibble)
Expand All @@ -320,12 +312,11 @@ importFrom(tidyr,unnest)
importFrom(tidyselect,all_of)
importFrom(utils,capture.output)
importFrom(vctrs,as_list_of)
importFrom(vctrs,field)
importFrom(vctrs,new_rcrd)
importFrom(vctrs,new_vctr)
importFrom(vctrs,vec_arith)
importFrom(vctrs,vec_arith.numeric)
importFrom(vctrs,vec_cast)
importFrom(vctrs,vec_data)
importFrom(vctrs,vec_ptype_abbr)
importFrom(vctrs,vec_ptype_full)
importFrom(vctrs,vec_math)
importFrom(vctrs,vec_proxy_equal)
importFrom(vctrs,vec_recycle_common)
importFrom(workflows,extract_preprocessor)
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.0.x will indicat
- Addresses upstream breaking changes from cmu-delphi/epiprocess#595 (`growth_rate()`).
`step_growth_rate()` has lost its `additional_gr_args_list` argument and now
has an `na_rm` argument.
- Removes dependence on the `distributional` package, replacing the quantiles
with `hardhat::quantile_pred()`. Some associated functions are deprecated with
`lifecycle` messages.

## Improvements

Expand All @@ -23,6 +26,7 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.0.x will indicat
- Fix `quantile_reg()` producing error when asked to output just median-level predictions.
- (temporary) ahead negative is allowed for `step_epi_ahead` until we have `step_epi_shift`
- Add `reference_date` as an argument to `epi_recipe()`
- Replace `dist_quantiles()` with `hardhat::quantile_pred()`

## Bug fixes
- Shifting no columns results in no error for either `step_epi_ahead` and `step_epi_lag`
Expand Down
2 changes: 1 addition & 1 deletion R/autoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ plot_bands <- function(
ntarget_dates <- dplyr::n_distinct(predictions$time_value)

predictions <- predictions %>%
mutate(.pred_distn = dist_quantiles(quantile(.pred_distn, levels), levels)) %>%
mutate(.pred_distn = quantile_pred(quantile(.pred_distn, levels), levels)) %>%
pivot_quantiles_wider(.pred_distn)
qnames <- setdiff(names(predictions), innames)

Expand Down
Loading