From 35debe25ee60b22802459f7c59c51ff1c4f719e6 Mon Sep 17 00:00:00 2001 From: Matthijs Berends Date: Tue, 23 Dec 2025 11:02:26 +0100 Subject: [PATCH] (v3.0.1.9009) tidymodels vignette --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- vignettes/AMR_with_tidymodels.Rmd | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 94e6ed0d0..5204ece38 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 3.0.1.9008 -Date: 2025-12-22 +Version: 3.0.1.9009 +Date: 2025-12-23 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index 1bdfa4c4b..12d7c6178 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 3.0.1.9008 +# AMR 3.0.1.9009 ### New * Integration with the **tidymodels** framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via `recipes` diff --git a/vignettes/AMR_with_tidymodels.Rmd b/vignettes/AMR_with_tidymodels.Rmd index 80777686d..156dfc14e 100644 --- a/vignettes/AMR_with_tidymodels.Rmd +++ b/vignettes/AMR_with_tidymodels.Rmd @@ -267,10 +267,9 @@ testing_data <- testing(split) # Define the recipe mic_recipe <- recipe(esbl ~ ., data = training_data) %>% remove_role(genus, old_role = "predictor") %>% # Remove non-informative variable - step_mic_log2(all_mic_predictors()) %>% # Log2 transform all MIC predictors - prep() + step_mic_log2(all_mic_predictors()) # Log2 transform all MIC predictors -mic_recipe +prep(mic_recipe) ``` **Explanation:** @@ -331,7 +330,7 @@ metrics - `predict()`: Produces predictions for unseen test data. - `metric_set()`: Allows evaluating multiple classification metrics. This will make `our_metrics` to become a function that we can use to check the predictions with. -It appears we can predict ESBL gene presence with a positive predictive value (PPV) of `r round(metrics[metrics$.metric == "ppv", ]$.estimate, 3) * 100`% and a negative predictive value (NPV) of `r round(metrics[metrics$.metric == "npv", ]$.estimate, 3) * 100` using a simplistic logistic regression model. +It appears we can predict ESBL gene presence with a positive predictive value (PPV) of `r round(metrics[metrics$.metric == "ppv", ]$.estimate, 3) * 100`% and a negative predictive value (NPV) of `r round(metrics[metrics$.metric == "npv", ]$.estimate, 3) * 100`% using a simplistic logistic regression model. ### **Visualising Predictions** @@ -369,7 +368,7 @@ predictions %>% ### **Conclusion** -In this example, we showcased how the new `AMR`-specific recipe steps simplify working with `` columns in `tidymodels`. The `step_mic_log2()` transformation converts ordered MICs to log2-transformed numerics, improving compatibility with classification models. +In this example, we showcased how the new `AMR`-specific recipe steps simplify working with `` columns in `tidymodels`. The `step_mic_log2()` transformation converts MICs (with or without operators) to log2-transformed numerics, improving compatibility with classification models. This pipeline enables realistic, reproducible, and interpretable modelling of antimicrobial resistance data.