[mlpack] Implementation of matlab ksdensity function
Angelo DI SENA
angelo.disena at st.com
Tue Feb 13 09:44:03 EST 2018
Hi Ryan
Thanks for your answer.
Hi partially understood your suggestion.
This is due to my poor knowledge of the math behind.
In the mathlab script I'm trying to convert
Vector is 3000 element (1x3000)
With values between -1 and 1
Pts is a 200 vector(200X1)
>From matlab documentation the result should be 200 pair of values (one for each element in pts)
So, what is not clear is how I should consider vector.
For each value in pts which values must be considered from vector?
Hope you can help on that
Angelo
-----Original Message-----
From: Ryan Curtin [mailto:ryan at ratml.org]
Sent: martedì 13 febbraio 2018 15:16
To: Angelo DI SENA <angelo.disena at st.com>
Cc: mlpack at lists.mlpack.org
Subject: Re: [mlpack] Implementation of matlab ksdensity function
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