Open ClaudMor opened 3 years ago
Hi @claudio20497 ,
Thanks for posting and suggestions. I will add as soon I can, but in the mean time:
BallTreeDensity
should not be too long, mostly check list of export functions that take ::BallTreeDensity
: https://github.com/JuliaRobotics/KernelDensityEstimate.jl/blob/master/src/KernelDensityEstimate.jlresample
takes any kde of M samples and then builds a new kde consisting of N sample number requested by user,
# build a random kde object
X = kde!(randn(2,100))
densities = X(5*rand(2,10))
Hello @dehann ,
Thank you very much for the detailed answer.
So concerning point 3, if I understood correctly, if I sample from - say - a bivariate distribution of two correlated variables, and then call kde!
on that sample, the resulting BallTreeDensity
won't exhibit the correlation again, right?
EDIT: I did some experimenting:
using Distributions, KernelDensityEstimate, Plots
# generate correlated data
x = rand(Uniform(-10, 10), 1000)
y = x .^ 2
data = Array(hcat(x,y)')
# fit a kde on them
p_corr = kde!(data )
# sample from the kde
sample_p_corr = rand(p_corr, 100)
# plot the data together with the sample
sorted_sample_p_corr = sample_p_corr[sortperm(sample_p_corr[:, 1]), :]
sorted_data = data[sortperm(data[:,1]), :]
plot(sorted_data[:,1],sorted_data[:,2], lw = 3)
plot!(sorted_sample_p_corr[:,1], sorted_sample_p_corr[:,2] , lw = 3 )
# and note that they coincide very well
So the answer I think is: Yes, correlations are conserved.
Yes, correlations are conserved.
That's correct, the correlations are conserved. This remains true even though the individual kernel bandwidths that make up the kde use diagonal only values.
Also note KernelDesityEstimatePlotting package exists with useful function plotKDE
and a variety of keyword options.
I just wanted to step in and mention that I discovered this package today, it looks quite nice, but I think lack of documentation is going to make it quite difficult for me to use. Even a link to a review of the algorithms involved would be enormously helpful, coming in cold it's very unclear what most of these methods are doing.
Hello,
I am interested in using your package, but I am not a domain expert in kde estimation or products of them. From the ReadMe it is not clear to me what methods I may call on a BallTreeDensity. For example, I noted that calling
rand
on a BallTreeDensity like this:actually works.
resample
method do?p
from before):Regarding question 4. , I saw this, but I didn't really understand.
Great package!
Thanks in advance