我使用函数
在R中保存了一个svm()模型saveRDS(model2, "model2.RDS")
然后,我使用以下内容来查看模型的“摘要”:
model2 <-readRDS("model2.RDS")
summary(model2)
摘要功能的输出现在与以前完全不同。我做错了什么?
Length Class Mode
call 9 -none- call
type 1 -none- numeric
kernel 1 -none- numeric
cost 1 -none- numeric
degree 1 -none- numeric
gamma 1 -none- numeric
coef0 1 -none- numeric
nu 1 -none- numeric
epsilon 1 -none- numeric
sparse 1 -none- logical
scaled 14088 -none- logical
x.scale 0 -none- NULL
y.scale 0 -none- NULL
nclasses 1 -none- numeric
levels 2 -none- character
tot.nSV 1 -none- numeric
nSV 2 -none- numeric
labels 2 -none- numeric
SV 1 matrix.csr S4
过去看起来像这样:
Call:
svm.default(x = dtm_train_tfidf, y = train$gender, scale = "F", type = "C-classification", kernel = "linear", cost = 1,
cross = 10)
Parameters:
SVM-Type: C-classification
SVM-Kernel: linear
cost: 1
gamma: 7.09824e-05
Number of Support Vectors: 4278
( 2125 2153 )
Number of Classes: 2
Levels:
0 1
10-fold cross-validation on training data:
Total Accuracy: 63.10417
Single Accuracies:
63.75 59.375 65 63.75 64.16667 63.95833 61.04167 63.54167 64.58333 61.875
编辑:问题已解决。我应该加载库'e1071',它用于创建我尝试在summary()函数中使用的模型。