1

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.)

Amy Chang
  • 23
  • 3
  • 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

0 Answers0