Model is empty, SVM in e1071 package

I have a matrix of N examples x 765. For this, there is a vector of N labels for each of these examples.

I am trying to use SVM to classify them and make predictions. It worked in one case, when I broke all the data into training and verification using this half-division manually:

indicator<-1:(length(idx)/2)
training <- idx[indicator]
test<-idx[-indicator]

However, if I try to randomize the halves of each class in a loop using this:

indicator<-sample(idx, trunc(length(idx)/2))
training <- idx[indicator]
test<-idx[-indicator]

When I call, I get the following error:

svm.model <- svm(x=training,y=trainlabels)

Error in predict.svm(ret, xhold, decision.values = TRUE) : Model is empty!

The size of the matrix and the length of the shortcuts are excellent, the svm () call is what stops working from blue.

trainlabels is a tagged “factor”, svmTraining is a subset of the matrix.

+4
source share
1 answer

, , , , svm . , , 90% A, , , , .

+5

Source: https://habr.com/ru/post/1544170/


All Articles