predQuantile: Analyze predictions of supervised model in quantiles

Description Usage Arguments Value See Also Examples

Description

Analyzing results of supervised model using test data and quantiles. Note only model or testPred are necessary, not both. testPred is advised.

Usage

1
2
predQuantile(model = NULL, xtest = NULL, ytest, n = 5, roundText = 3,
  testPred = NULL, fw = NULL)

Arguments

model

the model to get predictions from. Uses predict method. If testPred is specified, we don't need this parameter, Probably safer to just use testPred, unless the model you have has a predict method that will work as intended without any other arguments.

ytest

vector of test data (target variable)

n

number of quantiles

roundText

decimals to print

testPred

vector of predictions from test data. Do not use if using model parameter.

fw

numeric vector, of bins. Defaults to

xtext

data.frame of test data (predictor variables only)

Value

data.frame of results

See Also

predSortPlot

Examples

1
2
3
4
5
6
7
8
9
require('randomForest')
rf <- randomForest(x=mtcars[1:25,1:8], y=as.factor(mtcars[1:25, 'am']), ntree=5)
mtcarsTestPred <- predict(rf, mtcars[26:32, 1:8], type='prob')[,2]
pq2 <- predQuantile(xtest=mtcars[26:32, 1:8], ytest=mtcars[26:32, 'am'], n=3, roundText=4, testPred=mtcarsTestPred)
pq <- predQuantile(xtest=mtcars[26:32, 1:8], ytest=mtcars[26:32, 'am'], fw=seq(.1,1,length.out=10), roundText=4, testPred=mtcarsTestPred)

barplot(pq$actual, names=pq$predRange, ylab='True Positives', las=2, cex.names=.7)
barplot(pq$hitRate, names=pq$predRange, ylab='True Positive Hit Rate', las=2, cex.names=.7)
barplot(pq$predMax-pq$predMin, pq$hitRate, names=pq$predRange, ylab='prediction', las=2, cex.names=.7)

brooksandrew/Rsenal documentation built on May 13, 2019, 7:50 a.m.