Open seatonullberg opened 2 years ago
Good piece of work. Would you mind if I ask if there is any progress on this? Thanks.
Hi @humphreylee, I'm currently preoccupied with writing my dissertation, but I do intend to get back to this as soon as I am able.
bump! am using seaborn in python to do 2d kde contour plots but its very slow. am hoping that by using rust I can use the webasm stuff to do this fast on the client side instead of generating plots (exteremly slowly) on the server to send to a web client.
Also a bump on this. We have an application, related to gene expression analysis, where we need a 2D density estimator. Currently, there are no crates for this in rust and we are calling out to a Python library which is both slow and much uglier than we'd like (the rest of the code is pure rust). It would be great to have the ability to do the density estimation in rust and this seems like the only crate I can find where this is even on the roadmap.
Currently only univariate distributions are supported. A complete implementation would include seamless support for multivariate distributions. The only type that should be changed is the
KernelDensityEstimator
struct. Currently, the data structure is as follows:The
observations
field will need to be converted to analgebra::DMatrix
to support a multivariate distribution. The type should be hidden behind an alias so that end-users do not need to addnalgebra
as a dependency in their own projects.To prevent needless conversions for users working with univariate data, the data structure could instead add a generic parameter
T
representing the type ofobservations
. For univariate dataT
could be concretely represented asVec<Float>
and for multivariate dataT
could be concretely represented asMatrix2D
. However, this would require the introduction of two new traitsUnivariateKDE
andMultivariateKDE
to mimic overloading of the method namespdf
,cdf
, andsample
.Lastly, the traits
UnivariateKDE
andMultivariateKDE
should be sealed to prevent end-user implementations.