Parent Directory
|
Revision Log
import changes from math development branches for subdirectory math. List of changes in detail:
mathcore:
---------
MinimizerOptions:
new class for storing Minimizer option, with static default values that can be
changed by the user
FitConfig:
- use default values from MinimizerOption class
- rename method to create parameter settings from a function
FitUtil.cxx:
improve the derivative calculations used in the effective chi2 and in Fumili and
fix a bug for evaluation of likelihood or chi2 terms.
In EvaluatePdf() work and return the log of the pdf.
FitResult:
- improve the class by adding extra information like, num. of free parameters,
minimizer status, global correlation coefficients, information about fixed
and bound parameters.
- add method for getting fit confidence intervals
- improve print method
DataRange:
add method SetRange to distinguish from AddRange. SetRange deletes the existing
ranges.
ParamsSettings: make few methods const
FCN functions (Chi2FCN, LogLikelihoodFCN, etc..)
move some common methods and data members in base class (FitMethodFunction)
RootFinder: add template Solve() for any callable function.
mathmore:
--------
minimizer classes: fill status information
GSLNLSMinimizer: return error and covariance matrix
minuit2:
-------
Minuit2Minimizer: fill status information
DavidonErrorUpdator: check that delgam or gvg are not zero ( can happen when dg = 0)
FumiliFCNAdapter: work on the log of pdf
minuit:
-------
TLinearMinimizer: add support for robust fitting
TMinuitMinimizer: fill status information and fix a bug in filling the correlation matrix.
fumili:
------
add TFumiliMinimizer:
wrapper class for TFumili using Minimizer interface
// @(#)root/mathcore:$Id$
// Author: L. Moneta Fri Aug 17 14:29:24 2007
/**********************************************************************
* *
* Copyright (c) 2007 LCG ROOT Math Team, CERN/PH-SFT *
* *
* *
**********************************************************************/
// Header file for class PoissonLikelihoodFCN
#ifndef ROOT_Fit_PoissonLikelihoodFCN
#define ROOT_Fit_PoissonLikelihoodFCN
#ifndef ROOT_Math_FitMethodunction
#include "Math/FitMethodFunction.h"
#endif
#ifndef ROOT_Math_IParamFunction
#include "Math/IParamFunction.h"
#endif
#ifndef ROOT_Fit_BinData
#include "Fit/BinData.h"
#endif
#ifndef ROOT_Fit_FitUtil
#include "Fit/FitUtil.h"
#endif
//#define PARALLEL
// #ifdef PARALLEL
// #ifndef ROOT_Fit_FitUtilParallel
// #include "Fit/FitUtilParallel.h"
// #endif
// #endif
namespace ROOT {
namespace Fit {
//___________________________________________________________________________________
/**
class evaluating the log likelihood
for binned Poisson likelihood fits
it is template to distinguish gradient and non-gradient case
@ingroup FitMethodFunc
*/
template<class FunType>
class PoissonLikelihoodFCN : public ::ROOT::Math::BasicFitMethodFunction<FunType> {
public:
typedef ::ROOT::Math::BasicFitMethodFunction<FunType> BaseObjFunction;
typedef typename BaseObjFunction::BaseFunction BaseFunction;
typedef ::ROOT::Math::IParamMultiFunction IModelFunction;
/**
Constructor from unbin data set and model function (pdf)
*/
PoissonLikelihoodFCN (const BinData & data, IModelFunction & func) :
BaseObjFunction(func.NPar(), data.Size() ),
fData(data),
fFunc(func),
fNEffPoints(0),
fGrad ( std::vector<double> ( func.NPar() ) )
{ }
/**
Destructor (no operations)
*/
~PoissonLikelihoodFCN () {}
private:
// usually copying is non trivial, so we make this unaccessible
/**
Copy constructor
*/
PoissonLikelihoodFCN(const PoissonLikelihoodFCN &) {}
/**
Assignment operator
*/
PoissonLikelihoodFCN & operator = (const PoissonLikelihoodFCN & rhs) { return *this; }
public:
/// clone the function (need to return Base for Windows)
BaseFunction * Clone() const { return new PoissonLikelihoodFCN(fData,fFunc); }
// effective points used in the fit
unsigned int NFitPoints() const { return fNEffPoints; }
/// i-th likelihood element and its gradient
double DataElement(const double * x, unsigned int i, double * g) const {
return FitUtil::EvaluatePoissonBinPdf(fFunc, fData, x, i, g);
}
/// evaluate gradient
virtual void Gradient(const double *x, double *g) const {
// evaluate the chi2 gradient
FitUtil::EvaluatePoissonLogLGradient(fFunc, fData, x, g );
}
/// get type of fit method function
virtual typename BaseObjFunction::Type GetType() const { return BaseObjFunction::kLogLikelihood; }
/// access to const reference to the data
virtual const BinData & Data() const { return fData; }
/// access to const reference to the model function
virtual const IModelFunction & ModelFunction() const { return fFunc; }
protected:
private:
/**
Evaluation of the function (required by interface)
*/
double DoEval (const double * x) const {
this->UpdateNCalls();
return FitUtil::EvaluatePoissonLogL(fFunc, fData, x, fNEffPoints);
}
// for derivatives
virtual double DoDerivative(const double * x, unsigned int icoord ) const {
Gradient(x, &fGrad[0]);
return fGrad[icoord];
}
//data member
const BinData & fData;
mutable IModelFunction & fFunc;
unsigned int fNDim;
unsigned int fNPoints; // size of the data
mutable unsigned int fNEffPoints; // number of effective points used in the fit
mutable unsigned int fNCalls;
mutable std::vector<double> fGrad; // for derivatives
};
} // end namespace Fit
} // end namespace ROOT
#endif /* ROOT_Fit_PoissonLikelihoodFCN */
| Subversion Admin | ViewVC Help |
| Powered by ViewVC 1.0.9 |