gbm_reg: Custom function for regression by Gradient Boosting Machine

Description Usage Arguments Value Author(s)

View source: R/PredFuncAC.R

Description

This function takes training data, tesing data, target variable, tuning parameters, and predict target variable of the training data by GBM regression model.

Usage

1
2
3
4
5
6
7
gbm_reg(train,test,target,
drop = NULL,num_trials=10,
interaction.depth=c(1:7),
n.trees=c(50,100,200,500,700),
shrinkage=c(.1,.01,.001),
n.minobsinnode=c(1,2,5,10),
type='NULL')

Arguments

train

Training Data as a dataframe.

test

Testing Data as a dataframe.

target

Name of the variable that needs to predict

drop

Name of the variable that needs to be dropped before building the model.

num_trials

Total number of trails to find best combination of GBM parameters causing minimum error

interaction.depth

GBM Tuning parameter: Integer specifying the maximum depth of each tree (i.e., the highest level of variable interactions allowed). A value of 1 implies an additive model, a value of 2 implies a model with up to 2-way interactions, etc. Default is c(1:7)

n.trees

GBM Tuning parameter: Integer specifying the total number of trees to fit. This is equivalent to the number of iterations and the number of basis functions in the additive expansion. Default is c(50,100,200,500,700).

shrinkage

GBM Tuning parameter: a shrinkage parameter applied to each tree in the expansion. Also known as the learning rate or step-size reduction; 0.001 to 0.1 usually work, but a smaller learning rate typically requires more trees. Default is c(.1,.01,.001)

minobsinnode

GBM Tuning parameter: Integer specifying the minimum number of observations in the terminal nodes of the trees. Note that this is the actual number of observations, not the total weight.Default is c(1,2,5,10)

type

if type = "tuning", it will return the least error with best value of the best parameter combination,any other value will return the prediction on testing data.

Value

The value returns from this function is a numeric vector.

Author(s)

ABIR CHAKRABORTY < mail2abirchakraborty@gmail.com >


AbirChakraborty1/RegFunction documentation built on Feb. 25, 2022, 12:22 p.m.