wrapAggregator: Create a boostr compatible wrapper for an aggregator.

Description Usage Arguments Value Aggregators References See Also Examples

View source: R/wrapAggregator.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

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