add_prob: Add Class Probability

Description Usage Arguments Value Examples

View source: R/code.R

Description

add_prob Adds class probability results with given dataset (x, y) to the summary list for the all model fits exists in it. Like add_model, it also ensures to conduct prediction for the model and data supports classification.

Usage

1
add_prob(addTo, x, y, outChar, predTag = NULL)

Arguments

addTo

Summary list that will contain all model fit results.

x

A dataframe of input variables.

y

A vector or a dataframe of output variable.

outChar

A charactor value of output class name.

predTag

A charactor value of tag that to be added to the pred result.

Value

Results of each model fitting are added to the summary list.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
library(mlbench)
data(PimaIndiansDiabetes)
index <- sample(seq_len(nrow(PimaIndiansDiabetes)), 500)
trainingSet <- PimaIndiansDiabetes[index, ]
testSet <- PimaIndiansDiabetes[-index, ]
x <- trainingSet[, -9]
y <- trainingSet[, 9]
x_test <- testSet[, -9]
y_test <- testSet[, 9]

sSummary <- list()
sSummary <- add_model(sSummary, x, y)
sSummary <- add_model(sSummary, x, y, model = c("C5.0Cost", "glmnet"), modelTag = "others")
sSummary <- add_prob(sSummary, x_test, y_test, outChar = "pos")
sSummary$glm$pred_test

# vignette("modeval") #check a vignette for further details

## End(Not run)

modeval documentation built on May 29, 2017, 10:54 a.m.