lsquares fitting and constrains for parameters (looking for positive values of parameters)
Subject: lsquares fitting and constrains for parameters (looking for positive values of parameters)
From: Raymond Toy
Date: Mon, 16 Jan 2012 10:27:49 -0800
On Mon, Jan 16, 2012 at 9:19 AM, <gwpublic at wp.pl> wrote:
> > If you do not need a symbolic solution,
>
> You're right. I need concrete values. (I've forgot to say it in
> problem statement).
>
> > you might be interested in
> > fmin_cobyla, which will produce the minimum of a function subject to
> > equality or inequality constraints.
>
> fmin_cobyla, I haven't knew about it. (btw. I see it's implemented in
> Scipy as well.)
>
> I try to figure out how to make it to obey constraints, with no
> success. Results are not positive, and even worse than
> lsquares_estimate.
>
> As I doing sth wrong ?
> Or sum equations are not fmin_cobyla's purpose, are they ?
>
>
>From what I can see, you're doing everything correctly. I have noticed
that fmin_cobyla is sensitive to the initial guess. With your example,
fmin_cobyla does return positive values for the parameters, except a3,
which is very small and slightly negative.
It's also possible that by giving a too-complicated expression makes cobyla
less efficient. Just from looking at the data matrix, it's clear that the
relationship is linear (difference each y value is a constant).
Perhaps a better example would be a real cubic with some noise added to the
y values.
Ray