API Documentation

Installation

pip install numpy
# Then copy epa_smoothing.py to your project

Core Functions

epanechnikov_kernel(u)

Compute Epanechnikov kernel weights.

ParameterTypeDescription
unp.ndarrayScaled distances (x - x0) / bandwidth

Returns: np.ndarray - Kernel weights (0 for |u| > 1)

weighted_median(values, weights)

Compute weighted median of values.

ParameterTypeDescription
valuesnp.ndarrayData values
weightsnp.ndarrayNon-negative weights

Returns: float - Weighted median value

silverman_bandwidth(x)

Automatic bandwidth selection using Silverman's rule.

ParameterTypeDescription
xnp.ndarrayInput x-coordinates

Returns: float - Recommended bandwidth

epa_local_median(x, y, bandwidth)

EPA kernel-weighted local median smoother.

ParameterTypeDescription
xnp.ndarrayInput x-coordinates
ynp.ndarrayInput y-values (noisy)
bandwidthfloatKernel bandwidth (controls smoothness)

Returns: np.ndarray - Smoothed y-values

epa_local_mean(x, y, bandwidth)

EPA kernel-weighted local mean smoother (Nadaraya-Watson).

ParameterTypeDescription
xnp.ndarrayInput x-coordinates
ynp.ndarrayInput y-values
bandwidthfloatKernel bandwidth

Returns: np.ndarray - Smoothed y-values