Nothing
#' @title Memory
#' @description Data of a concept and how its training data is balanced. `fit(memory, X, y)`
#' stores the concept's data window (`X`, `y`). `memory_balance(memory, X, y)` returns the
#' training data of a full training, from the one-hot encoded window; subclasses only change it.
#' @return A `memory_manager` object.
#' @import daltoolbox
#' @export
memory_manager <- function() {
obj <- dal_base()
obj$X <- obj$y <- data.frame()
class(obj) <- append("memory_manager", class(obj))
obj
}
#' @export
fit.memory_manager <- function(obj, X, y, ...) {
obj$X <- X
obj$y <- y
obj
}
#' @title Balance the training data
#' @description Generic that returns the (balanced) training data of a full training from the projected
#' features of a concept's memory. The prototype decides the balancing: [memory_basic()] (none),
#' [memory_undersampling()] or [memory_oversampling()] (SMOTE).
#' @param obj A [memory_manager()] prototype.
#' @param X Projected (numeric) features.
#' @param y Labels.
#' @return `list(X = <features>, y = <labels>)` after balancing.
#' @export
memory_balance <- function(obj, X, y) {
UseMethod("memory_balance")
}
#' @export
memory_balance.memory_manager <- function(obj, X, y) {
list(X = X, y = y)
}
#' @title Basic memory
#' @description No balancing: the training data is the data window itself.
#' @return A `memory_basic` object.
#' @export
memory_basic <- function() {
obj <- memory_manager()
class(obj) <- append("memory_basic", class(obj))
obj
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.