简体   繁体   中英

Plot SVM model in R -Text classification

I am using SVM model from e1017 in R. I have used SVM for text mining and classification. So my data is dtm(document term matrix obtained from documents corpus). How can I go about plotting my SVM model?

Below is my svm model I used in my code for class prediction

model <- svm(dtm, classvec, kernel="linear")

When I use plot(model, dtm) I get the error

missing formula

plot.svm gives missing formula because when you have more than 3 column in your matrix including target variable plot function doesn't know which variables to choose as x and y to plot.To overcome the error you have to explicitly specify x and y in the command.

model <- svm(dtm, classvec, kernel="linear")
plot(model,dtm,x~y)

where x and y are columns you would like to plot from your matrix

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM