convergence_plot: convergence_plot

Description Usage Arguments Details Examples

Description

Can be used to check model convergence.

Usage

1
convergence_plot(model, Xtest, ytest, burnin = 0)

Arguments

model

list containing a model of class "hs_rulefit".

Xtest

Out of bag sample to check error.

ytest

response of test data.

burnin

Number of samples disregarded as burnin.

Details

Convergence is checked by the convergence of the prediction error on unseen test data, to find a suitable number of iterations, in the spirit of gradient boosting. To check convergence on the Training data just use training X and y instead of Xtest and ytest.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(MASS)
data(Boston)
#Split in train and test data
N = nrow(Boston)
train = sample(1:N, 400)
Xtrain = Boston[train,-14]
ytrain = Boston[train, 14]
Xtest = Boston[-train, -14]
ytest = Boston[-train, 14]

hrres = HorseRuleFit(X = Xtrain, y=ytrain,
                    thin=1, niter=100, burnin=10,
                    L=5, S=6, ensemble = "both", mix=0.3, ntree=100,
                    intercept=FALSE, linterms=1:13, ytransform = "log",
                    alpha=1, beta=2, linp = 1, restricted = 0)

#Check the model convergence out of sample
convergence_plot(hrres, Xtest, ytest, burnin = 10)

Example output



horserule documentation built on May 2, 2019, 10:04 a.m.