Learn R Programming

boostr (version 1.0.0)

wrapAggregator: Create a boostr compatible wrapper for an aggregator.

Description

Use provided metadata on a given aggregator to create a boostr compatible wrapper. See section below for details on aggregators.

Usage

wrapAggregator(aggregator, .inputEnsemble = "estimators", .verbose = FALSE)

Arguments

aggregator
a function which satisfies the abstract definition of an aggregator.
.inputEnsemble
a string indicating the name of the argument that aggregator uses for the ensemble of estimators created during the Boost algorithm.
.verbose
a logical flag indicating whether warnings should be output or not.

Value

A function with is also an 'aggregator' object. The function's signature and output are now compatible with the boostr framework. In particular, the signature of the wrapper is
estimators
the list of estimators to be sent to aggregator.
...
any additional arguments accepted/required by aggregator.
The output of this aggregator is an estimator with signature
newdata
the data the aggregator's output would use for prediction.

Aggregators

See the Aggregators section in the vignette vignette(topic = "boostr_user_inputs", package="boostr") for more details on aggregators.

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: buildEstimationProcedure; wrapPerformanceAnalyzer; wrapProcedure; wrapReweighter

Examples

Run this code
## Not run: 
# testAggregator <- function(ensemble) {
#  weights <- runif(min=0, max=1, n=length(ensemble))
#  function(x) {
#    preds <- foreach(estimator = iter(ensemble),
#                   .combine = rbind) %do% {
#                     matrix(as.character(estimator(x)), nrow=1)
#                   }
# 
#    as.factor(predictClassFromWeightedVote(preds, weights))
#  }
# }
# 
# wrappedAggregator <- wrapAggregator(testAggregator,
#                                     .inputEnsemble="ensemble")
# ## End(Not run)

Run the code above in your browser using DataLab