msberends / AMR

Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by using evidence-based methods, as described in https://doi.org/10.18637/jss.v104.i03.
https://msberends.github.io/AMR/
Other
83 stars 12 forks source link

Implement new mo algorithm #65

Closed msberends closed 1 year ago

msberends commented 2 years ago

Fixes #54.


Perhaps look at stringdist package to implement a faster way for the string comparison in mo_matching_score() (Levenshtein distance). This is why:

microbenchmark::microbenchmark(old = utils::adist("E coli",
                                                  AMR::microorganisms$fullname,
                                                  useBytes = TRUE),
                               new = stringdist::stringdist("E coli",
                                                            AMR::microorganisms$fullname,
                                                            method = "lv",
                                                            useBytes = TRUE),
                               times = 10)
#> Unit: milliseconds
#>  expr      min        lq      mean    median        uq       max neval cld
#>   old 118.2304 153.44370 186.49858 162.29776 177.67615 343.22793    10   b
#>   new  27.1837  27.26855  33.83603  31.49938  37.95392  57.58841    10  a 

Five times faster: doing ~6 a second or ~32 a second. That matters!

msberends commented 1 year ago

Replaced with #71