#655 fit: alternative minimization packages

open
fit (9)
5
2014-05-23
2014-03-04
No

This patch enables the fit command to use alternative minimization algorithms. The active fitting code can be changed using

set fit backend [internal | cminpack | lmfit | minuit | mpfit | pmfit].

show fit will report the active choice and available backends (depending on the available libraries). Currently 5 alternatives are implemented:

  • cminpack uses F. Devernay's C/C++ implementation of MINPACK (version 1.3.x),
  • lmfit uses J. Wuttke's variant of MINPACK (version 3.x only!),
  • mpfit uses C. Markwardt's MINPACK code (version 1.2),
  • minuit uses the CERN Minuit2 package,
  • pmfit uses Petr Mikulik's marqfitp.

The marqfitp code is included in the patch in a slightly modified form. All other backends require the respective library to be installed. The Minuit code in this patch is not derived from patch 202 in any way.

The patch is meant as a proof-of-principle and support of some of the backends is incomplete. The idea is to compare the performance of gnuplot's fitting code with other (well-known) minimization packages. Some of the backends might eventually be included in gnuplot. The licenses of all of the libraries used seem to be compatible with gnuplot's.

1 Attachments

Related

Patches: #202

Discussion

  • Ethan Merritt
    Ethan Merritt
    2014-05-06

    Would it be possible to make these available via a plugin mechanism rather than as configuration options? That would allow people to use a standard gnuplot package for Windows/linux/OSX and only have to struggle with getting the appropriate external library built.

     
  • Certainly, but this would require to expose a lot of gnuplot internals including function evaluation, user variables, error handling etc. Building cminpack or minuit e.g. on Windows with MSYS/MinGW is rather trouble free. So I am doubtful about the benefits.

    Of the three MINPACK variants I will only choose cminpack because it is most widely available and has a full fledged (albeit Fortran'ish) interface. It outperforms gnuplot's internal fitting code in many cases. Also, this backend is now mature enough to go into CVS now (update pending). Later, I would like to add minuit, too.

    I am not too happy with the set fit backend internal/minuit/cminpack command, though. Any better idea?