mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 07:26:12 +01:00
self-learning off
This commit is contained in:
parent
fbc9191b13
commit
51fdc5d6cc
@ -469,6 +469,7 @@ eucast_rules <- function(x,
|
||||
stop(e, call. = FALSE)
|
||||
}
|
||||
)
|
||||
|
||||
tbl_[rows, cols] <<- tbl_original[rows, cols]
|
||||
|
||||
after <- as.character(unlist(as.list(tbl_original[rows, cols])))
|
||||
@ -574,7 +575,6 @@ eucast_rules <- function(x,
|
||||
rule_group_previous <- eucast_rules_df[max(1, i - 1), "reference.rule_group"]
|
||||
rule_group_current <- eucast_rules_df[i, "reference.rule_group"]
|
||||
rule_group_next <- eucast_rules_df[min(nrow(eucast_rules_df), i + 1), "reference.rule_group"]
|
||||
#no_of_changes <- 0
|
||||
if (is.na(eucast_rules_df[i, 4])) {
|
||||
rule_text <- paste(eucast_rules_df[i, 6], "=", eucast_rules_df[i, 7])
|
||||
} else {
|
||||
|
14
R/mo.R
14
R/mo.R
@ -60,13 +60,13 @@
|
||||
#'
|
||||
#' The algorithm uses data from the Catalogue of Life (see below) and from one other source (see \code{?microorganisms}).
|
||||
#'
|
||||
#' \strong{Self-learning algoritm} \cr
|
||||
#' The \code{as.mo()} function gains experience from previously determined microbial IDs and learns from it. This drastically improves both speed and reliability. Use \code{clean_mo_history()} to reset the algorithms. Only experience from your current \code{AMR} package version is used. This is done because in the future the taxonomic tree (which is included in this package) may change for any organism and it consequently has to rebuild its knowledge.
|
||||
#'
|
||||
#' Usually, any guess after the first try runs 80-95\% faster than the first try.
|
||||
#'
|
||||
#' For now, learning only works per session. If R is closed or terminated, the algorithms reset. This will probably be resolved in a next version.
|
||||
#'
|
||||
# \strong{Self-learning algoritm} \cr
|
||||
# The \code{as.mo()} function gains experience from previously determined microbial IDs and learns from it. This drastically improves both speed and reliability. Use \code{clean_mo_history()} to reset the algorithms. Only experience from your current \code{AMR} package version is used. This is done because in the future the taxonomic tree (which is included in this package) may change for any organism and it consequently has to rebuild its knowledge.
|
||||
#
|
||||
# Usually, any guess after the first try runs 80-95\% faster than the first try.
|
||||
#
|
||||
# For now, learning only works per session. If R is closed or terminated, the algorithms reset. This will probably be resolved in a next version.
|
||||
#
|
||||
#' \strong{Intelligent rules} \cr
|
||||
#' This function uses intelligent rules to help getting fast and logical results. It tries to find matches in this order:
|
||||
#' \itemize{
|
||||
|
@ -22,6 +22,9 @@
|
||||
# print successful as.mo coercions to AMR environment
|
||||
#' @importFrom dplyr %>% distinct filter
|
||||
set_mo_history <- function(x, mo, uncertainty_level, force = FALSE) {
|
||||
# disable function
|
||||
return(base::invisible())
|
||||
|
||||
if (base::interactive() | force == TRUE) {
|
||||
mo_hist <- read_mo_history(uncertainty_level = uncertainty_level, force = force)
|
||||
df <- data.frame(x, mo, stringsAsFactors = FALSE) %>%
|
||||
@ -55,6 +58,9 @@ set_mo_history <- function(x, mo, uncertainty_level, force = FALSE) {
|
||||
}
|
||||
|
||||
get_mo_history <- function(x, uncertainty_level, force = FALSE) {
|
||||
# disable function
|
||||
return(NA)
|
||||
|
||||
history <- read_mo_history(uncertainty_level = uncertainty_level, force = force)
|
||||
if (base::is.null(history)) {
|
||||
NA
|
||||
@ -67,6 +73,9 @@ get_mo_history <- function(x, uncertainty_level, force = FALSE) {
|
||||
|
||||
#' @importFrom dplyr %>% filter distinct
|
||||
read_mo_history <- function(uncertainty_level = 2, force = FALSE, unfiltered = FALSE) {
|
||||
# disable function
|
||||
return(NULL)
|
||||
|
||||
if ((!base::interactive() & force == FALSE)) {
|
||||
return(NULL)
|
||||
}
|
||||
|
14
R/zzz.R
14
R/zzz.R
@ -45,13 +45,13 @@
|
||||
value = make_trans_tbl(),
|
||||
envir = asNamespace("AMR"))
|
||||
|
||||
assign(x = "mo_history",
|
||||
value = data.frame(x = character(0),
|
||||
mo = character(0),
|
||||
uncertainty_level = integer(0),
|
||||
package_v = character(0),
|
||||
stringsAsFactors = FALSE),
|
||||
envir = asNamespace("AMR"))
|
||||
# assign(x = "mo_history",
|
||||
# value = data.frame(x = character(0),
|
||||
# mo = character(0),
|
||||
# uncertainty_level = integer(0),
|
||||
# package_v = character(0),
|
||||
# stringsAsFactors = FALSE),
|
||||
# envir = asNamespace("AMR"))
|
||||
|
||||
}
|
||||
|
||||
|
@ -71,13 +71,6 @@ Use the \code{\link{mo_property}_*} functions to get properties based on the ret
|
||||
|
||||
The algorithm uses data from the Catalogue of Life (see below) and from one other source (see \code{?microorganisms}).
|
||||
|
||||
\strong{Self-learning algoritm} \cr
|
||||
The \code{as.mo()} function gains experience from previously determined microbial IDs and learns from it. This drastically improves both speed and reliability. Use \code{clean_mo_history()} to reset the algorithms. Only experience from your current \code{AMR} package version is used. This is done because in the future the taxonomic tree (which is included in this package) may change for any organism and it consequently has to rebuild its knowledge.
|
||||
|
||||
Usually, any guess after the first try runs 80-95\% faster than the first try.
|
||||
|
||||
For now, learning only works per session. If R is closed or terminated, the algorithms reset. This will probably be resolved in a next version.
|
||||
|
||||
\strong{Intelligent rules} \cr
|
||||
This function uses intelligent rules to help getting fast and logical results. It tries to find matches in this order:
|
||||
\itemize{
|
||||
|
Loading…
Reference in New Issue
Block a user