Parameters¶
Complete reference for all LOESS configuration options.
Quick Reference¶
Language-specific values
Null value — R: NULL · Python: None · Rust: None · Julia: nothing · Node.js/WASM: null · C++: NAN (floats), 0 (integers), {} (vectors)
Logical false — R uses FALSE, Python uses False, and Rust, Julia, Node.js, WASM, and C++ usefalse.
| Parameter | Default | Range/Options | Description | Adapter |
|---|---|---|---|---|
| fraction | 0.67 | (0, 1] | Smoothing span | All |
| iterations | 3 | [0, 1000] | Robustness iterations | All |
| degree | 1 | 0–4 | Polynomial degree | All |
| surface_mode | "interpolation" |
2 options | Fit vs interpolate | All |
| weight_function | "tricube" |
7 options | Distance kernel | All |
| robustness_method | "bisquare" |
3 options | Outlier weighting | All |
| zero_weight_fallback | "use_local_mean" |
3 options | Zero-weight behavior | All |
| boundary_policy | "extend" |
4 options | Edge handling | All |
| scaling_method | "mad" |
3 options | Scale estimation | All |
| auto_converge | Null value | tolerance | Early stopping | All |
| parallel | true (false for Online) | logical | Multi-threaded execution | All |
| custom_weights | Null value | positive | Per-observation weights | Batch |
| return_residuals | Logical false | logical | Include residuals | All |
| return_robustness_weights | Logical false | logical | Include weights | All |
| return_diagnostics | Logical false | logical | Include metrics | All |
| confidence_intervals | Null value | (0, 1) | CI level | Batch |
| prediction_intervals | Null value | (0, 1) | PI level | Batch |
| distance_metric | "normalized" |
string option | Distance metric | All |
| weighted_metric_weights | Null value | numeric | Per-dimension distance weights | All |
| cell | Null value | (0, ∞) | Interpolation cell size | All |
| interpolation_vertices | Null value | integer | Interpolation grid vertices | All |
| boundary_degree_fallback | Logical false | logical | Degree fallback at boundaries | All |
| cv_method | Null value | method | Auto-select fraction | Batch |
| cv_k | 5 | [2, ∞) | K-fold count | Batch |
| cv_fractions | Null value | numeric | Fractions to evaluate | Batch |
| cv_seed | Null value | integer | CV fold randomization seed | Batch |
| cross_validate | — | method | Auto-select fraction (cv_method + cv_k + cv_fractions + cv_seed) |
Batch |
| chunk_size | 5000 | [10, ∞) | Points per chunk | Streaming |
| overlap | 500 | [0, chunk) | Overlap between chunks | Streaming |
| merge_strategy | "weighted_average" |
4 options | Merge overlaps | Streaming |
| window_capacity | 1000 | [3, ∞) | Max window size | Online |
| min_points | 2 | [2, window] | Min before output | Online |
| update_mode | "incremental" |
2 options | Update strategy | Online |
Rust option values
In Rust, pass option-like parameters as strings (case-insensitive), e.g. "tricube", "bisquare", "extend", "weighted_average".
For the weighted distance metric, use .distance_metric("weighted").weighted_metric_weights(vec![...]).
Parameter Options Summary¶
| Parameter | Available Options |
|---|---|
| weight_function | "tricube", "epanechnikov", "gaussian", "biweight", "cosine", "triangle", "uniform" |
| robustness_method | "bisquare", "huber", "talwar" |
| zero_weight_fallback | "use_local_mean", "return_original", "return_none" |
| boundary_policy | "extend", "reflect", "zero", "noboundary" |
| scaling_method | "mad", "mar", "mean" |
| surface_mode | "interpolation", "direct" |
| distance_metric | "normalized", "euclidean", "manhattan", "chebyshev", "minkowski:p", "weighted" |
| merge_strategy | "average", "weighted_average", "take_first", "take_last" |
| update_mode | "incremental", "full" |
Core Parameters¶
fraction¶
The proportion of data used for each local fit. Most important parameter.
| Value | Effect | Use Case |
|---|---|---|
| 0.1–0.3 | Fine detail | Rapidly changing signals |
| 0.3–0.5 | Balanced | General purpose |
| 0.5–0.7 | Heavy smoothing | Noisy data |
| 0.7–1.0 | Very smooth | Trend extraction |
iterations¶
Number of robustness iterations for outlier resistance.
| Value | Effect | Performance |
|---|---|---|
| 0 | No robustness | Fastest |
| 1–3 | Moderate | Recommended |
| 4–6 | Strong | Contaminated data |
| 7+ | Very strong | Heavy outliers |
degree¶
Polynomial degree for the local regression fits.
| Degree | Fit Type |
|---|---|
0 |
Local constant |
1 |
Local linear (Default) |
2 |
Local quadratic |
3 |
Local cubic |
4 |
Local quartic |
Higher degrees capture curvature but can overfit with small fractions. Degree 1 is appropriate for most use cases.
See Polynomial Degree for a detailed comparison.
surface_mode¶
Controls whether the local polynomial is evaluated at every query point or at a sparser grid of anchor vertices with Hermite cubic interpolation in between.
| Mode | Behavior | Speed | Accuracy |
|---|---|---|---|
"interpolation" (default) |
Evaluate at vertices, interpolate between | Faster | Slight approximation |
"direct" |
Evaluate at every query point | Slower | Full precision |
See Polynomial Degree for a visual comparison.
cell¶
Cell size for the interpolation grid. Controls the density of anchor vertices when surface_mode = "interpolation". Smaller values produce a finer grid, increasing accuracy at the cost of memory and computation.
- Default:
0.2(20% of x-range per dimension) - Range:
(0, ∞)— values close to 0 approach"direct"accuracy - Adapter: All
cell |
Grid density | Accuracy | Speed |
|---|---|---|---|
0.05 |
Very fine | Highest | Slowest |
0.2 |
Moderate (default) | High | Fast |
0.5 |
Coarse | Lower | Faster |
interpolation_vertices¶
Explicitly set the number of anchor vertices for the interpolation grid, overriding the cell-based automatic count. Use when you need a precise vertex budget.
- Default: auto (derived from
celland data range) - Adapter: All
dimensions¶
Number of predictor variables. Enables multivariate LOESS over an n-dimensional input space.
- 1 (default): Standard 1D smoothing over a single predictor
- 2: Spatial or bi-predictor surface smoothing
- 3+: High-dimensional local regression
See Multivariate LOESS for detailed usage and distance metric options.
distance_metric / weighted_metric_weights¶
Distance metric for neighbourhood calculation. Only meaningful when dimensions > 1. The "weighted" metric lets you assign per-dimension importance via weighted_metric_weights.
| Metric | Description |
|---|---|
"normalized" |
Each dimension scaled to unit range (default) |
"euclidean" |
Raw Euclidean distance |
"manhattan" |
City-block distance |
"chebyshev" |
Maximum coordinate difference |
"minkowski:p" |
Generalised \(L_p\) norm — e.g. "minkowski:3" |
"weighted" |
Weighted Euclidean — set weighted_metric_weights to one weight per dimension |
weight_function¶
Distance weighting kernel for local fits.
| Kernel | Efficiency | Smoothness |
|---|---|---|
"tricube" |
0.998 | Very smooth |
"epanechnikov" |
1.000 | Smooth |
"gaussian" |
0.961 | Infinite |
"biweight" |
0.995 | Very smooth |
"cosine" |
0.999 | Smooth |
"triangle" |
0.989 | Moderate |
"uniform" |
0.943 | None |
See Weight Functions for detailed comparison.
robustness_method¶
Method for downweighting outliers during iterative refinement.
| Method | Behavior | Use Case |
|---|---|---|
"bisquare" |
Smooth downweighting | General-purpose |
"huber" |
Linear beyond threshold | Moderate outliers |
"talwar" |
Hard threshold (0 or 1) | Extreme contamination |
See Robustness for detailed comparison.
boundary_policy¶
Edge handling strategy to reduce boundary bias. See Boundary Handling for a detailed comparison.
| Policy | Behavior | Use Case |
|---|---|---|
"extend" |
Pad with first/last values | Most cases (default) |
"reflect" |
Mirror data at boundaries | Periodic/symmetric data |
"zero" |
Pad with zeros | Data approaches zero |
"noboundary" |
No padding | Original Cleveland behavior |
For example:
boundary_degree_fallback¶
When enabled, the polynomial degree is automatically reduced to the highest degree that can be stably estimated for points near the boundary (where the local neighbourhood is one-sided). Prevents numerical failures when degree ≥ 2 at the edges.
- Default:
false - Adapter: All
Tip
Enable this if you observe NaN values or instability at the edges of your data when using degree = "quadratic" or higher.
scaling_method¶
Method for estimating residual scale during robustness iterations. See Scaling Methods for a detailed comparison.
| Method | Description | Robustness |
|---|---|---|
"mad" |
Median Absolute Deviation | Very robust |
"mar" |
Median Absolute Residual | Robust |
"mean" |
Mean Absolute Residual | Less robust |
For example:
zero_weight_fallback¶
Behavior when all neighborhood weights are zero.
| Option | Behavior |
|---|---|
"use_local_mean" |
Use mean of neighborhood (default) |
"return_original" |
Return original y value |
"return_none" |
Return NaN |
For example:
auto_converge¶
Enable early stopping when robustness weights stabilize.
parallel¶
Enable multi-threaded parallel execution via Rayon. Substantially speeds up fitting on datasets with more than a few hundred points.
- Default:
truefor Batch and Streaming;falsefor Online - Adapter: All
Note
OnlineLoess defaults to false because it fits one point at a time. Each update touches only the sliding window, so there is no inner loop large enough to benefit from parallelism — enabling it would add thread overhead with no gain.
Tip
Set to false for fully deterministic, reproducible output when debugging, or in environments where thread safety is required.
custom_weights¶
Per-observation case weights that scale each point's contribution to nearby local fits.
Equivalent to the weights argument in R's stats::loess.
Formula: w_ij = custom_weights[j] × K(d_ij / h) × robustness_j
where K is the distance kernel and robustness_j is the robustness weight (if iterations > 0).
| Value | Effect |
|---|---|
1.0 for all |
Equivalent to no weights (uniform) |
0.0 |
Excludes the observation from all local fits |
> 1.0 |
Increases the observation's influence |
0 < v < 1.0 |
Reduces the observation's influence |
Batch only
custom_weights is applied in Batch mode only. It is ignored in Streaming and Online modes.
Length must match y
The weights vector must have the same length as y. A mismatch returns an error.
Output Options¶
return_residuals¶
Include residuals (y - smoothed) in the output.
return_diagnostics¶
Include fit quality metrics (Batch and Streaming only).
| Metric | Description |
|---|---|
rmse |
Root Mean Square Error |
mae |
Mean Absolute Error |
r_squared |
R² coefficient |
residual_sd |
Residual standard deviation |
effective_df |
Effective degrees of freedom |
aic |
Akaike Information Criterion |
aicc |
Corrected AIC |
return_robustness_weights¶
Include final robustness weights (useful for outlier detection).
confidence_intervals / prediction_intervals¶
Request uncertainty estimates (Batch only).
See Intervals for detailed usage.
CV Methods¶
cv_method¶
Selection strategy for automated parameter tuning.
| Method | Description | Speed |
|---|---|---|
"kfold" |
K-Fold Cross-Validation | Fast |
"loocv" |
Leave-One-Out Cross-Validation | Slow |
Adapter Parameters¶
chunk_size¶
Points per chunk in Streaming mode.
overlap¶
Overlap between chunks in Streaming mode.
merge_strategy¶
Method for merging overlapping chunks. See Merge Strategies for a detailed comparison.
| Strategy | Description | Robustness |
|---|---|---|
"average" |
Average of overlapping chunks | Fastest, least robust |
"take_first" |
Left chunk only | Fastest, least robust |
"take_last" |
Right chunk only | Fastest, least robust |
"weighted_average" |
Weighted average of overlapping chunks | Most robust |
For example:
window_capacity¶
Maximum points held in memory for Online mode.
min_points¶
Minimum points required before Online filter starts producing outputs.
update_mode¶
Optimization strategy for Online mode updates.
| Mode | Description | Speed |
|---|---|---|
"full" |
Re-smooth entire window | Slow |
"incremental" |
Update only affected fits | Fast |
For example: