[SciPy-dev] Module Submission: Orthogonal Distance Regression

Pearu Peterson pearu at cens.ioc.ee
Tue Nov 19 11:25:45 EST 2002


On Mon, 18 Nov 2002, Robert Kern wrote:

> Some time ago, I wrote an extension module to use ODRPACK, a FORTRAN
> library that performs Orthogonal Distance Regression (ODR) as well as
> non-linear Ordinary Least-Squares (OLS) and implicit regression (fitting
> to, say, an ellipse).
> 
> ODRPACK is very flexible. It can handle multi-dimensional input
> and output variables, weighted observations (with correlations between
> dimensions). It solves the ODR problem, i.e. finding "parameter
> estimates that minimize the sum of the squares of the weighted
> orthogonal distances between each observed data point and the curve
> described by a nonlinear equation" [1] as well as the nonlinear OLS
> problem, where uncertainties on the input variables are assumed to be
> negligible. Further, the model equation can be implicit, e.g.
> x0^2+x1^2-r^2 = 0 will fit the data to a circle and estimate the radius.
> ODRPACK will estimate the uncertainties and covariances of the estimated
> parameters. ODRPACK has a flexible reporting system to generate reports
> on all stages of the computation.
> 
> SciPy issues:
> I have wrapped the base extension module in a set of classes to
> facilitate the handling of all the options. These classes model my use
> of the module: fitting experimental data and fiddling on the interactive
> interpreter to get it right. Perhaps this is leads to a cumbersome API,
> or another needs to be exposed in addition.
> 
> I believe I have followed the SciPy style guide except for the classes,
> which are MixedCase.
> 
> I think the docstrings are pretty thorough, but I might need to write a
> tutorial to get people jump-started.

Here follows more SciPy issues:
 - odrpack wrapper will probably work fine with g77 compiler but not
   necessarily with  other compilers (this is related to Fortran names in
   C issue). This can be easily solved using F_FUNC macro though.
 - odrpack wraper is handwritten and the code base is quite large. This
   may cause some maintainance issues.
 - Using the wrapper is sensitive to Fortran/C multi-dimensional array
   issue (the different data ordering stuff).

I think that the last one is the most serious one. Probably the
easiest way to solve this is to use f2py generated wrappers. This would
also reduce the maintainance issues.

Otherwise, odrpack looks good and its proper place would probably be the
interpolate module. I think that we should consider odrpack inclusion
to SciPy after releasing SciPy-0.2 as also the interpolate module needs
some revison and odrpack can be added while doing that.

Thanks,
	Pearu




More information about the SciPy-Dev mailing list