[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fitting multiple datasets to "partially" the same model (global fit
From: |
Olaf Till |
Subject: |
Re: Fitting multiple datasets to "partially" the same model (global fit with shared parameters) |
Date: |
Tue, 8 Dec 2015 10:31:25 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Dec 07, 2015 at 07:27:33AM -0800, JokerOne wrote:
> Yes, my explanation was not precise.
>
> Indeed, the knowledge I was talking about is about the *values* of the
> parameters.
>
> So, indeed, the model function(s) for the dataset 1 to n should be noted, in
> my example, like:
>
> F_1(x) = (a0_1*ln(x)) * (b1 + b2*x) for dataset 1
> F_2(x) = (a0_2*ln(x)) * (b1 + b2*x) for dataset 2
> ...
> F_n(x) = (a0_n*ln(x)) * (b1 + b2*x) for dataset n
>
> With "unique" a0_i for all datasets and common parameters b1, b2. Now, the
> fitting procedure could be performed simultaneously, I guess. At least, if
> this should be of some use?
>
> I hope that clarifies my question.
If I understand you right, both the a0_i and the b1, b2 are to be
determined by fitting, but the a0_i affect only the fit within a
specific dataset each.
The advantage an algorithm can take from this situation is within the
procedure to calculate the Jacobian by finite differencing. There,
each parameter separately is changed a bit and the user function is
called each time. In your situation it's known that a change in a0_i
only affects the calculated values for dataset i, so the values for
the other datasets need not be recalculated, which can give a decisive
shortening of overall optimization time.
There is currently no general optimization algorithm in Octave which
does this automatically, by mapping parameters to datasets. (Maybe in
your special case you can use the upcoming routine Oliver told you
about, I don't know.) But if you use nonlin_residmin or
nonlin_curvefit of the optim package, you can implement the desired
behavior in your user function. To enable this, these optimizers call
the user function with an additional informational argument during
calculating the Jacobian by finite differencing. This additional
argument (a structure) contains, among others, the positional index of
the parameter which is currently changed a bit for calculating the
Jacobian. Using this index, your user function can determine if the
currently changed parameter belongs to a specific dataset and omit the
calculations for all other datasets (i.e. return e.g. a vector of
zeros for them).
Instead of using the index, you could probably also use named
parameters and use the parameter name instead.
The details for the above should be available in the documentation of
nonlin_residmin (you have to call 'optim_doc' to get this part of the
documentation).
There has been a similar question in the past, but as yet I havn't
found the thread.
Olaf
--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
signature.asc
Description: Digital signature