Maximum entropy infeasible dual (MOSEK)

83 Views Asked by At

I am trying to solve the following optimization problem

\begin{align} \max_{\hat{y}_{ik}} & -\sum_{i=1}^n\sum_{k=1}^q \hat{y}_{ik}\log \hat{y}_{ik}\\ \text{subject to} &\sum_{k=1}^q \hat{y}_{ik} = 1 \ \ \ \text{for all } i\\ &\sum_{i=1}^{n}\hat{y}_{ik}x_{if} = \sum_{i=1}^n y_{ik}x_{if} \ \ \ \text{for all } f,k \end{align} which is a maximum entropy formulation of logistic regression, $m$ is the number of features in the data set, $q$ is the number of target class in the target categorical variable, $\hat{y}_{ik}$ is the estimated probability that observation $i$ belong to category $k$. In my case, I have $q=2$, $n=7326$ and $m=62$.

Solving this with MOSEK in some cases seems to yield an infeasible dual solution. Here is part of the output from MOSEK using cvxpy package for optimization.

I don't really understand what is going on. It seems to me that the problem should never be infeasible. Am I mistaken? Here, the output seems to say that all variables are causing the problem to be infeasible. Why is the lower bound not equal to 0 (should be with the log function) ?

1

There are 1 best solutions below

1
On

This is more suitable for stackoverflow, but...

Assuming you are using the latest CVXPY which dualizes conic problems, Mosek saying dual infeasible actually means your problem is primal infeasible. Since Mosek finds the certificate almost immediately, it is probably a simple contradiction in the linear constraints, likely by mistake. Try solving only the linear part, i.e. remove the objective. This https://docs.mosek.com/9.2/pythonfusion/debugging-infeas.html#suggestions always applies.

Trying to understand how the report relates to your problem is hard because cvxpy made many transformations in between and you have to know cvxpy internals extremely well to know what gets mapped to what.