[SciPy-User] Minimize many scalar functions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] Minimize many scalar functions

Poughon Victor

Hi all,

 

I'd like to minimize hundreds of thousands of scalar valued functions. Is there a faster way than a for-loop over a def of the objective function and a call to scipy.optimize.minimize_scalar? Basically a vectorized version, where I could give a function foo and a 2D numpy array where each row is given as extra data to the objective function.

 

Thanks,

 

Victor Poughon

 


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Minimize many scalar functions

Guillaume Gay

Hi Victor,

I guess it depends a lot on the scalar functions and if they can be vectorized... But you can always optimize on an array of inputs with optimize.minimize, can't you?

A more explicit example would help us help you I guess.


Best


Guillaume



Le 16/02/2018 à 17:16, Poughon Victor a écrit :

Hi all,

 

I'd like to minimize hundreds of thousands of scalar valued functions. Is there a faster way than a for-loop over a def of the objective function and a call to scipy.optimize.minimize_scalar? Basically a vectorized version, where I could give a function foo and a 2D numpy array where each row is given as extra data to the objective function.

 

Thanks,

 

Victor Poughon

 



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

-- 
Guillaume Gay, PhD

Morphgénie Logiciels SAS
http://morphogenie.fr

12 rue Camoin Jeune
13004 Marseille

 +336 51 95 94 00

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Minimize many scalar functions

Poughon Victor

Hi Guillaume,

 

Thanks for the answer. It looks my problem is acknowledged on a few github issues and PRs, see here for example:

https://github.com/scipy/scipy/pull/8357

 

However I’m not sure that even this PR would solve my specific usage of many calls to optimize.minimize_scalar with objective functions parametrized slightly differently for each.

 

Victor Poughon

 

De : SciPy-User [mailto:scipy-user-bounces+victor.poughon=[hidden email]] De la part de Guillaume Gay
Envoyé : samedi 17 février 2018 16:05
À : [hidden email]
Objet : Re: [SciPy-User] Minimize many scalar functions

 

Hi Victor,

I guess it depends a lot on the scalar functions and if they can be vectorized... But you can always optimize on an array of inputs with optimize.minimize, can't you?

A more explicit example would help us help you I guess.

 

Best

 

Guillaume

 

 

Le 16/02/2018 à 17:16, Poughon Victor a écrit :

Hi all,

 

I'd like to minimize hundreds of thousands of scalar valued functions. Is there a faster way than a for-loop over a def of the objective function and a call to scipy.optimize.minimize_scalar? Basically a vectorized version, where I could give a function foo and a 2D numpy array where each row is given as extra data to the objective function.

 

Thanks,

 

Victor Poughon

 




_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



-- 
Guillaume Gay, PhD
 
Morphgénie Logiciels SAS
http://morphogenie.fr
 
12 rue Camoin Jeune
13004 Marseille
 
 +336 51 95 94 00

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Minimize many scalar functions

Chris Barker - NOAA Federal

However I’m not sure that even this PR would solve my specific usage of many calls to optimize.minimize_scalar with objective functions parametrized slightly differently for each.


Function call overhead is notoriously large in Python, but optimizations are usually very expensive as well.

Is the function call overhead really the bottleneck here?

-CHB



 

Victor Poughon

 

De : SciPy-User [[hidden email]] De la part de Guillaume Gay
Envoyé : samedi 17 février 2018 16:05
À : [hidden email]
Objet : Re: [SciPy-User] Minimize many scalar functions

 

Hi Victor,

I guess it depends a lot on the scalar functions and if they can be vectorized... But you can always optimize on an array of inputs with optimize.minimize, can't you?

A more explicit example would help us help you I guess.

 

Best

 

Guillaume

 

 

Le 16/02/2018 à 17:16, Poughon Victor a écrit :

Hi all,

 

I'd like to minimize hundreds of thousands of scalar valued functions. Is there a faster way than a for-loop over a def of the objective function and a call to scipy.optimize.minimize_scalar? Basically a vectorized version, where I could give a function foo and a 2D numpy array where each row is given as extra data to the objective function.

 

Thanks,

 

Victor Poughon

 




_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



-- 
Guillaume Gay, PhD
 
Morphgénie Logiciels SAS
http://morphogenie.fr
 
12 rue Camoin Jeune
13004 Marseille
 
 +336 51 95 94 00
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user