Skip to main content

LOWESS Project

PyPI fastlowess (Python) CI

One LOWESS to Rule Them All
One LOWESS to Rule Them All

The fastest, most robust, and most feature-complete language-agnostic LOWESS (Locally Weighted Scatterplot Smoothing) implementation for Rust, Python, R, Julia, JavaScript, C++, and WebAssembly.

The lowess-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.

GPU Backend

In addition to parallel = true (multi-core CPU), the batch Lowess class in every binding — except WebAssembly — as well as the fastLowess Rust crate itself, can run on the GPU via wgpu (Vulkan/Metal/DX12). It's opt-in and worth enabling for high-throughput processing of large datasets (roughly 10k+ points); for smaller inputs the CPU backend is typically faster. StreamingLowess/OnlineLowess remain CPU-only. See the GPU Backend guide for installation instructions and usage.

Documentation

[!NOTE]

📚 View the full documentation


LOESS vs. LOWESS

Feature LOESS LOWESS (This Crate)
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 LOESS implementation, use loess-project.


Why this package?

Speed

The lowess project beats the competition in terms of speed, whether in single-threaded or multi-threaded parallel execution. It is on average 200-327x faster than Python's statsmodels.lowess and 2-3x faster than R's lowess.

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

Robustness

This implementation is more robust than R's lowess and Python's statsmodels 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, statsmodels and R's lowess 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

statsmodels and R's lowess do 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 statsmodels R (stats)
Kernel 7 options only Tricube only Tricube
Robustness Weighting 3 options only Huber only Huber
Scale Estimation 2 options only MAR only MAR
Boundary Padding 4 options no padding no padding
Zero Weight Fallback 3 options no no
Auto Convergence yes no no
Online Mode yes no no
Streaming Mode yes no no
Confidence Intervals yes no no
Prediction Intervals yes no no
Cross-Validation 2 options no no
Parallel Execution yes no no
GPU Acceleration yes no no
no-std Support yes no no

Validation

All implementations are numerical twins of R's lowess:

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 fastlowess import Lowess

model = Lowess(
    fraction=0.5,
    iterations=3,
    delta=0.01,
    weight_function="tricube",
    robustness_method="bisquare",
    scaling_method="mad",
    zero_weight_fallback="use_local_mean",
    boundary_policy="extend",
    confidence_intervals=0.95,
    prediction_intervals=0.95,
    return_diagnostics=True,
    return_residuals=True,
    return_robustness_weights=True,
    return_se=True,
    cv_fractions=[0.3, 0.5, 0.7],
    cv_method="kfold",
    cv_k=5,
    cv_seed=123,
    auto_converge=1e-4,
    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{lowess_project,
  author = {Valizadeh, Amir},
  title = {LOWESS Project: High-Performance Locally Weighted Scatterplot Smoothing},
  year = {2026},
  url = {https://github.com/thisisamirv/lowess-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

fastlowess-3.1.0.tar.gz (641.9 kB view details)

Uploaded Source

Built Distributions

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

fastlowess-3.1.0-cp38-abi3-win_amd64.whl (352.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

fastlowess-3.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (474.4 kB view details)

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

fastlowess-3.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (458.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

fastlowess-3.1.0-cp38-abi3-macosx_11_0_arm64.whl (427.3 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

fastlowess-3.1.0-cp38-abi3-macosx_10_12_x86_64.whl (442.2 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file fastlowess-3.1.0.tar.gz.

File metadata

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

File hashes

Hashes for fastlowess-3.1.0.tar.gz
Algorithm Hash digest
SHA256 3c1b18fe7004b22da6c39abeb83d91b8556607d158dd6e994835001f4aa6f675
MD5 48ab3aea60adec0a6953827e04bc4ef9
BLAKE2b-256 29427553d0c59f1067f5614890e1a68d8d4d518917f5518105bde6564b543865

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastlowess-3.1.0.tar.gz:

Publisher: release-pypi.yml on thisisamirv/lowess-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 fastlowess-3.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: fastlowess-3.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 352.6 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 fastlowess-3.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1fe1307dfd7c75dccec6429e695e43423be92f09b6a837f50cf44f215bf9657f
MD5 e7278170fd4e0964242af0eb2ec80e53
BLAKE2b-256 15feaf67aee0fc599ced7e3763a4749b696aed660898e2eb9bbd361c946e8dcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastlowess-3.1.0-cp38-abi3-win_amd64.whl:

Publisher: release-pypi.yml on thisisamirv/lowess-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 fastlowess-3.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastlowess-3.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c498e4dc2a01fd57952ed2890fba9456c2798e6e88e89aab4dc92fc4d9066a83
MD5 4d2f16e98112defc0000ace387b49221
BLAKE2b-256 bc9fa6f0818f7ee21e193319923b35446212580f5f781e5bbb668d5e8924c092

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastlowess-3.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on thisisamirv/lowess-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 fastlowess-3.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastlowess-3.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 769fa140596c5a116036abf2e147d0c443a44db7983eb58fe2ebc9300d91b35f
MD5 57fd83e4266d71563cb7ac112c9f4d8d
BLAKE2b-256 36d88713c4918bdc7c967a8e07a6bd47b842eba85a72a656041c55dd35b9575d

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastlowess-3.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-pypi.yml on thisisamirv/lowess-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 fastlowess-3.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastlowess-3.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 faa033067f2aebe3b35c26ce75378680fb64b8bff1c2d8270d915f0783da8ce1
MD5 3d73545cbd9eea6e5b4042dc5337d8b2
BLAKE2b-256 b55dd500506b6d10ce8f01fbb8865f3bb6332102319945a3b9e41c8122c3a2d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastlowess-3.1.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on thisisamirv/lowess-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 fastlowess-3.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fastlowess-3.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5349f3d44be7ecd364cc90da7448a648c03399047e9f5fecd08d257160a0a826
MD5 9c786cedf6d4dd1ada8ac80ce69eda03
BLAKE2b-256 e092eb97096f3526b2dd06cf1c867fd8f595fec54a2499236fcac8d8090e83d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastlowess-3.1.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release-pypi.yml on thisisamirv/lowess-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

4.0.0

7 files

3.2.1

7 files

3.2.0

6 files

This release

3.1.0 This release

6 files

3.0.0

6 files

2.0.0

6 files

1.3.0

6 files

1.2.0

6 files

1.0.0

6 files

0.99.10

6 files

0.99.9

6 files

0.99.8

6 files

0.99.7

6 files

0.99.6

6 files

0.99.5

6 files

0.99.4

35 files

0.4.0

36 files

0.3.1

36 files

0.3.0

36 files

0.2.0

36 files

0.1.1

36 files

0.1.0

27 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