92 "KernelType:Gaussian;Iteration:Adaptive;Mirror:noMirror;Binning:RelaxedBinning",
Double_t rho = 1.0) {
98 "KernelType:Gaussian;Iteration:Adaptive;Mirror:noMirror;Binning:RelaxedBinning",
Double_t rho = 1.0) {
103 template<
class KernelFunction>
109 template<
class KernelFunction>
240 Double_t k2_PI_ROOT_INV = 0.398942280401432703;
241 return (
x > -9. &&
x < 9.) ? k2_PI_ROOT_INV * std::exp(-.5 *
x *
x) : 0.0;
245 return (
x > -1. &&
x < 1.) ? 3. / 4. * (1. -
x *
x) : 0.0;
250 return (
x > -1. &&
x < 1.) ? 15. / 16. * (1. -
x *
x) * (1. -
x *
x) : 0.0;
#define ClassDefOverride(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Template class to wrap any C++ callable object which takes one argument i.e.
A TGraphErrors is a TGraph with error bars.
std::vector< Double_t > fWeights
Kernel weights (bandwidth)
void ComputeAdaptiveWeights()
Double_t GetFixedWeight() const
Double_t GetWeight(Double_t x) const
Double_t operator()(Double_t x) const
UInt_t fNWeights
Number of kernel weights (bandwidth as vectorized for binning)
const std::vector< Double_t > & GetAdaptiveWeights() const
Kernel Density Estimation class.
TF1 * GetPDFUpperConfidenceInterval(Double_t confidenceLevel=0.95, UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
TF1 * GetKDEApproximateBias(UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
void SetData(const Double_t *data, const Double_t *weights)
TF1 * fLowerPDF
Output Kernel Density Estimation upper confidence interval PDF function.
std::vector< Double_t > fKernelSigmas2
Double_t ComputeKernelL2Norm() const
TF1 * GetPDFLowerConfidenceInterval(Double_t confidenceLevel=0.95, UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
void SetKernelType(EKernelType kern)
std::vector< Double_t > fCanonicalBandwidths
UInt_t fNEvents
Data's number of events.
void ComputeDataStats()
Internal function to compute statistics (mean,stddev) using always all the provided data (i....
Double_t fXMax
Data maximum value.
Double_t UpperConfidenceInterval(const Double_t *x, const Double_t *p) const
Valid if the bandwidth is small compared to nEvents**1/5.
TF1 * GetDrawnUpperFunction()
Double_t ApproximateBias(const Double_t *x, const Double_t *) const
Double_t ComputeMidspread()
Bool_t fNewData
Flag to control when new data are given.
void DrawConfidenceInterval(TString &drawOpt, double cl=0.95)
// Draws the KDE and its confidence interval
TF1 * GetDrawnLowerFunction()
void SetMirroredEvents()
Intgernal function to mirror the data.
void SetUserCanonicalBandwidth()
void CheckKernelValidity()
TKDE(const Char_t *, const KernelFunction &kernfunc, UInt_t events, const Double_t *data, const Double_t *dataWeight, Double_t xMin=0.0, Double_t xMax=0.0, const Option_t *option="KernelType:UserDefined;Iteration:Adaptive;Mirror:noMirror;Binning:RelaxedBinning", Double_t rho=1.0)
Constructor for weighted data and a user defined kernel function.
const Double_t * GetAdaptiveWeights() const
Double_t fAdaptiveBandwidthFactor
Geometric mean of the kernel density estimation from the data for adaptive iteration.
void SetKernelFunction(KernelFunction_Ptr kernfunc=nullptr)
Double_t LowerConfidenceInterval(const Double_t *x, const Double_t *p) const
Valid if the bandwidth is small compared to nEvents**1/5.
Double_t fSigmaRob
Data std deviation (robust estimation)
std::vector< Double_t > fBinCount
Number of events per bin for binned data option.
EIteration
Iteration types. They can be set using SetIteration()
Double_t GetRAMISE() const
void SetIteration(EIteration iter)
Double_t ComputeKernelIntegral() const
Double_t CosineArchKernel(Double_t x) const
Returns the kernel evaluation at x.
Double_t fXMin
Data minimum value.
Double_t operator()(Double_t x) const
void SetUserKernelSigma2()
Double_t GetBias(Double_t x) const
std::vector< Double_t > fData
Data events.
Double_t fSumOfCounts
Data sum of weights.
UInt_t fUseBinsNEvents
If the algorithm is allowed to use automatic (relaxed) binning this is the minimum number of events t...
Double_t fSigma
Data std deviation.
TGraphErrors * GetGraphWithErrors(UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
return a TGraphErrors with the KDE values and errors The return object is managed by the user
Double_t fRho
Adjustment factor for sigma.
ROOT::Math::IBaseFunctionOneDim * KernelFunction_Ptr
Double_t fWeightSize
Caches the weight size.
void SetUseBinsNEvents(UInt_t nEvents)
std::vector< Double_t > fEvents
Original data storage.
Double_t GetError(Double_t x) const
TF1 * GetKDEFunction(UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
void SetBinning(EBinning)
void GetOptions(std::string optionType, std::string option)
Double_t GetValue(Double_t x) const
std::vector< Bool_t > fSettedOptions
User input options flag.
Double_t GaussianKernel(Double_t x) const
Returns the kernel evaluation at x.
void SetRange(Double_t xMin, Double_t xMax)
By default computed from the data.
Double_t ComputeKernelSigma2() const
void SetOptions(const Option_t *option, Double_t rho)
Double_t GetFixedWeight() const
TF1 * GetFunction(UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
TF1 * GetUpperFunction(Double_t confidenceLevel=0.95, UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
void Instantiate(KernelFunction_Ptr kernfunc, UInt_t events, const Double_t *data, const Double_t *weight, Double_t xMin, Double_t xMax, const Option_t *option, Double_t rho)
void SetDrawOptions(const Option_t *option, TString &plotOpt, TString &drawOpt)
EMirror
Data "mirroring" option to address the probability "spill out" boundary effect They can be set using ...
TGraphErrors * GetDrawnGraph()
TGraphErrors * fGraph
Output Kernel Density Estimation approximate bias.
void SetCanonicalBandwidths()
TKDE()
default constructor used only by I/O
void SetBinCentreData(Double_t xmin, Double_t xmax)
TKDE(const Char_t *, const KernelFunction &kernfunc, UInt_t events, const Double_t *data, Double_t xMin=0.0, Double_t xMax=0.0, const Option_t *option="KernelType:UserDefined;Iteration:Adaptive;Mirror:noMirror;Binning:RelaxedBinning", Double_t rho=1.0)
Constructor for unweighted data and a user defined kernel function.
void SetTuneFactor(Double_t rho)
TF1 * fUpperPDF
Output Kernel Density Estimation PDF function.
UInt_t fNBins
Number of bins for binned data option.
Double_t ComputeKernelMu() const
EKernelType
Types of Kernel functions They can be set using the function SetKernelType() or as a string in the co...
@ kTotalKernels
Internal use only for member initialization.
@ kUserDefined
Internal use only for the class's template constructor.
void DrawErrors(TString &drawOpt)
Draws a TGraphErrors with KDE values and errors.
void SetNBins(UInt_t nbins)
void CheckOptions(Bool_t isUserDefinedKernel=kFALSE)
Double_t EpanechnikovKernel(Double_t x) const
Double_t BiweightKernel(Double_t x) const
Returns the kernel evaluation at x.
std::unique_ptr< TKernel > fKernel
! internal kernel class. Transient because it is recreated after reading from a file
Bool_t fUseMinMaxFromData
Flag top control if min and max must be used from data.
Double_t GetSigma() const
EKernelType fKernelType
Graph with the errors.
TF1 * fApproximateBias
Output Kernel Density Estimation lower confidence interval PDF function.
TKDE operator=(TKDE &kde)
void SetSigma(Double_t R)
TKDE(UInt_t events, const Double_t *data, Double_t xMin=0.0, Double_t xMax=0.0, const Option_t *option="KernelType:Gaussian;Iteration:Adaptive;Mirror:noMirror;Binning:RelaxedBinning", Double_t rho=1.0)
Constructor for unweighted data Varius option for TKDE can be passed in the option string as below.
std::vector< Double_t > fEventWeights
Original data weights.
TF1 * GetApproximateBias(UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
TF1 * GetLowerFunction(Double_t confidenceLevel=0.95, UInt_t npx=100, Double_t xMin=1.0, Double_t xMax=0.0)
TKDE(UInt_t events, const Double_t *data, const Double_t *dataWeight, Double_t xMin=0.0, Double_t xMax=0.0, const Option_t *option="KernelType:Gaussian;Iteration:Adaptive;Mirror:noMirror;Binning:RelaxedBinning", Double_t rho=1.0)
Constructor for weighted data.
KernelFunction_Ptr fKernelFunction
! pointer to kernel function
EBinning
Data binning option.
@ kRelaxedBinning
The algorithm is allowed to use binning if the data is large enough.
The TNamed class is the base class for all named ROOT classes.