Skip to content

fastloess-wasm

High-performance LOESS smoothing for WebAssembly

WASM CI

One LOESS to Rule Them All
One LOESS to Rule Them All

The fastest, most robust, and most feature-complete language-agnostic LOESS (Locally Estimated Scatterplot Smoothing) implementation for Rust, Python, R, Julia, Node.js, C++, Go, Java, and WebAssembly.

The loess-project also offers bindings for Rust, Python, R, Julia, Node.js, WebAssembly, C++, Go, and Java — see the full repository.


Currently available for R, Python, Rust, Julia, Node.js, WebAssembly, and C++. See the Installation Guide for detailed installation instructions.


FeatureLOESS (This Crate)LOWESS
Polynomial DegreeLinear, Quadratic, Cubic, QuarticLinear (Degree 1)
DimensionsMultivariate (n-D support)Univariate (1-D only)
FlexibilityHigh (Distance metrics)Standard
ComplexityHigher (Matrix inversion)Lower (Weighted average/slope)

Read more about how LOESS works in the Concepts.

Note: For a LOWESS implementation, use lowess-project.


fastLoess beats the competition by being 47.3× faster than R’s stats::loess in serial mode and 236.4× faster in parallel compared to R’s stats::loess; speedups vary by workload, and parallel execution is not always faster. For datasets of 1,000 points or fewer, serial execution is advised.

For more details on the performance comparison, see the Benchmarks page.

This implementation is more robust than R’s loess due to two key design choices:

MAD-Based Scale Estimation:

For robustness weight calculations, this crate uses Median Absolute Deviation (MAD) for scale estimation:

s = median(|r_i - median(r)|)

In contrast, R’s loess uses the median of absolute residuals (MAR):

s = median(|r_i|)
  • MAD is a breakdown-point-optimal estimator—it remains valid even when up to 50% of data are outliers.
  • The median-centering step removes asymmetric bias from residual distributions.
  • MAD provides consistent outlier detection regardless of whether residuals are centered around zero.

Boundary Padding:

This crate applies a range of different boundary policies at dataset edges:

  • Extend: Repeats edge values to maintain local neighborhood size.
  • Reflect: Mirrors data symmetrically around boundaries.
  • Zero: Pads with zeros (useful for signal processing).
  • NoBoundary: Original Cleveland behavior

R’s loess does not apply boundary padding, which can lead to:

  • Biased estimates near boundaries due to asymmetric local neighborhoods.
  • Increased variance at the edges of the smoothed curve.

A variety of features, supporting a range of use cases:

FeatureThis packageR (stats)
Polynomial Degree5 (0–4)2 (1 or 2)
Kernel7 optionsonly Tricube
Robustness Weighting3 optionsonly Bisquare
Scale Estimation3 optionsonly MAR
Distance Metric6 optionsnormalized only
Boundary Padding4 optionsno padding
Zero Weight Fallback3 optionsno
Auto Convergenceyesno
Online Modeyesno
Streaming Modeyesno
Confidence Intervalsyesno
Prediction Intervalsyesno
Diagnostics (RMSE, R2, AIC)yesno
Cross-Validation2 optionsno
Parallel Executionyesno
no-std Supportyesno

All implementations are numerical twins of R’s loess:

AspectStatusDetails
Accuracy✅ EXACT MATCHMax diff < 1e-12 across all scenarios
Consistency✅ PERFECTMultiple scenarios pass with strict tolerance
Robustness✅ VERIFIEDRobust smoothing matches R exactly

Contributions are welcome! Please see CONTRIBUTING.md for more information.

Licensed under MIT or Apache-2.0.

If you use this software in your research, please cite it using the CITATION.cff file or the BibTeX entry below:

@software{loess_project,
author = {Valizadeh, Amir},
title = {LOESS Project: High-Performance Locally Estimated Scatterplot Smoothing},
year = {2026},
url = {https://github.com/thisisamirv/loess-project},
license = {MIT OR Apache-2.0}
}