Skip to main content

LOESS Project

PyPI fastloess (Python) 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, JavaScript, C++, and WebAssembly.

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


Installation

[!NOTE]

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

Documentation

[!NOTE]

📚 View the full documentation


LOESS vs. LOWESS

Feature LOESS (This Crate) LOWESS
Polynomial Degree Linear, Quadratic, Cubic, Quartic Linear (Degree 1)
Dimensions Multivariate (n-D support) Univariate (1-D only)
Flexibility High (Distance metrics) Standard
Complexity Higher (Matrix inversion) Lower (Weighted average/slope)

[!TIP] Note: For a LOWESS implementation, use lowess-project.


Why this package?

Speed

The loess project beats the competition in terms of speed, whether in single-threaded or multi-threaded parallel execution. It is typically 5–20x faster than R's loess in serial mode, and up to 200x faster on large datasets with parallel execution.

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

Robustness

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.

Features

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

Feature This package R (stats)
Polynomial Degree 5 (0–4) 2 (1 or 2)
Kernel 7 options only Tricube
Robustness Weighting 3 options only Bisquare
Scale Estimation 3 options only MAR
Distance Metric 6 options normalized only
Boundary Padding 4 options no padding
Zero Weight Fallback 3 options no
Auto Convergence yes no
Online Mode yes no
Streaming Mode yes no
Confidence Intervals yes no
Prediction Intervals yes no
Diagnostics (RMSE, R², AIC) yes no
Cross-Validation 2 options no
Parallel Execution yes no
no-std Support yes no

Validation

All implementations are numerical twins of R's loess:

Aspect Status Details
Accuracy ✅ EXACT MATCH Max diff < 1e-12 across all scenarios
Consistency ✅ PERFECT Multiple scenarios pass with strict tolerance
Robustness ✅ VERIFIED Robust smoothing matches R exactly

API Reference

from fastloess import Loess

model = Loess(
    fraction=0.67,
    iterations=3,
    weight_function="tricube",
    robustness_method="bisquare",
    zero_weight_fallback="use_local_mean",
    boundary_policy="extend",
    scaling_method="mad",
    confidence_intervals=None,
    prediction_intervals=None,
    return_diagnostics=False,
    return_residuals=False,
    return_robustness_weights=False,
    cv_fractions=None,
    cv_method="kfold",
    cv_k=5,
    auto_converge=None,
    parallel=True
)
custom_weights = [1.0] * len(x)
result = model.fit(x, y, custom_weights=custom_weights)

# Result structure:
result.x,
result.y,
result.standard_errors,
result.confidence_lower,
result.confidence_upper,
result.prediction_lower,
result.prediction_upper,
result.residuals,
result.robustness_weights,
result.diagnostics,
result.iterations_used,
result.fraction_used,
result.cv_scores

Contributing

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

Changelog

See CHANGELOG.md for a history of changes.

License

Licensed under MIT or Apache-2.0.

Citation

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}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastloess-1.1.0.tar.gz (986.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastloess-1.1.0-cp38-abi3-win_amd64.whl (519.1 kB view details)

Uploaded CPython 3.8+Windows x86-64

fastloess-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (637.3 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

fastloess-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (606.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

fastloess-1.1.0-cp38-abi3-macosx_11_0_arm64.whl (570.6 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

fastloess-1.1.0-cp38-abi3-macosx_10_12_x86_64.whl (595.5 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file fastloess-1.1.0.tar.gz.

File metadata

  • Download URL: fastloess-1.1.0.tar.gz
  • Upload date:
  • Size: 986.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fastloess-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0d1071001533a20e6bfac6ce99fa0d1250449f9b6157362dbc8b0db0e02324b3
MD5 46e55d7e2ed129532ba4afd72736de76
BLAKE2b-256 147553d4f1967f440835bc6005195067e018b536fc4abbd6e0de2f69d09e8c01

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastloess-1.1.0.tar.gz:

Publisher: release-pypi.yml on thisisamirv/loess-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastloess-1.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: fastloess-1.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 519.1 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fastloess-1.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 beb018ff5a62a0576e5645949c95735ab75b639a6bf59c6d34a35fcf2444bbd8
MD5 b3b3af339e6a2376d90d0c91433c9133
BLAKE2b-256 edfb473efa8109fa129a13b139c3404d90d9345ea427a682b9d5527c9137e0cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastloess-1.1.0-cp38-abi3-win_amd64.whl:

Publisher: release-pypi.yml on thisisamirv/loess-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastloess-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastloess-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 66809e8d4d6321c66bb64269d706087bb1cca832ae9a6f715777f3c80a170723
MD5 704c0617458e91cc31d5cfb4e82b7208
BLAKE2b-256 051958f0e8c1050f82c1a80165d44c2e7e41cd562aafe40d899bb25fa8a55bb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastloess-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on thisisamirv/loess-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastloess-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastloess-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a7d5e282fd2d58a80573ad681479c8cce3491c0ae8866189a272753cabcf805e
MD5 7232cfaebd33b342d88f46d56cf4dba9
BLAKE2b-256 2ec0651905e646f7682fae3e844a6b5885af28413de9847429269e8fdb8269c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastloess-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-pypi.yml on thisisamirv/loess-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastloess-1.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastloess-1.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 071870e372d5b706f98d9ca4fa5d6b6e8338b8b40664f42d627d9bd78dd75d6e
MD5 20c3cd69ce78d5d7df47dd927f0a0697
BLAKE2b-256 dd80f0e0914cc634628465445b232fc68d93af474c67e937954f6871bf30bc48

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastloess-1.1.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on thisisamirv/loess-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastloess-1.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fastloess-1.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f157dfab97fdcc45da9353c843468670360a7b0e0f6b8a65fdcffa0b840f51f5
MD5 baf9b5643fda87ec2390710d6ec53e80
BLAKE2b-256 c9d6e6d0c50f3fce72cb26b341fc0041df33db47d57c493d6a50df4445ca04e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastloess-1.1.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release-pypi.yml on thisisamirv/loess-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.0

7 files

This release

1.1.0 This release

6 files

1.0.0

6 files

0.9.0

6 files

0.1.0

36 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page