View source: R/interactive2D.R
interactive2D | R Documentation |
Uses tkrplot
to create a GUI for two-class classification
in two dimensions using the smoothed log-concave maximum likelihood estimates
interactive2D(data, cl)
data |
Data in |
cl |
factor of true classifications of the data set |
This function uses tkrplot
to create a GUI for two-class classification
in two dimensions using the smoothed log-concave maximum likelihood estimates. The construction of the
classifier is standard, and can be found in Chen and Samworth (2013). The slider controls the risk
ratio of two classes (equals one by default), which provides a way of demonstrating how the decision boundaries
change as the ratio varies. Observations from different classes are plotted in red and green respectively.
A GUI with a slider
Yining Chen
Madeleine Cule
Robert B. Gramacy
Richard Samworth
Chen, Y. and Samworth, R. J. (2013) Smoothed log-concave maximum likelihood estimation with applications Statist. Sinica, 23, 1373-1398. https://arxiv.org/abs/1102.1191v4
Cule, M. L., Samworth, R. J., and Stewart, M. I. (2010) Maximum likelihood estimation of a log-concave density, Journal of the Royal Statistical Society, Series B, 72(5) p.545-607.
dslcd
,mlelcd
## Simple bivariate normal data
## only works interactively, not run as a test example here
if(interactive()){
set.seed( 1 )
n = 15
d = 2
props=c( 0.6, 0.4 )
x <- matrix( rnorm( n*d ), ncol = d )
shiftvec <- ifelse( runif( n ) > props[ 1 ], 0, 1)
x[,1] <- x[,1] + shiftvec
interactive2D( x, shiftvec )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.