TuneMultifoldCV: Main Parameter Tuning Function

Description Usage Arguments Value

Description

This function takes in information from a forest grown on a test and training set and calls Evaluate_Tuning_Candidates() to assess performance for different values of alpha and then makes predictions on the test set for each alpha. It records the performance on test data for each alpha chosen. We can check how the value of alpha suggested by CV performs.

Usage

1
2
TuneMultifoldCV(TRAIN, TEST, OOBWeights, PredWeights, OutlierInd, ntrees,
  ntreestune, ndsize, parvec, cvreps, cvfolds, tol)

Arguments

TRAIN

matrix of training cases with response in last column

TEST

matrix of test cases with response in last column

OOBWeights

matrix of training cases with response in last column

PredWeights

Vector of zeros and ones indicating whether training cases came from contaminating distribution

OutlierInd

Vector of zeros and ones indicating whether training cases came from contaminating distribution

ntrees

number of trees for forest used in predictions of test data

ntreestune

number of trees for forests used to set tuning parameter alpha

ndsize

nodesize random forest tuning parameter for cross validation

parvec

vector of candidate values for tuning parameter alpha

cvreps

number of repetitions of cross validation

cvfolds

number of folds to perform in cross validation

tol

maximal change in interation for LOWESSRF weights in cross validation

ntreestune

number of trees to use for forests involved in parameter tuning

Value

Returns list of eight elements containing: 1. LOOBERR: 6 by 3 by length (parvec) array containing OOB error First index represents 1-MSE without downweighting outliers in CV error 2-MAPE without downweighting outliers in CV error 3-MSE downweighting outliers according to BisqwtRF 4-MAPE downweighting outliers according to BisqwtRF 5-MSE downweighting outliers according to BisqwtRFL 6-MAPE downweighting outliers according to BisqwtRFL Second index represents whether to set alpha using all cases in TRAIN2, outliers only, nonoutliers only 2. LPREDERR: length(parvec) by 2 matrix containing MSPE in first column and MAPE in 2nd column for predictions on test cases using each value of alpha in the parvec 3. ChosenPars: 6 by 3 matrix containing the values of alpha selected using each approach with indices same as for LOOBERR 4. BestPars: Vector of length 2, containing value of alpha that performed best on test data for MSPE(1) and MAPE(2) 5. Diff: 6 by 3 matrix containing the difference between the value of alpha chosen by each weighting crietera and function applied to the training data, and the one performing best on the test data 6. ERR: 3 by 6 matrix containing error on test data (either MSPE in columns 1,3,5 or MAPE in columns 2,4,6) where columns denote the parameter choice determined using the 6 criteria explained in the rows for LOOBERR and rows represent using (1) All training cases, (2) Only Outliers, (3) Only nonoutliers in tuning.


AndrewjSage/RFLOWESS documentation built on May 26, 2019, 6:38 a.m.