Skip to content

Fun with IMultiGradFunctions #5

Closed

Description

@vincecr0ft

in branch gradient_testing two files + headers have been added. The RooGaussMinimizer and RooGaussMinimizerFcn.

The Minimiser itself is a clone of the RooMinimizer but with much of the functionality stripped away. Once the RooGaussMinimizer works with a gradient function this functionality can be moved back into the RooMinimizer.

The minimiser function is also a clone of RooMinimizerFcn but whereas RooMinimizerFcn is a IBaseFunctionMultiDim object the RooGaussMinimizerFcn should be a IMultiGradFunction which inherits from the BaseFunction.

Minuit2 can read either the base function or the gradient function.

We tried to make the RooGaussMinimizerFcn a IMultiGradFunction but we get the following error

      'ROOT::Math::IBaseFunctionMultiDimTempl<double>'
  ...fitterFcn() const {  return ( fitter()->GetFCN() ? ((RooGaussMinimizerFcn*) fitter()->GetFCN()) : _fcn ) ; }
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/include/RooGaussMinimizer.h:74:70: error: cannot cast 'ROOT::Math::IBaseFunctionMultiDimTempl<double> *' to 'RooGaussMinimizerFcn *' via virtual base
      'ROOT::Math::IBaseFunctionMultiDimTempl<double>'
  RooGaussMinimizerFcn* fitterFcn() { return ( fitter()->GetFCN() ? ((RooGaussMinimizerFcn*) fitter()->GetFCN()) : _fcn ) ; }
                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub tasks include:

  • how to cast the RooGaussMinimizerFcn as a IMultiGradFunction
  • actually implement the gradient calculation into RooGaussMinimizerFcn - DoDerivative()?
  • Does the RooGaussMinimizerFcn still need a DoEval() method?

Activity

  1. egpbos commented on Aug 30, 2017

    @egpbos
    Member

    Fixed it, but now a new error appears:

    /Users/pbos/projects/apcocsm/root-roofit_gradient_testing-worktree/roofit/roofitcore/src/RooGaussMinimizer.cxx:126:14: error: allocating an object of abstract class type
          'RooGaussMinimizerFcn'
      _fcn = new RooGaussMinimizerFcn(_func,this,_verbose);
                 ^
    /Users/pbos/projects/apcocsm/root-roofit_gradient_testing-worktree/cmake-manual-build-debug/include/Math/IFunction.h:238:27: note: unimplemented pure virtual method 'DoDerivative' in
          'RooGaussMinimizerFcn'
             virtual  double  DoDerivative(const double *x, unsigned int icoord) const = 0;
                              ^
    /Users/pbos/projects/apcocsm/root-roofit_gradient_testing-worktree/roofit/roofitcore/src/RooGaussMinimizerFcn.cxx:129:14: error: allocating an object of abstract class type
          'RooGaussMinimizerFcn'
      return new RooGaussMinimizerFcn(*this) ;
                 ^
    /Users/pbos/projects/apcocsm/root-roofit_gradient_testing-worktree/cmake-manual-build-debug/include/Math/IFunction.h:238:27: note: unimplemented pure virtual method 'DoDerivative' in
          'RooGaussMinimizerFcn'
             virtual  double  DoDerivative(const double *x, unsigned int icoord) const = 0;
  2. egpbos commented on Aug 30, 2017

    @egpbos
    Member

    Fixed as well using a makeshift DoDerivative implementation. Will push asap...

  3. added a commit that references this issue on Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions