plotperf: Performance plots for the approximation of an SVM model.

Description Usage Arguments Details Author(s) References Examples

Description

Generate performance plots for the approximation of an SVM model.

Usage

1
plotperf(mymodel, mydata, indy, mytestdata, type = "all", filename)

Arguments

mymodel

Element of class ksvm.

mydata

Data on which mymodel was trained on.

indy

Column number of the outcome in mydata.

mytestdata

Data on which to evaluate mymodel. (Optional)

type

Type of performance plot (c="all","lp","probs","outcomes","contributions", "ROC","corrplot"). See details for more information.

filename

Name of the resulting graph.

Details

Different types of plots are possible. When type="all", all the options are generated. When type="lp", the latent variables of the approximation and the original SVM model are plotted against eachother. When type="probs" the estimated probabilities of the approximation and the SVM model are plotted against eachother. When type="outcomes" a bubble plot indicating the agreement between the approximation and the SVM model is generated. When type="contributions", the range of the contributions within the approximation, the range of the rest term and the range of the latent variable of the SVM model are represented by means of boxplots. All of these are shifted to have a median equal to zero. When type="ROC", ROC curves for the approximation and the SVM model are plotted. When mytestdata is non-empty, ROC curves for the test set are also provided.

Author(s)

Vanya Van Belle

References

Van Belle V., Van Calster B., Suykens J.A.K., Van Huffel S. and Lisboa P., Explaining support vector machines: a color based nomogram, Internal Report 16-27, ESAT-Stadius, KU Leuven (Leuven, Belgium), 2016

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#### Support Vector Machine classifier
library(kernlab)
data(iris)
levels(iris$Species)[levels(iris$Species)=="setosa"] <- "other"
levels(iris$Species)[levels(iris$Species)=="virginica"] <- "other"
names(iris)=c("SL","SW","PL","PW","Species")
# good model
model <-ksvm(Species ~ ., data = iris,prob.model=TRUE,kpar=list(0.03),C=10)
# bad model
model2 <-ksvm(Species ~ ., data = iris,prob.model=TRUE,kpar=list(10),C=10)
# plot latent variables of approximation and SVM
plotperf(model,iris,indy=5,type="lp",filename="iris")
plotperf(model2,iris,indy=5,type="lp",filename="iris2")
# plot contributions of approximation and SVM
# good model: rest term is small in comparison with other contributions and lpmodel 
# (latent variable of SVM)
plotperf(model,iris,indy=5,type="contributions",filename="iris") 
# bad model: rest term is large in comparison with other contributions and lpmodel 
# (latent variable of SVM)
plotperf(model2,iris,indy=5,type="contributions",filename="iris2")
# plot latent variables of approximation and SVM
plotperf(model,iris,indy=5,type="outcomes",filename="iris")
plotperf(model2,iris,indy=5,type="outcomes",filename="iris2")

Example output



VRPM documentation built on May 1, 2019, 8:02 p.m.

Related to plotperf in VRPM...