validatetree {ConsRankClass} | R Documentation |
Validation of the tree for preference rankings
Description
Validation of the tree either with a test set procedure or with v-fold cross validation
Usage
validatetree(
Tree,
testX = NULL,
testY = NULL,
method = "test",
V = 5,
plotting = TRUE
)
Arguments
Tree |
An object of the class "ranktree" coming form te function |
testX |
The data frame containing the test set (predictors) |
testY |
The matrix ontaining the test set (response) |
method |
One between "test" (default) or "cv" |
V |
The cross-validation parameter. Default V=5 |
plotting |
With the defaul option plotting=TRUE, the pruning sequence plot is visualized |
Value
A list containing:
tau | the Tau_x rank correlation coefficient of the sequence of the trees | |
error | the error of the sequence of the trees | |
termnodes | the number of terminal nodes of the sequence of the trees | |
best_tau | the best tree in terms of Tau_x rank correlation coefficient | |
best_error | the best tree in terms of error (it is the same) | |
validation | information about the validation procedure |
#'
Author(s)
Antonio D'Ambrosio antdambr@unina.it
Examples
data(EVS)
EVS$rankings[is.na(EVS$rankings)] <- 3
set.seed(654)
training=sample(1911,1434)
tree <- ranktree(EVS$rankings[training,],EVS$predictors[training,],decrmin=0.001,num=50)
#test set validation
vtreetest <- validatetree(tree,testX=EVS$predictors[-training,],EVS$rankings[-training,])
#cross-validation
vtreecv <- validatetree(tree,method="cv",V=10)
[Package ConsRankClass version 1.0.1 Index]