R - One Class SVM classification with multiple predictions

682 views Asked by At

I have a matrix of X rows and 5 columns with data. I'm trying to use the function One-class SVM with the library kernlab and e1071. First, I'm training the classifier 200 rows with values "TRUE" and then, I classify the rest of rows (74). My problem is the prediction part. Because I have five columns, the classifier predicts all five columns independently giving five predictions from a single row. It should predict with a single TRUE or FALSE label from a single row composed by 5 columns of data. How can I do to get a single label not 5? Thanks.

Data is here https://www.dropbox.com/sh/blnr3jvius8f3eh/AACOhqyzZGiDHAOPmyE__873a?dl=0 with name "Input.csv".

read.csv("Input.csv") 
feature=1 
len=200 
library(kernlab) 
set.seed(1984) 
svp <- svm(as.integer(tag[1:len,feature]),matrix("TRUE",nrow=length(1:len),ncol=1),typ‌​e="one-svc",kernel='laplacedot',C=100,scaled=c()) 
ypred = predict(svp,as.integer(tag[(len+1),feature])) 
print(ypred) 

Raúl

0

There are 0 answers