我想基于具有78个特征的数据集开发一种惩罚支持向量机。 我使用了“ penalizedSVM”软件包进行分析。 运行模型时,出现以下错误: if(any(co)){:需要TRUE / FALSE时缺少值
然后,我将结果列手动转换为1s和-1s,然后再次运行模型。但是,我得到了同样的错误。
install.packages("penalizedSVM")
library(penalizedSVM)
x<-as.matrix(Sus.Food.Train[,1:78])
y<-factor(Sus.Food.Train[,79:79],labels=c(-1,1))
lambda<-seq(0.01, 0.05, 0.01)
> penmodel<-svmfs(x,y, fs.method = c("scad"), grid.search=c("interval","discrete"), lambda1.set=lambda, lambda2.set=lambda, bounds=NULL, parms.coding= c("log2","none"), maxevals=500, inner.val.method = c("cv", "gacv"), cross.inner= 5, show= c("none", "final"), calc.class.weights=FALSE, class.weights=NULL, seed=123, maxIter=700, verbose=TRUE)
[1] "grid search"
[1] "interval" "discrete"
[1] "show"
[1] "none" "final"
[1] "feature selection method is scad"
[1] "start interval search"
[1] "inner validation method: cv" "inner validation method: gacv"
[1] "parms.coding"
[1] "log2" "none"
[,1]
[1,] -7.5187811
[2,] -2.2570884
[3,] -1.3406547
[4,] 9.9856059
[5,] 9.0326471
[6,] 7.5339884
[7,] -2.6916590
[8,] -3.7342166
[9,] 0.4908525
[10,] -6.1744144
[11,] 3.1843862
[12,] -7.1037934
[13,] -8.2601756
[14,] -9.9773981
[15,] 6.5240792
[16,] 4.9833827
[17,] 5.4236162
[18,] -0.3860734
[19,] 3.6012491
[20,] 2.2445321
[21,] -5.0723613
[1] "parms.coding"
[1] "log2" "none"
[1] "lambda1= 0.005"
[1] "maxIter= 700"
Fehler in if (any(co)) { : Fehlender Wert, wo TRUE/FALSE nötig ist
Zusätzlich: Es gab 50 oder mehr Warnungen (Anzeige der ersten 50 mit warnings())
预期的输出将是一个可调用的模型,该模型显示的特征减少了。