Giter Site home page Giter Site logo

Comments (2)

simonbyrne avatar simonbyrne commented on June 3, 2024

I would like to have a range and guarantee that the function is 0 (dies down) at the boundaires. How can I setup KernelDensity properly to achieve this result?

Short answer: you can't. The problem is that the convolution in KDEs is based on a Fourier transform, which essentially assumes that your domain is periodic: this means you need to pad the extent of each range so that this "wrap-around" effect is small.

What you could do is construct the kde, trim off what you don't want, and put it back together, e.g.:

X = rand(10)
r = linrange(-1.0,2.0,1024)
# construct "padded" kde
k = kde(X,r)

# lower and upper indices
i,j = searchsortedfirst(r,0), searchsortedlast(r,1)
# construct trimmed kde object
k2 = UnivariateKDE(k.x[i:j],k.density[i:j])

from kerneldensity.jl.

skrisna avatar skrisna commented on June 3, 2024

That is great. Thanks for the exposition and the padding suggestion.

from kerneldensity.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.