Update to non-adaptive bandwidth in TMVA::PDF class?

I have been looking at TMVA’s implementation of KDE with Gaussian kernel, and noticed that the non-adaptive bandwidth is defined as the bandwidth which minimizes the AMISE for an underlying Gaussian distribution.

The general expression for the non-adaptive, AMISE-minimizing bandwidth is given in this section of the Wikipedia article on KDE. When assuming a Gaussian kernel, this expression has as values

R(K) = 1 / (2 * sqrt(pi)),
m_2(K) = 1.

Only when the underlying distribution “f” is assumed to be Gaussian do we then have

R(f’’) = 3 / (8 * sqrt(pi) * RMS_x)

and then recover the non-adaptive bandwidth implemented in TMVA. This is according to here in the Wikipedia article and comparing it to equation (26) on page 58 of the TMVA User’s Guide.

Since TMVA’s implementation uses a finely binned histogram as a reference for the distribution “f”, why not use discrete Fourier transformation on the bins of this histogram to estimate R(f’’)?

After finding the discrete Fourier transform “F = F(k)” of this histogrammed “f = f(x)”, the calculation of R(f’’) can be expedited using Parseval’s theorem:

R(f’’) = R(k^2 * abs(F)).

Other than implementing that calculation of R(f’’) using FFT, it looks like really only lines 125-126 of KDEKernel.cxx have to be updated, replacing the use of the the Gaussian-assumed R(f’’) with this value.

I guess @moneta and @kialbert can help.

1 Like