ndarray-stats
ndarray-stats copied to clipboard
Add kernel weighting functions
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:
tricubeepanechnikovgaussiantriangularquartic(biweight)
- Adds corresponding types (
Tricube,Gaussian,Epanechnikov,Triangular,Quartic) implementing a newKernelFntrait. - Allows
fn(f64) -> f64to be used directly asKernelFn. - 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 fmtandcargo clippy --all-targets -- -D warningsclean