I have an optimization problem I wish to solve that has some special characteristics. I have been trying to figure out how to fit it into the mold that SciPy optimize wants, but have been having some trouble. Could someone familiar with the package help me understand how to get what I want out of it?
My optimization formula is
min(A) sum P(yi=1|A)
s.t. A.T*A == I
Where A
is a matrix.
So I make a function opt_funct
for the minimization function, but how do I pass it the matrix? Do I need to optimize a vector and then reshape the vector into the matrix within the optimization function?
For the constraint, I can make a function that returns A.T*A - eye(d)
, but I need to check that this is all zeros. Should I also reshape it as a vector, and will the constraint section of optimize
know that every part of that vector needs to be 0?