ndarray-stats icon indicating copy to clipboard operation
ndarray-stats copied to clipboard

Add kernel weighting functions

Open thisisamirv opened this issue 1 month ago • 0 comments

Summary

This PR adds a new module kernel_weights providing common statistical kernel functions used in local regression and kernel density estimation.

Details

  • Implements five kernels:
    • tricube
    • epanechnikov
    • gaussian
    • triangular
    • quartic (biweight)
  • Adds corresponding types (Tricube, Gaussian, Epanechnikov, Triangular, Quartic) implementing a new KernelFn trait.
  • Allows fn(f64) -> f64 to be used directly as KernelFn.
  • Includes integration and behavioral tests ensuring normalization and symmetry.
  • Fully documented with Rustdoc examples and #[must_use] attributes.

Motivation

Kernel weighting functions are widely used in nonparametric statistics (LOESS, KDE, SVMs).
Adding them directly to ndarray-stats provides a reusable foundation for local regression and density estimation tools without external dependencies.

Checklist

  • Tests added and passing (cargo test --test kernel_weights)
  • cargo fmt and cargo clippy --all-targets -- -D warnings clean

thisisamirv avatar Oct 28 '25 18:10 thisisamirv