Re: scipy.optimize.minimize for sparse matrices
Robert Kern <[email protected]> Tue, 24 Jan 2023 09:53:27 -0500
| Newsgroups | gmane.comp.python.scientific.user |
|---|---|
| Message-ID | <CAF6FJitDLZfXiRQ_a+A3XGk0mKEifWDaA81QYSqYC08O=PZRkA@mail.gmail.com> |
--===============0481606417120695321== Content-Type: multipart/alternative; boundary="0000000000003707f605f303af52" --0000000000003707f605f303af52 Content-Type: text/plain; charset="UTF-8" On Tue, Jan 24, 2023 at 1:37 AM simon zhang <[email protected]> wrote: > I am trying to minimize a cost function that consists of sparse matrices > using scipy.optimize.minimze and it seems like scipy.optimize.minimize > isn't designed for sparse matrices operations. Does anyone know any other > functions that allow me to minimize a function made up of sparse matrices > and vectors? Or does anyone have any suggestion how to approach my problem? > We would need some more details about your cost function to provide pointers. `minimize()` doesn't particularly care about what is inside of the cost function, so it certainly _allows_ you to use sparse matrices inside of it. I don't think anything about its design prevents you from using sparse matrices in any way. However, the `minimize()` solvers are better _tuned_ for some problems rather than others, and maybe that's what you are getting at. It is true that the `minimize()` solvers are geared for small-dimensional, non-convex problems. If you have to use sparse matrices, you are probably working with high-dimensional parameter spaces. If you are constructing your cost function just out of sparse matrices and vectors, it seems likely to me that you have a convex cost function. If so, then you will probably want to look at various convex optimization packages: https://www.cvxpy.org/ https://cvxopt.org/ -- Robert Kern --0000000000003707f605f303af52 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Tue, Jan 24, 2023 at 1:37 AM simon zha= ng <<a href=3D"mailto:[email protected]">[email protected]</a>> wrote:<br><= /div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"= margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef= t:1ex">I am trying to minimize a cost function that consists of sparse matr= ices using scipy.optimize.minimze and it seems like scipy.optimize.minimize= isn't designed for sparse matrices operations. Does anyone know any ot= her functions that allow me to minimize a function made up of sparse matric= es and vectors? Or does anyone have any suggestion how to approach my probl= em?<br></blockquote><div><br></div><div>We would need some more details abo= ut your cost function to provide pointers. `minimize()` doesn't particu= larly care about what is inside of the cost function, so it certainly _allo= ws_ you to use sparse matrices inside of it. I don't think anything abo= ut its=C2=A0design prevents you from using sparse matrices in any way. Howe= ver, the `minimize()` solvers are better _tuned_ for some problems rather t= han others, and maybe that's what you are getting at. It is true that t= he `minimize()` solvers are geared for small-dimensional, non-convex proble= ms. If you have to use sparse matrices, you are probably working with high-= dimensional parameter spaces. If you are constructing your cost function ju= st out of sparse matrices and vectors, it seems likely to me that you have = a convex cost function. If so, then you will probably want to look at vario= us convex optimization packages:</div><div><br></div><div><a href=3D"https:= //www.cvxpy.org/">https://www.cvxpy.org/</a><br></div><div><a href=3D"https= ://cvxopt.org/">https://cvxopt.org/</a></div></div><div><br></div>-- <br><d= iv dir=3D"ltr" class=3D"gmail_signature">Robert Kern</div></div> --0000000000003707f605f303af52-- --===============0481606417120695321== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ SciPy-User mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/scipy-user.python.org/ Member address: [email protected] --===============0481606417120695321==--