# How should I handle logistic function by cvx?

Hi,every one, I really need your help in solving the following problem:

\begin{gathered} \mathop {\min }\limits_{\mathbf{w}} \;\operatorname{tr} \left[ {{{\left( {\sum\limits_{n = 1}^N {\phi \left( {{w_n}} \right){{\mathbf{A}}_n}} } \right)}^{ - 1}}} \right] \hfill \\ {\text{s}}{\text{.t}}\;\sum\limits_{n = 1}^N {\phi \left( {{w_n}} \right) = L} \hfill \\ \end{gathered}

where {\mathbf{w}} = {\left[ {{w_1}, \cdots ,{w_N}} \right]^{\text{T}}}, \phi \left( x \right) = \frac{1}{{1 + {e^{ - \rho x}}}},\rho \geq 0 and {{\mathbf{A}}_n} \succeq {\mathbf{0}}. I already notice that functions from the exponential family can not be easily handled by cvx. Nevertheless, you have constructed a successive approximation to support the exponential family of functions. How should I solve my problem with the successive approximation in cvx ? Thank you.

Thank you for your reply. Unfortunately, after reading your instructions, I still don’t know how to formulate my problem in the framework of CVX and CVXQUAD. Only the inequality constraint " exp(cvx_expression) <= z" is mentioned in the examples. I have no idea on the exact form of an arbitrary expression that contains exponential function like the objective function and the equality constraint in my problem. Can you give me more help? Thanks.

Read section 7.1.1 of “Convex Optimization”, Boyd and Vandenberghe http://web.stanford.edu/~boyd/cvxbook/ , in particular the material on logistic regression, as well as http://web.cvxr.com/cvx/examples/cvxbook/Ch07_statistical_estim/html/logistics.html which implements that material in CVX.

After you get through with change of variables, you better hope the equality constraint winds up being affine, otherwise the formulation would be non-convex, and you;d be out of luck with CVX. I leave that determination as an exercise for you.

Digging up the example on the web page made me realize I had forgotten to address log_sum_exp in the CVXQUAD thread. It turns out that log_sum_exp does not require reformulation in order for CVXQUAD’s Padé approximant to be invoked. I updated the CVXQUAD thread accordingly. If you run the example on the linked webpage, CVXQUAD’s Padé approximant is invoked if it is installed per my directions.