Functions for cross-validating gbm. These functions are used internally and are not intended for end-user direct usage.
Usage
gbmCrossVal(
cv.folds,
nTrain,
n.cores,
class.stratify.cv,
data,
x,
y,
offset,
distribution,
w,
var.monotone,
n.trees,
interaction.depth,
n.minobsinnode,
shrinkage,
bag.fraction,
var.names,
response.name,
group
)
gbmCrossValErr(cv.models, cv.folds, cv.group, nTrain, n.trees)
gbmCrossValPredictions(cv.models, cv.folds, cv.group, n.trees.predict, data)
gbmCrossValModelBuild(
cv.folds,
cv.group,
n.cores,
i.train,
x,
y,
offset,
distribution,
w,
var.monotone,
n.trees,
interaction.depth,
n.minobsinnode,
shrinkage,
bag.fraction,
var.names,
response.name,
group
)
gbmDoFold(
X,
i.train,
x,
y,
offset,
distribution,
w,
var.monotone,
n.trees,
interaction.depth,
n.minobsinnode,
shrinkage,
bag.fraction,
cv.group,
var.names,
response.name,
group,
s
)Arguments
- cv.folds
The number of cross-validation folds.
- nTrain
The number of training samples.
- n.cores
The number of cores to use.
- class.stratify.cv
Whether or not stratified cross-validation samples are used.
- data
The data.
- x
The model matrix.
- y
The response variable.
- offset
The offset.
- distribution
The type of loss function. See
gbm.- w
Observation weights.
- var.monotone
See
gbm.- n.trees
The number of trees to fit.
- interaction.depth
The degree of allowed interactions. See
gbm.- n.minobsinnode
See
gbm.- shrinkage
See
gbm.- bag.fraction
See
gbm.- var.names
See
gbm.- response.name
See
gbm.- group
Used when
distribution = "pairwise". Seegbm.- cv.models
A list containing the models for each fold.
- cv.group
A vector indicating the cross-validation fold for each member of the training set.
- n.trees.predict
The number of trees to use for cross-validation predictions.
- i.train
Items in the training set.
- X
Index (cross-validation fold) on which to subset.
- s
Random seed.
References
J.H. Friedman (2001). "Greedy Function Approximation: A Gradient Boosting Machine," Annals of Statistics 29(5):1189-1232.
L. Breiman (2001). https://www.stat.berkeley.edu/users/breiman/randomforest2001.pdf.
Author
Greg Ridgeway gregridgeway@gmail.com