For some time now, the functionality of scipy.odr (orthogonal distance regression, nonlinear regression models accounting for error in both input and output variables) has been available in a more modern package outside of scipy thanks to Hugo Vale. I’ve used it in anger, and it really is better than what we have in scipy.odr. This external packaging solves a lot of problems for us maintaining scipy.
- The underlying library has been updated to ODRPACK95, which incorporates bound constraints, an occasional request
- The interface is more modern like the other optimizers in
scipy.optimize - The binding to the Fortran code is not ancient, buggy, idiosyncratic hand-wrapping
- We don’t need to maintain the Fortran code, which we are trying to eliminate from
scipy
Some history: What became scipy.odr was one of my first open source contributions, about 25 years ago, in the dark ages before scipy existed, or f2py, for that matter. The FORTRAN code that it wrapped was about 20 years old at the time, as well. It’s not the most ancient FORTRAN code that we have, but it’s close. I made a lot of silly choices in the wrapping that were barely justifiable at the time, and the related parts of scipy made different, better choices as it evolved. scipy.odr was never used that much to make it worth while to keep up with those choices.
We are currently in the middle of an effort to eliminate Fortran libraries from our codebase, mostly through some heroic effort in translating the code to other languages that we can support better. Given the relatively minor importance of scipy.odr and the much better wrapping now available outside of scipy, instead of adding this library to the pile for translation, several of us are proposing to deprecate scipy.odr entirely and point users to Hugo’s package instead. I myself don’t have a firm proposed timeline, but we can probably visibly deprecate the package as a whole on the next feature release and leave the final removal undefined for now. I expect when the rest of the Fortran purge is complete, and scipy.odr is one of the few remaining would be a good time to pull that trigger.
One occasional request/proposal that comes up with scipy.odr is taking the core algorithmic ideas and reimplementing them in pure Python using the components that we have in scipy.optimize and scipy.linalg. The core idea in ODRPACK is relatively simple (the linear least-squares problem at the heart of the iterations of most outer nonlinear algorithms can take advantage of the special structure of the ODR problem), and this idea can mix-and-match with several different components that we have available. Such a reimplementation would open up the opportunities of the more modern optimizers that we have rather than the one ossified in ODRPACK. I do think this idea does have some merit still, but no one so far really seems to have the bandwidth to work on it. If someone were to take a good stab at that, aimed at getting the implementation into scipy.optimize, following modern conventions, I think we’d be accept such a contribution. I don’t think we’d resurrect scipy.odr and its oddball API, though. The FORTRAN implementation is not the only reason it’s on the chopping block.
Let us know what you think.