I am interested in fitting a SVM model to my data with Elastic SCAD penalty. I was trying to use the penalizedSVM library for this. The issue is that for some reason, the library outputs a null model and I am not sure where I am going wrong with the coding.

I will include a minimal working example to show what I mean.


X=matrix(c(3, 2, 4, 1, 2, 4, 4, 4, 2, 4, 4, 1, 3, 1),nrow=7 )
Y=c(-1, -1, -1, -1, 1, 1, 1)

#Note this is linearly separable
plot(X[,1], X[,2],  pch=16, col=Y+2)

#penalty weights

scadfit1=svmfs(X,Y, fs.method="scad+L2", grid.search="discrete",
               lambda1.set = lambda.grid1 , lambda2.set = lambda.grid2, 
               bounds=NULL, parms.coding = "none", inner.val.method = "cv", cross.inner =10, show="none", calc.class.weights = TRUE, class.weights = NULL, seed=1)

#returns null

#is scalar

Additionally, the w vector is scalar for some reason. If anyone has tried this method or could help me understand what I am doing wrong, I would really appreciate it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.