addLearner

0th

Percentile

Add Learners to LearnerList

The function can be used to add new learner to LearnerList in the current R session.

Keywords
resampling, similarity, stability
Usage
addLearner(x)
Arguments
x

a list containing all required information to define a new learner (see Details below).

Details

The function can be used to add new learners to LearnerList in the current R session. The function expects a list of four elements including the name of the learners object class, the name of the package where the class and the fitting method is implemented, the name of the method and a prediction function that predicts class probabilities (in the classification case) or numeric values (in the regression case) and takes the arguments x (the fitted model object), newdata a data.frame containing the predictions of the observations in the evaluation sample and yclass a character string specifying the type of the response variable ("numeric", "factor", etc.). The elements in the list should be named class, package, method and predfun.

See Also

LearnerList

Aliases
  • addLearner
Examples
# NOT RUN {
newlearner <- list(
  class   = "svm",
  package = "e1071",
  method  = "Support Vector Machine",
  predict = function(x, newdata, yclass = NULL) {
    if(match(yclass, c("ordered", "factor"))) {
      attr(predict(x, newdata = newdata, probability = TRUE), "probabilities")
    } else {
      predict(x, newdata = newdata)
    }
  })

addLearner(newlearner)

# }
Documentation reproduced from package stablelearner, version 0.1-2, License: GPL-2 | GPL-3

Community examples

Looks like there are no examples yet.