# NOT RUN {
library(RSSL)
library(ggplot2)
library(dplyr)
df <- generateCrescentMoon(200)
# This takes a couple of seconds to run
# }
# NOT RUN {
g_svm <- SVM(Class~.,df,kernel = kernlab::rbfdot(sigma = 1))
g_ls <- LeastSquaresClassifier(Class~.,df)
g_nm <- NearestMeanClassifier(Class~.,df)
df %>%
ggplot(aes(x=X1,y=X2,color=Class,shape=Class)) +
geom_point(size=3) +
coord_equal() +
scale_x_continuous(limits=c(-20,20), expand=c(0,0)) +
scale_y_continuous(limits=c(-20,20), expand=c(0,0)) +
stat_classifier(aes(linetype=..classifier..),
color="black", precision=50,
classifiers=list("SVM"=g_svm,"NM"=g_nm,"LS"=g_ls)
)
# }
Run the code above in your browser using DataLab