Initializing playground…
← Back to roadmap

Kernel Density Estimation (KDE)

Gaussian KDE with Scott's rule, Silverman's rule, and fixed bandwidth — mirrors scipy.stats.gaussian_kde with pdf, evaluate, integrate, cdf, and resample.

1 — Basic KDE

Create a KDE from data and evaluate it on a grid. The factor property exposes the bandwidth.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

2 — Bandwidth methods and sampling

Choose between "scott" (default), "silverman", or a fixed numeric bandwidth. Use resample to draw new samples.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

3 — Probability mass and CDF

integrate(a, b) gives probability mass in an interval. cdf(x) gives the cumulative distribution up to x.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent