0
$\begingroup$

In sklearn.neighbors.KernelDensity,there is a parameter "algorithm = ball_tree". What is its specific role in KDE? Why does KDE need ball_tree

see sklearn.neighbors.KernelDensity(): https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KernelDensity.html#sklearn.neighbors.KernelDensity

I think that using ball tree to search for neighbors will only make the algorithm slower, that's because we have to find K neighbors first (the time complexity of balltree is k*log(n) ), and then we use k neighbors for KDE . This will obviously slow down the algorithm. So why don't we give up looking for neighbors and use all the data for KDE

$\endgroup$
15
  • $\begingroup$ To find the neighbours faster. $\endgroup$ – usεr11852 Aug 24 '20 at 11:51
  • $\begingroup$ Why does KDE need to find neighbors? Shouldn't KDE use all the data? $\endgroup$ – Gid Aug 24 '20 at 11:53
  • 1
    $\begingroup$ No, especially for finite support kernels (eg. triangular, Epanechnikov) it makes no sense to use all data. $\endgroup$ – usεr11852 Aug 24 '20 at 11:57
  • $\begingroup$ So, does KDE only use the data near the estimation point? How much data will be used? Can this function return the data used? Does using nearby data make KDE get density faster? $\endgroup$ – Gid Aug 24 '20 at 12:01
  • $\begingroup$ Yes, the KDE by definition is giving more weight to data near the estimation and the weight is specific to the kernel choice. $\endgroup$ – usεr11852 Aug 24 '20 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.