mirror of
https://github.com/paulnorrie/smoothing
synced 2026-01-15 04:51:37 +00:00
No description
| smoothing | ||
| tests | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| smoothing.nimble | ||
smoothing
Smoothing functions for Regression and Density Estimation
This is a Nim port of the R sm library to use with Arraymancer. If you wish to estimate a kernel bandwidth for non-normal distributions when using the kde function in Arraymancer, there are some options:
- Use Silvermans rule of thumb, which Arraymancer handles
or use this library for:
- Sheather and Jones method
- Normal optimal choice
- Cross-validation (not yet done)
Example
import arraymancer
import smoothing/sj
let x = randomTensor(1, 100, 255)
# x isn't likely to be normal, so use the kernel bandwidth given by the
# Sheather Jones method instead of Silvermans rule of thumb (the default)
let sjbw = hsj(x)
# smooth our tensor
x.kde("gauss", adjust = 1.0, samples = 255, bw = sjbw, normalize = false)