[SciPy-user] Parameter estimation / Data fitting in scipy

H Jansen h.jansen at fel.tno.nl
Mon Aug 26 02:32:05 CDT 2002


Sorry. Although it's used, it doesn't add much functionality though.

Regards,

Henk Jansen

My VDI Freemail wrote:

> -------------------
>
> Thank you for your prompt reply. Please can you send
> me the missing module
>
> >python hansen.py
>
> Test: System Identification
> Traceback (most recent call last):
>   File "hansen.py", line 96, in ?
>     from test.ode_system import TestOdeSystem
> ImportError: No module named ode_system
>
> Cheers,
>
>            Nils
>
> > I've just done this recently. I't a classical "(dynamic) system
> > identification problem" consiting
> > of a nonlinear least-squares problem with an ode that needs to be
> > integrated repeatedly in the iteration loop.
> > Optimally, you would be able to put bounds on the parameters guiding the
> > solution of the nonlinear
> > optimization process. Unfortunately, scipy doesn't provide such a
> > routine
> > yet for vector systems
> > (for the future a python interface to e.g. Omuses/HQP  could provede a
> > solution) so that for the moment
> > we're stuck with unbounded optimization --- this may/will work with not
> > too many parameters in vector
> > p and a good conditioned system.
> >
> > An example is attached. Success.
> >
> > Regards,
> >
> > Henk Jansen
> >
> > provide
> >
> > Nils Wagner wrote:
> >
> > > Hi,
> > >
> > > Suppose it is desired to fit a set of data y_i to a known model
> > > [given in form of an IVP (initial value problem)]
> > >
> > > y' = f(y,p,t) , y(0) = y_0(p),       y' = dy/dt
> > >
> > > where p is a vector of parameters for the model that need to be found.
> > > y denotes the state-variables. The initial conditions y(0) may also
> > > depend on
> > > parameters.
> > >
> > > How can I solve this problem using scipy's optimization and ode tools ?
> > >
> > > A small example would be appreciated.
> > >
> > > Thanks in advance
> > >
> > >                       Nils
> > > _______________________________________________
> > > SciPy-user mailing list
> > > SciPy-user at scipy.net
> > > http://www.scipy.net/mailman/listinfo/scipy-user
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
-------------- next part --------------

from scipy.integrate import odeint


class OdeSystem:

    def __init__(_):
        pass

    def f(_):
        pass

    def y(_):
        pass


from math import *

class TestOdeSystem (OdeSystem):

    def __init__(_):
        _._x     = 0.
        _._u     = 0.
        _._theta = 0.
        #
        OdeSystem.__init__(_)

    def f(_):
        """dxdt = f(x,u; theta)"""
        return _._theta*sin(_._x)+u
        
    def y(_):
        """y=x"""
        return _.__x


if __name__=="__main__":

    print "Test: OdeSystem"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: h.jansen.vcf
Type: text/x-vcard
Size: 471 bytes
Desc: Card for H Jansen
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20020826/b2d4528d/attachment.vcf 


More information about the SciPy-user mailing list