[mlpack] Implementation of matlab ksdensity function
Ryan Curtin
ryan at ratml.org
Tue Feb 13 09:15:46 EST 2018
On Tue, Feb 13, 2018 at 01:30:42PM +0000, Angelo DI SENA wrote:
> Hi
>
> I'm trying to "translate" a complex matlab script in C++ using armadillo.
> I implemented some functions that are not present in armadillo, but I'm currently blocked with ksdensity
> In particular I need to use ksdensity with the following parameters
>
> [ky kx] = ksdensity(vector,pts,'function','cdf');
>
> for probability density estimate.
>
> Is there any implementation of such function using mlpack/armadillo?
Hi Angelo,
It has been a long-standing open issue to implement fast tree-based
kernel density estimation: https://github.com/mlpack/mlpack/issues/150
But unfortunately there is no implementation available today.
However, if you are just looking for something simple (if vector or pts
is not too big), you can write a loop over all of the points in 'pts' to
calculate the normal distribution value. There may be a little bit of
complexity involved---I don't know if ksdensity() does auto-tuning of
the bandwidth to be used, etc. (I have not used it before).
One class that may help in mlpack is the GaussianDistribution class in
src/mlpack/core/dists/gaussian_distribution.hpp.
I hope this helps; let me know if I can clarify anything.
Thanks!
Ryan
--
Ryan Curtin | "Oh man, I shot Marvin in the face."
ryan at ratml.org | - Vincent
More information about the mlpack
mailing list