SL.template: Template file for creating new prediction functions to be...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function is only a template for creating new prediction functions to add to the library in the super learner. The function does not run. see SL.glmnet for an example of a working prediction function.

Usage

1
SL.template(Y.temp, X.temp, newX.temp, family, obsWeights, id,...)

Arguments

Y.temp

The outcome

X.temp

The training data set

newX.temp

The validation data set (the observation to make predictions with)

family

currently allows gaussian or binomial to describe the distribution of the outcome

obsWeights

observation weights

id

cluster identification

...

often helpful to include ...

Details

A list with all the wrappers included in the package can be found with the function listWrappers().

All prediction functions in the library must have at least the three arguments Y.temp, X.temp and newX.temp. If the argument family is missing, the ... must be used. The same function will be used in the cross-validation step as in the full data step of the super learner.

Many of the algorithms have tuning parameters specified by the provided functions. These tuning parameters can be easily changed (and also provide a mechanism for new algorithms). For example, the SL.gam model requires the degree to be pre-specified. The default in SL.gam is degree 2. To change these parameters, simply create a new function as in: SL.gam.3 <- function(...,deg.gam=3){SL.gam(...,deg.gam=deg.gam)}. It is often also necessary to create the corresponding predict function as in predict.SL.gam.3 <- function(...){predict.SL.gam(...)}. Check the arguments of the functions listed below for adjustable tuning parameters.

screen.foo functions are designed for dimension reduction steps. The can be supervised or unsupervised, but are limited to selecting a subset of the variables in X.temp. The functions return a logical vector with length equal to the number of variables in X.

Value

out

The predicted outcome (response) on the scale of the outcome. For example, if the outcome is Binomial, the predictions should be probabilities (type="response")

fit

A list of the elements needed for the predict method on the specific algorithm

Author(s)

Eric Polley

See Also

Examples SL.glmnet, SL.polymars and SL.glm

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
## Not run: 
# 
	SL.template <- function(Y.temp,X.temp,newX.temp,family=gaussian(),...){
	if(family$family=="gaussian"){
		# insert estimation and prediction function 
	}
	if(family$family=="binomial"){
		# insert estimation and prediction function 
	}
	# out returns predicted responses (on the scale of the outcome)
	out <- numeric()
	# fit returns all objects needed for predict.SL.template
	fit <- vector("list",length=0)
	foo <- list(out=out,fit=fit)
	class(foo) <- c("SL.template")
	return(foo)

	# screen functions must return a logical vector of length ncol(X)
	screen.template <-function (Y.temp, X.temp, family = gaussian(), ...) 
	{
	   if (family$family == "gaussian") {

	   }
	   if (family$family == "binomial") {

	   }
	whichVariable <- rep(TRUE, ncol(X.temp))
	   return(whichVariable)
}
}

	# 
predict.SL.template <- function(object,newdata,family,X=NULL,Y=NULL,...) {
		# insert prediction function
}


### gaussian family

SL.cforest
SL.gam # deg=2
SL.gam.3 
SL.gam.4
SL.gam.5
SL.gbm.1
SL.gbm.2
SL.glm
SL.glmnet  # alpha = 1.00
SL.glmnet.alpha50 
SL.glmnet.alpha75
SL.glmnet.alpha25
SL.nnet   # size = 2
SL.nnet.3 
SL.nnet.4 
SL.nnet.5
SL.polymars
SL.randomForest
SL.ridge
SL.svm
SL.bayesglm
SL.DSA
SL.DSA.2
SL.stepAIC
SL.step
SL.step.forward
SL.step.interaction
SL.cv.spls
SL.logreg

SL.library <- c("SL.cforest","SL.gam","SL.gam.3","SL.gam.4","SL.gam.5","SL.gbm.1","SL.gbm.2","SL.glm","SL.glmnet","SL.glmnet.alpha25","SL.glmnet.alpha50","SL.glmnet.alpha75","SL.nnet","SL.nnet.3","SL.nnet.4","SL.nnet.5","SL.polymars","SL.randomForest","SL.ridge","SL.svm","SL.bayesglm","SL.DSA","SL.DSA.2","SL.step","SL.step.forward","SL.step.interaction","SL.stepAIC","SL.cv.spls")

### binomial family

SL.knn  # k =10
SL.knn20
SL.knn30 
SL.knn40
SL.knn50 
SL.knn60
SL.knn70
SL.knn80
SL.knn90 
SL.knn100 
SL.knn200 
SL.gam # deg=2
SL.gam.3 
SL.gam.4 
SL.gam.5
SL.gbm.1
SL.gbm.2
SL.glm
SL.glmnet  # alpha = 1.00
SL.glmnet.alpha50 
SL.glmnet.alpha75
SL.glmnet.alpha25
SL.nnet   # size = 2
SL.nnet.3 
SL.nnet.4 
SL.nnet.5 
SL.polymars
SL.randomForest
SL.svm
SL.step.plr
SL.bayesglm
SL.DSA
SL.DSA.2
SL.stepAIC
SL.step
SL.step.forward
SL.step.interaction
SL.logreg

SL.library <- c("SL.knn","SL.knn20","SL.knn30","SL.knn40","SL.knn50","SL.knn60","SL.knn70","SL.knn80","SL.knn90","SL.knn100","SL.knn200","SL.gam","SL.gam.3","SL.gam.4","SL.gam.5","SL.gbm.1","SL.gbm.2","SL.glm","SL.glmnet","SL.glmnet.alpha25","SL.glmnet.alpha50","SL.glmnet.alpha75","SL.nnet","SL.nnet.3","SL.nnet.4","SL.nnet.5","SL.polymars","SL.randomForest","SL.svm","SL.step.plr","SL.bayesglm","SL.DSA","SL.DSA.2","SL.step","SL.step.forward","SL.step.interaction","SL.stepAIC")


## End(Not run)

ecpolley/SuperLearner_Old documentation built on May 15, 2019, 10:08 p.m.