我想知道我怎麼能找到西格瑪的最佳值,當我使用ksvm (我的數據集有1400個觀察21個分類和數值變量) 這裏是我的代碼:SVM kernlab
rbf <- rbfdot(sigma = 0.05)
model <- ksvm(target~.,data = train,prob.model = TRUE,kernel = rbf)
p <- predict(model,test,type="probabilities")
我想知道我怎麼能找到西格瑪的最佳值,當我使用ksvm (我的數據集有1400個觀察21個分類和數值變量) 這裏是我的代碼:SVM kernlab
rbf <- rbfdot(sigma = 0.05)
model <- ksvm(target~.,data = train,prob.model = TRUE,kernel = rbf)
p <- predict(model,test,type="probabilities")
ksvm爲您找出最佳西格瑪值。 讀音字寫
ksvm_model<- ksvm(x=train,y=y,scaled=TRUE,type="nu-svr",kernel="rbfdot", kpar="automatic", prob.model=TRUE,class.weights=NULL,cache=100,cross=5);
#summary(ksvm_model);
# train and test the model over the test data
next_y<-predict(ksvm_model,test_mat,type="response");
的 「kpar =」 自動 「」 這是否爲你工作。
理由檢查這一點。
我同意kpar="automatic"
可能會有所幫助,但這隻適用於一些無監督的啓發式,並不一定爲分類準確性優化參數。做後者的唯一方法是編寫一個將網格搜索與交叉驗證結合使用的包裝器。如果你不想自己寫,那麼mlr軟件包(函數tuneParams()
)可以爲你做。 e1071軟件包(其中包含LIBSVM的接口)還提供了一種功能,可以執行相同類型的功能。
Cheers,UBod