Re: Fitting/minimizing Python functions.

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Tue, 28 Feb 2012 22:06:51 +0100


Hi Brett,

> Any opinions on the "best" route to take for a Python-side fitter?
> Pointers to docs/examples are also appreciated.

Yes: write your minimization function in compiled C++ (I intentionally misread your question).

Especially if you might have to move it to C++ in the future then this will save you a lot of (probably already) wasted time. And trust me, it's *much* more likely that you will actually benefit from the extra performance of compiled code if you start with compiled (or at least compilable) code. Otherwise you'll always weigh the amount of effort you have invested into your fragile python + fitting + root setup plus the effort it takes to rewrite and verify it in compiled C++ and the possible but unknown until implemented performance improvement.

Cheers, Axel.

On 2/28/12 7:00 PM, Brett Viren wrote:
> Hi,
>
> I'm looking for a good way to develop a fitter (chi-squared
> minimization) in Python (ie, a Python-defined model) with the
> option to later port everything to C++ after the kinks are worked
> out and only if necessary for runtime speed.
>
> I'm a little confused about the available options. What I've
> found:
>
> * ROOT has a Python interface to its TMinuit F77->C++
> transliteration. This appears to be best supported in ROOT, has
> been made to accept Python functions but keeps and exposes a very
> F77 interface.
>
> * ROOT has a copy of the C++ rewrite, Minuit2. In principle this
> would give a more "pythonic" interface but currently requires
> subclassing from C++ so is apparently a non-starter for Python
> functions (?) There has been some discussion in the forum about
> this but I don't find a conclusion.
>
> * There are two related projects on google code[1] which provide
> Python interfaces to the stand-alone Minuit2 and ROOT's slightly
> modified version. This looks good but it means yet another package
> for our code base (not a deal breaker) and I'm unclear as to future
> plans.
>
> * There is ROOT.Fit.Fitter() but it won't accept a Python function
> (?)
>
> * I find RooFit available Python-side but its largeness has kept
> me away so far.
>
> Any opinions on the "best" route to take for a Python-side fitter?
> Pointers to docs/examples are also appreciated.
>
> Thanks, -Brett.
>
>
> [1] http://code.google.com/p/pyminuit/ and
> http://code.google.com/p/pyminuit2/
Received on Tue Feb 28 2012 - 22:06:54 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 28 2012 - 23:50:01 CET