Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201919

SVM algortihm use shape to differentiate succesfull predictions and errors in R

$
0
0

It´s my first post so apologies i´m im skipping procedures. I´ve tried to look for a similar answer but didnt found it.

I have to differentiate succesfull predictions from a svm algorithm from errors using shape (like dots for succesfull prediction and triangles for errors)

>f21<-ggplot(testData, aes(x=Km, y=Margen, color=Comercial)) + geom_point(aes(size=Ingresos)) + >geom_smooth(method=lm, aes(fill=Comercial))+ stat_ellipse(type = "norm")

[f21 plot][1]

I am supposed to use a trained model_svm to use this. The code I´ve used for svm algorithm its:

RNGversion('3.5.3')

set.seed(1234)
ind <- sample(2, nrow(Data_PEC), replace=TRUE, prob=c(0.7, 0.3))
trainData <- Data_PEC[ind==1,]
testData <- Data_PEC[ind==2,]
model_svm = svm(trainData[,1:4], trainData$Comercial)
preds_svm = predict(model_svm, testData[,1:4])
table(preds_svm, testData$Comercial)

preds_svm A B C A 10 0 0 B 0 12 2 C 0 0 14

I see there´s two missclassifications, but I have no idea how to use this to change the shape in the plot.

Thanks a lot in advance


Viewing all articles
Browse latest Browse all 201919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>