R/RcppExports.R

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

.get_vw_version <- function() {
    .Call(`_rvw_get_vw_version`)
}

#'Train Vowpal Wabbit model
#'
#'vwtrain is an interface to train VW model from \code{\link{vwsetup}}
#'
#'@param vwmodel [vw] Model of vw class to train
#'@param data [string or data.frame] Path to training data in .vw plain text format or data.frame.
#'If \code{[data.frame]} then will be parsed using \code{df2vw} function.
#'@param readable_model [string] Print trained model in human readable format ("hashed") 
#'and also with human readable features ("inverted")
#'@param readable_model_path [string] Path to file where to save readable model.
#'@param quiet [logical] Do not print anything to the console 
#'@param update_model [logical] Update an existing model, when training with new data. \code{FALSE} by default.
#'@param passes [int] Number of times the algorithm will cycle over the data (epochs).
#'@param cache [bool] Use a cache for a data file.
#'@param progress [int/real] Progress update frequency. int: additive, real: multiplicative
#'@param namespaces [list or yaml file] For \code{df2vw}. Name of each namespace and
#'  each variable for each namespace can be a R list, or a YAML
#'  file example namespace with the IRIS database: namespaces =
#'  list(sepal = list('Sepal.Length', 'Sepal.Width'), petal = list('Petal.Length',
#'  'Petal.Width') this creates 2 namespaces (sepal
#'  and petal) containing the features defined by elements of this lists.
#'@param keep_space [string vector] For \code{df2vw}. Keep spaces for this features
#'Example:"FERRARI 4Si"
#'With \code{keep_space} will be "FERRARI 4Si" and will be treated as two features
#'Without \code{keep_space} will be "FERRARI_4Si" and will be treated as one feature
#'@param fixed [string vector] fixed parsing for this features
#'Similar to \code{keep_space}, but parse features exactly without replacement of special characters ("(", ")", "|", ":", "'").
#'Can be used for LDA ("word_1:2 word_2:3" will stay the same),
#'but should be used carefully, because special characters can ruin final VW format file.
#'@param targets [string or string vector] For \code{df2vw}.
#'If \code{[string]} then will be treated as vector with real number labels for regular VW input format. 
#'If \code{[string vector]} then will be treated as vectors with class costs for wap and csoaa 
#'multi-class classification algorithms or as vectors with actions for Contextual Bandit algorithm. 
#'@param probabilities [string vector] For \code{df2vw}. vectors with action probabilities for Contextual Bandit algorithm.
#'@param weight [string] For \code{df2vw}. Weight (importance) of each line of the dataset.
#'@param base [string] For \code{df2vw}. base of each line of the dataset. Used for residual regression.
#'@param tag [string] For \code{df2vw}. Tag of each line of the dataset.
#'@param multiline [integer] number of labels (separate lines) for multilines examle
#'@import tools
#'@examples
#'ext_train_data <- system.file("extdata", "binary_train.vw", package = "rvw")
#'test_vwmodel <- vwsetup()
#'vwtrain(test_vwmodel, data = ext_train_data)
vwtrain <- function(vwmodel, data, readable_model = NULL, readable_model_path = "", quiet = FALSE, update_model = FALSE, passes = 1L, cache = FALSE, progress = NULL, namespaces = NULL, keep_space = NULL, fixed = NULL, targets = NULL, probabilities = NULL, weight = NULL, base = NULL, tag = NULL, multiline = NULL) {
    invisible(.Call(`_rvw_vwtrain`, vwmodel, data, readable_model, readable_model_path, quiet, update_model, passes, cache, progress, namespaces, keep_space, fixed, targets, probabilities, weight, base, tag, multiline))
}

#'Compute predictions using Vowpal Wabbit model
#'
#'\code{vwtest} computes predictions using VW model from \code{\link{vwsetup}}
#'\code{predict.vw} compute predictions using parser settings from \code{\link{vwtrain}}
#'
#'@param vwmodel [vw] Model of vw class to train.
#'@param object Model of vw class to train for \code{predict.vw}
#'@param data [string or data.frame] Path to training data in .vw plain text format or data.frame.
#'If \code{[data.frame]} then will be parsed using \code{df2vw} function.
#'@param probs_path [string] Path to file where to save predictions.
#'@param full_probs [bool] Output full predictions in data.frame format. If not, force predictions into a single vector (default).
#'@param readable_model [string] Print trained model in human readable format ("hashed") 
#'and also with human readable features ("inverted").
#'@param readable_model_path [string] Path to file where to save readable model.
#'@param quiet [bool] Do not print anything to the console.
#'@param passes [int] Number of times the algorithm will cycle over the data (epochs).
#'@param cache [bool] Use a cache for a data file.
#'@param raw [bool] Output unnormalized predictions. Default is FALSE.
#'@param progress [int/real] Progress update frequency. int: additive, real: multiplicative
#'@param namespaces [list or yaml file] For \code{df2vw}. Name of each namespace and
#'  each variable for each namespace can be a R list, or a YAML
#'  file example namespace with the IRIS database: namespaces =
#'  list(sepal = list('Sepal.Length', 'Sepal.Width'), petal = list('Petal.Length',
#'  'Petal.Width') this creates 2 namespaces (sepal
#'  and petal) containing the features defined by elements of this lists.
#'@param keep_space [string vector] For \code{df2vw}. Keep spaces for this features
#'Example:"FERRARI 4Si"
#'With \code{keep_space} will be "FERRARI 4Si" and will be treated as two features
#'Without \code{keep_space} will be "FERRARI_4Si" and will be treated as one feature
#'@param fixed [string vector] fixed parsing for this features
#'Similar to \code{keep_space}, but parse features exactly without replacement of special characters ("(", ")", "|", ":", "'").
#'Can be used for LDA ("word_1:2 word_2:3" will stay the same),
#'but should be used carefully, because special characters can ruin final VW format file.
#'@param targets [string or string vector] For \code{df2vw}.
#'If \code{[string]} then will be treated as vector with real number labels for regular VW input format. 
#'If \code{[string vector]} then will be treated as vectors with class costs for wap and csoaa 
#'multi-class classification algorithms or as vectors with actions for Contextual Bandit algorithm. 
#'@param probabilities [string vector] For \code{df2vw}. Vectors with action probabilities for Contextual Bandit algorithm.
#'@param weight [string] For \code{df2vw}. Weight (importance) of each line of the dataset.
#'@param base [string] For \code{df2vw}. Base of each line of the dataset. Used for residual regression.
#'@param tag [string] For \code{df2vw}. Tag of each line of the dataset.
#'@param multiline [integer] Number of labels (separate lines) for multilines example
#'@param ... Parameters passed to \code{predict.vw}
#'@return Numerical vector containing predictions
#'@import tools
#'@examples
#'ext_train_data <- system.file("extdata", "binary_train.vw", package = "rvw")
#'ext_test_data <- system.file("extdata", "binary_valid.vw", package = "rvw") 
#'test_vwmodel <- vwsetup()
#'vwtrain(test_vwmodel, data = ext_train_data)
#'vwtest(test_vwmodel, data = ext_test_data)
#'@rdname vwtest
vwtest <- function(vwmodel, data, probs_path = "", full_probs = FALSE, readable_model = NULL, readable_model_path = "", quiet = FALSE, passes = 1L, cache = FALSE, raw = FALSE, progress = NULL, namespaces = NULL, keep_space = NULL, fixed = NULL, targets = NULL, probabilities = NULL, weight = NULL, base = NULL, tag = NULL, multiline = NULL) {
    .Call(`_rvw_vwtest`, vwmodel, data, probs_path, full_probs, readable_model, readable_model_path, quiet, passes, cache, raw, progress, namespaces, keep_space, fixed, targets, probabilities, weight, base, tag, multiline)
}

#'Audit Vowpal Wabbit model
#'
#'Get feature names and their model values. 
#'
#'@param vwmodel Model of vw class to train
#'@param quiet [bool] Do not print anything to the console.
#'@return Data.frame containing feature names, feature hashes and model values
#'@examples
#'ext_train_data <- system.file("extdata", "binary_train.vw", package = "rvw")
#'test_vwmodel <- vwsetup()
#'vwtrain(test_vwmodel, data = ext_train_data)
#'vwaudit(test_vwmodel)
vwaudit <- function(vwmodel, quiet = FALSE) {
    .Call(`_rvw_vwaudit`, vwmodel, quiet)
}
ivan-pavlov/rvwgsoc documentation built on July 1, 2019, 9:40 p.m.