No description
Find a file
2022-05-12 17:19:26 +12:00
smoothing Restructured src/ -> smoothing/ 2022-05-12 17:19:26 +12:00
tests Restructured src/ -> smoothing/ 2022-05-12 17:19:26 +12:00
.gitignore Restructured src/ -> smoothing/ 2022-05-12 17:19:26 +12:00
LICENSE Initial commit 2022-05-12 14:02:52 +12:00
README.md Added example 2022-05-12 17:03:38 +12:00
smoothing.nimble Restructured src/ -> smoothing/ 2022-05-12 17:19:26 +12:00

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)