Generate performance plots for the approximation of an SVM model.

1 |

`mymodel` |
Element of class |

`mydata` |
Data on which |

`indy` |
Column number of the outcome in |

`mytestdata` |
Data on which to evaluate |

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

`filename` |
Name of the resulting graph. |

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.

Vanya Van Belle

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

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")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.