  Kernel density estimation is a convenient way to estimate the probability
density of a distribution given the sample of data points. However, it has
certain drawbacks: proper description of the density using narrow kernels needs
large data samples, whereas if the kernel width is large, boundaries and narrow
structures tend to be smeared. Here, an approach to correct for such effects,
is proposed that uses an approximate density to describe narrow structures and
boundaries. The approach is shown to be well suited for the description of the
efficiency shape over a multidimensional phase space in a typical particle
physics analysis. An example is given for the five-dimensional phase space of
the $\Lambda_b^0\to D^0p\pi$ decay.
