Native ruby Levenberg–Marquardt (or other curve fitting)

Sooner or later, my Rails app will need a good curve fitting algorithm
– I’ve used Levenberg–Marquardt in the past and know it works well for
my needs. There’s even a nice set of Ruby bindings to the Gnu
Scientific Library (GSL) package, which has an implementation of
Levenberg–Marquardt.

But. My app will be hosted on Heroku, and Heroku doesn’t include GSL in
its stack. Ergo, I need a native implementation of Levenberg–Marquardt
(or other curve fitting algorithm).

Does anyone know of a solid curve fitting algorithm implemented in
native Ruby, preferably available as a gem?

TIA.

  • ff

On 05/05/2011 02:44 PM, Fearless F. wrote:

Does anyone know of a solid curve fitting algorithm implemented in
native Ruby, preferably available as a gem?

Heroku does support gems with extensions, so what about ripping out the
parts of gsl that you need, wrapping them in a little ruby ext (perhaps
a simplified form of the gsl gem itself), and packaging that as a gem?
This is sort of the amalgalite approach.

The work involve might be worth keeping the same library and api that
you are used to.

Joel VanderWerf wrote in post #996918:

Heroku does support gems with extensions, so what about ripping out the
parts of gsl that you need, wrapping them in a little ruby ext (perhaps
a simplified form of the gsl gem itself), and packaging that as a gem?
This is sort of the amalgalite approach.

In all honesty, I used the FIT function in gnuplot (without using
gnuplot for graphics at all) – it might be easier to strip its LMA
out than GSL.

The learning curve for packaging up a ruby ext is probably no steeper
than coding up an LMA package, and it’s certainly a more useful skill to
acquire. :slight_smile:

Thanks for the suggestion.