[SciPy-User] Alternatives to scipy.optimize

josef.pktd@gmai... josef.pktd@gmai...
Sat Feb 25 17:33:29 CST 2012

On Sat, Feb 25, 2012 at 3:07 PM, Christopher Jordan-Squire
<cjordan1@uw.edu> wrote:
> On Sat, Feb 25, 2012 at 11:17 AM, Erik Petigura <eptune@gmail.com> wrote:
>> Dear Scipy,
>> Up until now, I've found the optimize module very useful.  Now, I'm finding
>> that I need finer control.  I am fitting a model to data that is of the
>> following from:
>> model = func1(p1) + func2(p2)
>> func1 is nonlinear in its parameters and func2 is linear in its parameters.
>> There are two things I am struggling with:
>> 1. I'd like to find the best fit parameters for func1 using an iterative
>> approach (e.g. simplex algorithm that changes p1.).  At each iteration, I
>> want to compute the optimum p2 by linear least squares in the interest of
>> speed and robustness.
> Are p1 and p2 coupled somehow? They must be, or computing p2 at each
> iteration wouldn't be relevant.

assuming he meant  y = f(x1,p1) + x2*p2 + error
and minimizing for example sum of squared error
then the estimation of p1 and p2 cannot be separated.

a quickly written draft of how I would do it, (which might be added to
statsmodels after cleanup, adding results statistics and testing).
It should be possible to subclass and overwrite the nonlinear
function/method predict_nonlin

no fixed parameters yet


> This seems like a modification that could be made to the source code
> without too much trouble, if iirc. Alternatively, you could possibly
> use the callback option in fmin.
>> 2. I'd also like the ability to hold certain parameters fixed in the
>> optimization with out redefining my objective function each time.
> Could you pass in a lambda function with those parameters fixed?
> -Chris JS
>> Is there another module you would recommend?  I've found openopt, but I
>> wanted to get some guidance before I dive in to that.
>> Erik
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list