buildEstimationProcedure: Build a boostr compatible estimation procedure.

Description Usage Arguments Value Estimation Procedures Warning References See Also Examples

View source: R/buildEstimationProcedure.R

Description

A convenience function which builds a boostr compatible estimation procedure from functions train and predict.

Usage

1
2
buildEstimationProcedure(train, predict = stats::predict,
  learningSet = "data", predictionSet = "newdata", modelName = "object")

Arguments

train

a function that learns from data to produce a model

predict

a function that leverages the model from train to generate predictions from new data.

learningSet

a string indicating the name of the argument in train's signature that passes data inside train.

predictionSet

a string indicating the name of the argument in predict's signature that indicates the observation to predicate responses for.

modelName

a string indicating the name of the argument in predict's signature that passes the model from train inside predict.

Value

An 'estimationProcedure' object which is compatible with the boostr framework. Meaning, the output is a function factory which accepts arguments

data

the data to be passed to train.

.trainArgs

a list of arguments to be passed to train, in addition to data. If the order of arguments in train is important, you'll need to respect that order inside .trainArgs.

.predictArgs

a list of arguments to pass to predict in addition to modelName and predictionSet. If the order of these arguments matters, respect that order in .predictArgs.

and returns a closure with arguments

newdata

the data whose response variable is to be estimated.

.predictArgs

a list of arguments to pass to predict in addition to modelName and predictionSet. This is defaulted to the value of .predictArgs passed to the parent function, however access to this has been granted as a convenience to the user. Again, if the order of these arguments matters, respect that order in .predictArgs.

Estimation Procedures

The examples below demonstrate two typical estimation procedures. For more information, see the Estimation Procedures section in the vignette vignette(topic = "boostr_user_inputs", package="boostr").

Warning

This function makes the fundamental assumption that the design-pattern linking train and predict is the common train-predict pattern found in the design of SVM in the examples. If this is not the case, you'll want to build assemble your procedure manually and call wrapProcedure instead.

References

Steven Pollack. (2014). Boost: a practical generalization of AdaBoost (Master's Thesis). http://pollackphoto.net/misc/masters_thesis.pdf

See Also

Other Wrapper Generators: wrapAggregator; wrapPerformanceAnalyzer; wrapProcedure; wrapReweighter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
 # examples of estimation procedures
 library(class)
 library(e1071)

  kNN <- function(data, formula, k) {
   df <- model.frame(formula=formula, data=data)
   function(newdata) {
     knn(train=df[, -1], test=newdata, cl=df[, 1], k=k)
   }
  }

  SVM <- function(data, formula, cost) {
   model <- svm(formula, data, cost=cost)
   function(newdata) {
     predict(model, newdata)
   }
  }

## End(Not run)

boostr documentation built on May 2, 2019, 1:42 p.m.