npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::LogisticRegressionBase< Numeric > Class Template Referenceabstract

#include <LocalLogisticRegression.hh>

Inheritance diagram for npstat::LogisticRegressionBase< Numeric >:
npstat::LogisticRegressionOnKDTree< Point, Numeric, BooleanFunctor >

Public Member Functions

 LogisticRegressionBase (const QuadraticOrthoPolyND &poly, bool calculateLikelihoodGradient)
 
unsigned dim () const
 
const QuadraticOrthoPolyNDgetPoly () const
 
bool calculatingGradient () const
 
const std::vector< double > & lastCoeffs () const
 
void getGradient (double *buffer, unsigned bufLen) const
 
double getPassCount () const
 
double getFailCount () const
 
void setRegressionBox (const BoxND< Numeric > &box)
 
void setLinearMapping (const double *location, const double *scale, unsigned locationAndScaleArraySize)
 
double calculateLogLikelihood (const double *coeffs, unsigned nCoeffs)
 

Protected Member Functions

void resetAccumulators ()
 

Protected Attributes

const QuadraticOrthoPolyNDpoly_
 
BoxND< Numeric > regressionBox_
 
std::vector< double > location_
 
std::vector< double > scale_
 
std::vector< double > coords_
 
std::vector< double > coeffs_
 
std::vector< double > gradBuffer_
 
std::vector< long double > gradient_
 
long double logli_
 
long double passCount_
 
long double failCount_
 
const double minlog_
 
const double maxlog_
 
const unsigned mydim_
 
const bool calcGradient_
 

Detailed Description

template<class Numeric>
class npstat::LogisticRegressionBase< Numeric >

Base class for logistic regression

Member Function Documentation

◆ calculateLogLikelihood()

template<class Numeric >
double npstat::LogisticRegressionBase< Numeric >::calculateLogLikelihood ( const double *  coeffs,
unsigned  nCoeffs 
)

The next method calculates the negative log-likelihood of the local logistic regression fit for the current mapping. In case the corresponding flag was set "true" in the constructor, the gradient of this quantity will be calculated as well. The gradient can be subsequently retrieved with the "getGradient" method.

◆ dim()

template<class Numeric >
unsigned npstat::LogisticRegressionBase< Numeric >::dim ( ) const
inline

Inspect object properties

◆ lastCoeffs()

template<class Numeric >
const std::vector<double>& npstat::LogisticRegressionBase< Numeric >::lastCoeffs ( ) const
inline

Inspect results of the most recent fit

◆ setLinearMapping()

template<class Numeric >
void npstat::LogisticRegressionBase< Numeric >::setLinearMapping ( const double *  location,
const double *  scale,
unsigned  locationAndScaleArraySize 
)

The next method sets up a mapping from the fitted region into the region which was used to create the orthogonal polynomials. The mapping is linear in every coordinate separately: ortho[i] = fitted[i]*scale[i] + location[i]. Note that the "setRegressionBox" method automatically sets up the default mapping which will be adequate for most applications.

◆ setRegressionBox()

template<class Numeric >
void npstat::LogisticRegressionBase< Numeric >::setRegressionBox ( const BoxND< Numeric > &  box)

Only the data inside the regression box will be used in the fit (and some points may be subsequently weighted down to zero by the weight function).

Note that the "setRegressionBox" method automatically sets up the standard mapping: the edges of the regression box are mapped into the boundaries which were used to create the orthogonal polynomials. If the standard mapping is not what you want (for example, this might be the case near the boundaries of the fitted region), you must call "setLinearMapping" after calling "setRegressionBox" in order to override the standard mapping.

This method must be called at least once after the object is constructed and before any call to "calculateLogLikelihood".


The documentation for this class was generated from the following file: