svm negative(positive) semidefinite matrix in Rmosek
svm negative(positive) semidefinite matrix in Rmosek
I tried to set up the svm by using Rmosek package, and I got a problem about
using Rmosek.
## SET UP THE "negative semidefinite matrix"
## K is the kernel
## m=nrow(X)
qy1=t(matrix(Y,m,m))
qy2=matrix(Y,m,m)
Q=qy1*qy2*K*-1
At this stage, I have already checked that Q is the negative
semidefinite matrix.
## qobj i
funi=function(a,m)
op=a:m
return(op)
mi=mapply(funi, a=1:m,m=m)
i=as.numeric(unlist(mi[1:m]))
j=rep(1:m,m:1)
library(MCMCpack)
v=vech(Q)
ql$qobj=list(i=i,
j=j,
v=v)
r =mosek(ql,list( soldetail = 1 ))
However, "sometimes" I still get the error : **"The quadratic coefficient matrix
in the objective is not negative semidefinite"**
Optimizer started.
Quadratic to conic reformulation started.
MOSEK error 1296: The quadratic coefficient matrix in the objective is not negative semidefinite as expected for a maximization problem.
Quadratic to conic reformulation terminated. Time: 0.00
Optimizer terminated. Time: 0.00
Optimization interrupted.
ERROR: MSK_RES_ERR_OBJ_Q_NOT_NSD: The quadratic coefficient matrix in the objective is not NSD.
I don't know which part I am missing or doing wrong.
(I have already checked it so many time, and I am still no idea.)
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I would dump the problem to an opf file and check if the quadratic terms are really as you expect them (instructions on Mosek website). And then see if your matrix perhaps has a positive or almost positive eigenvalue after all. Especially if it happens only sometimes.
– Michal Adamaszek
Sep 14 '18 at 11:59