Description Usage Arguments Details Value Author(s) See Also Examples
These functions contain the information on the loss function and the model to combine algorithms
1 2 3 4 5 6 7 8 9 | write.method.template(file = "", ...)
## a few built in options:
method.NNLS()
method.NNLS2()
method.NNloglik()
method.CC_LS()
method.CC_nloglik()
method.AUC(nlopt_method=NULL, optim_method="L-BFGS-B", bounds=c(0, Inf), normalize=TRUE)
|
file |
A connection, or a character string naming a file to print to. Passed to |
optim_method |
Passed to the |
nlopt_method |
Either |
bounds |
Bounds for parameter estimates |
normalize |
Logical. Should the parameters be normalized to sum up to 1 |
... |
Additional arguments passed to |
A SuperLearner
method must be a list (or a function to create a list) with exactly 3 elements. The 3 elements must be named require
, computeCoef
and computePred
.
A list containing 3 elements:
require |
A character vector listing any required packages. Use |
computeCoef |
A function. The arguments are: |
computePred |
A function. The arguments are: |
Eric C Polley epolley@uchicago.edu
1 | write.method.template(file = '')
|
Loading required package: nnls
Super Learner
Version: 2.0-24
Package created on 2018-08-10
method.template <- function() {
out <- list(
# require allows you to pass a character vector with required packages
# use NULL if no required packages
require = NULL,
# computeCoef is a function that returns a list with two elements:
# 1) coef: the weights (coefficients) for each algorithm
# 2) cvRisk: the V-fold CV risk for each algorithm
computeCoef = function(Z, Y, libraryNames, obsWeights, control, verbose, ...) {
cvRisk <- numeric()
coef <- numeric()
out <- list(cvRisk = cvRisk, coef = coef)
return(out)
},
# computePred is a function that takes the weights and the predicted values
# from each algorithm in the library and combines them based on the model to
# output the super learner predicted values
computePred = function(predY, coef, control, ...) {
out <- crossprod(t(predY), coef)
return(out)
}
)
invisible(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.