1

I'm using the text2vec package to create a vocabulary document term matrix as described here: http://text2vec.org/vectorization.html#vectorization

In particular, I am using SVM from the e1071 package. I made a similar vocabulary term document matrix as provided in the tutorial, and I trained a SVM classifier using this code:

svm_classifier <- svm(dtm_train, train$gender, kernel="linear", type='C-classification')

Where dtm_train is the document term matrix.

I was wondering how we could use the plot function to plot the model, in a similar way like this:

plot(classifier, data).

I tried to do it as follows:

plot(svm_classifier, dtm_train)

This returns the following error:

Error in plot.svm(svm_classifier, dtm_train) : missing formula.

Kwiebes
  • 43
  • 1
  • 6

0 Answers0