Is the Pearson correlation coefficient -- with one vector, x, exogenous and another vector, y, as a choice variable -- a suitable quadratic objective function for quadratic programming solvers like Gurobi?
-
Looks like a math rather than programming question. And not a well-researched or formulated one at that. E.g.: what does "suitable" mean? And why don't you just check this yourself? – ivan_pozdeev Nov 04 '16 at 21:21
-
@ivan_pozdeev It's not a mathematics question. Obviously I can write down a quadratic programming problem where the objective function is the Pearson correlation coefficient. My question is whether solvers like Gurobi can work with such an objective function. What does "suitable" mean? It is suitable if it the solver would run without error -- that seems fairly intuitive, no? The reason I haven't tested it myself is that I'm very inexperienced in using these solvers and the learning curve to simply set it up would be quite steep for me. – Shane Nov 06 '16 at 16:15
-
"that seems fairly intuitive, no?" - well, no. Usually, "suitable input" for a solver is something with which it converges and/or does that fast enough for you or something along these lines. Which very much depends on the other parts of input and your definition of "fast enough". – ivan_pozdeev Nov 06 '16 at 16:50
-
Fair enough. I agree that if that were what I was asking, it would be an unanswerable question without a lot more information. – Shane Nov 10 '16 at 17:44
1 Answers
A quick Google search for "Gurobi objective function" shows that Gurobi has an API to set an objective function that accepts a linear or quadratic expression. That is quite expected because quadratic programming is, by definition, an optimization of a quadratic function, with the math behind the methods specifically designed for this class (like, working directly with the Q coefficient matrix and the c vector rather than the raw function).
I didn't look into details too much, but I can see that Pearson product-moment correlation coefficient appears to be not a quadratic but a rational function. So, if your specific case can't be simplified to that, no.
I cannot say anything about other solvers because each one is an independent product and has to be considered separately.
Since your function appears to be piecewise continuous and infinitely differentiable, you're probably interested in general-purpose gradient methods instead.

- 33,874
- 19
- 107
- 152
-
This is helpful and I appreciate your answer. My hope was that maximizing the correlation coefficient would still fit within the realm of quadratic programming given that the highest power in a correlation coefficient is 2. But I agree that this doesn't appear to be the case. – Shane Nov 10 '16 at 17:51