# NOT RUN {
str(iris)
data <- iris[, 1:4]
label <- iris[, 5]
ccp(y = label, d = data, method = "multinom",maxit = 1000,MaxNWts = 2000,trace=FALSE)
## Call:
## ccp(y = label, d = data, method = "multinom", maxit = 1000,
## MaxNWts = 2000, trace = FALSE)
## Overall Correct Classification Probability:
## 0.9866667
## Category-specific Correct Classification Probability:
## CATEGORIES VALUES PREVALENCE
## 1 setosa 1.00 0.3333333
## 2 versicolor 0.98 0.3333333
## 3 virginica 0.98 0.3333333
ccp(y = label, d = data, method = "multinom")
ccp(y = label, d = data, method = "svm")
ccp(y = label, d = data, method = "svm",kernel="sigmoid",cost=4,scale=TRUE,coef0=0.5)
ccp(y = label, d = data, method = "tree")
p = as.numeric(label)
ccp(y = label, d = p, method = "label")
table(mtcars$carb)
for (i in (1:length(mtcars$carb))) {
if (mtcars$carb[i] == 3 | mtcars$carb[i] == 6 | mtcars$carb[i] == 8) {
mtcars$carb_new[i] = 9
}else{
mtcars$carb_new[i] = mtcars$carb[i]
}
}
data <- data.matrix(mtcars[, c(1)])
mtcars$carb_new <- factor(mtcars$carb_new)
label <- mtcars$carb_new
str(mtcars)
ccp(y = as.numeric(label), d = data, method = "svm",kernel="radial",cost=1,scale=TRUE)
## Call:
## ccp(y = as.numeric(label), d = data, method = "svm", kernel = "radial", cost = 1, scale = TRUE)
## Overall Correct Classification Probability:
## 0.4375
## Category-specific Correct Classification Probability:
## CATEGORIES VALUES PREVALENCE
## 1 1 0.5714286 0.21875
## 2 2 0.2000000 0.31250
## 3 3 0.8000000 0.31250
## 4 4 0.0000000 0.15625
# }
Run the code above in your browser using DataLab