| Title: | High-Performance LOESS Smoothing for R |
|---|---|
| Description: | Provides high-performance LOESS smoothing (Locally Estimated Scatterplot Smoothing) using a 'Rust' backend. Supports various weight functions, robustness iterations, streaming/online processing, cross-validation, and uncertainty quantification. Applicable to genomic data, time series, and general-purpose smoothing tasks. |
| Authors: | Amir Valizadeh [aut, cre, fnd] (ORCID: <https://orcid.org/0000-0001-5983-8527>) |
| Maintainer: | Amir Valizadeh <[email protected]> |
| License: | MIT + file LICENSE | Apache License (== 2.0) |
| Version: | 0.9.0 |
| Built: | 2026-07-12 23:39:36 UTC |
| Source: | https://github.com/thisisamirv/loess-project |
A high-performance LOESS (Locally Estimated Scatterplot Smoothing)
implementation built on the Rust fastLoess crate.
For comprehensive documentation, see: https://github.com/thisisamirv/loess-project/tree/main/docs
Loess: Primary interface for batch processing
StreamingLoess: Chunked processing for large
datasets
OnlineLoess: Sliding window for real-time data
For comprehensive documentation, tutorials, and API reference, see: https://loess.readthedocs.io/
Maintainer: Amir Valizadeh [email protected] (ORCID) [funder]
Authors:
Amir Valizadeh [email protected] (ORCID) [funder]
Useful links:
Report bugs at https://github.com/thisisamirv/loess-project/issues
# Basic smoothing x <- seq(1, 10, length.out = 100) y <- sin(x) + rnorm(100, sd = 0.2) model <- Loess(fraction = 0.3) result <- model$fit(x, y) plot(x, y) lines(result$x, result$y, col = "red", lwd = 2)# Basic smoothing x <- seq(1, 10, length.out = 100) y <- sin(x) + rnorm(100, sd = 0.2) model <- Loess(fraction = 0.3) result <- model$fit(x, y) plot(x, y) lines(result$x, result$y, col = "red", lwd = 2)
Create a stateful LOESS model for batch smoothing.
Loess( fraction = 0.67, iterations = 3L, weight_function = "tricube", robustness_method = "bisquare", scaling_method = "mad", boundary_policy = "extend", confidence_intervals = NULL, prediction_intervals = NULL, return_diagnostics = FALSE, return_residuals = FALSE, return_robustness_weights = FALSE, zero_weight_fallback = "use_local_mean", auto_converge = NULL, cv_fractions = NULL, cv_method = "kfold", cv_k = 5L, parallel = TRUE, degree = "linear", dimensions = 1L, distance_metric = "normalized", surface_mode = "interpolation", return_se = FALSE, weighted_metric_weights = NULL, cell = NULL, interpolation_vertices = NULL, boundary_degree_fallback = NULL, cv_seed = NULL )Loess( fraction = 0.67, iterations = 3L, weight_function = "tricube", robustness_method = "bisquare", scaling_method = "mad", boundary_policy = "extend", confidence_intervals = NULL, prediction_intervals = NULL, return_diagnostics = FALSE, return_residuals = FALSE, return_robustness_weights = FALSE, zero_weight_fallback = "use_local_mean", auto_converge = NULL, cv_fractions = NULL, cv_method = "kfold", cv_k = 5L, parallel = TRUE, degree = "linear", dimensions = 1L, distance_metric = "normalized", surface_mode = "interpolation", return_se = FALSE, weighted_metric_weights = NULL, cell = NULL, interpolation_vertices = NULL, boundary_degree_fallback = NULL, cv_seed = NULL )
fraction |
Smoothing fraction (between 0 and 1). |
iterations |
Number of robustness iterations (non-negative integer). Default: 3. |
weight_function |
Kernel weight function. One of |
robustness_method |
Outlier downweighting method: |
scaling_method |
Residual scale estimation for robustness weights:
|
boundary_policy |
Boundary handling strategy: |
confidence_intervals |
Confidence level for confidence intervals
(e.g., 0.95). |
prediction_intervals |
Confidence level for prediction intervals
(e.g., 0.95). |
return_diagnostics |
Logical; if |
return_residuals |
Logical; if |
return_robustness_weights |
Logical; if |
zero_weight_fallback |
Fallback policy when all robustness weights drop
to zero: |
auto_converge |
Convergence tolerance for early stopping of robustness
iterations. |
cv_fractions |
Numeric vector of candidate fractions for
cross-validation. |
cv_method |
Cross-validation method: |
cv_k |
Number of folds for k-fold CV. Default: 5. |
parallel |
Logical; enable parallel processing. Default: |
degree |
Local polynomial degree: |
dimensions |
Number of predictor dimensions. Default: 1. |
distance_metric |
Distance metric for neighbourhood computation:
|
surface_mode |
Surface evaluation mode: |
return_se |
Logical; if |
weighted_metric_weights |
Numeric vector of per-dimension weights used
when |
cell |
Cell size tuning parameter for the interpolation grid.
|
interpolation_vertices |
Number of vertices in the interpolation grid.
|
boundary_degree_fallback |
Logical; if |
cv_seed |
Integer seed for the cross-validation random number
generator. |
A Loess object.
x <- seq(0, 10, length.out = 100) y <- sin(x) + rnorm(100, 0, 0.1) model <- Loess(fraction = 0.2) result <- model$fit(x, y) plot(x, y) lines(x, result$y, col = "red")x <- seq(0, 10, length.out = 100) y <- sin(x) + rnorm(100, 0, 0.1) model <- Loess(fraction = 0.2) result <- model$fit(x, y) plot(x, y) lines(x, result$y, col = "red")
Wraps a value to be passed to Rust as an Option.
Nullable(x)Nullable(x)
x |
Value to wrap or NULL. |
The value itself. This is a helper for rextendr conversion.
Nullable(5) Nullable(NULL)Nullable(5) Nullable(NULL)
Create a stateful LOESS model for real-time online data.
OnlineLoess( fraction = 0.67, window_capacity = 1000L, min_points = 3L, iterations = 3L, weight_function = "tricube", robustness_method = "bisquare", scaling_method = "mad", boundary_policy = "extend", update_mode = "full", auto_converge = NULL, return_robustness_weights = FALSE, return_diagnostics = FALSE, return_residuals = FALSE, zero_weight_fallback = "use_local_mean", parallel = FALSE, degree = "linear", dimensions = 1L, distance_metric = "normalized", surface_mode = "interpolation", return_se = FALSE, confidence_intervals = NULL, prediction_intervals = NULL, weighted_metric_weights = NULL, cell = NULL, interpolation_vertices = NULL, boundary_degree_fallback = NULL )OnlineLoess( fraction = 0.67, window_capacity = 1000L, min_points = 3L, iterations = 3L, weight_function = "tricube", robustness_method = "bisquare", scaling_method = "mad", boundary_policy = "extend", update_mode = "full", auto_converge = NULL, return_robustness_weights = FALSE, return_diagnostics = FALSE, return_residuals = FALSE, zero_weight_fallback = "use_local_mean", parallel = FALSE, degree = "linear", dimensions = 1L, distance_metric = "normalized", surface_mode = "interpolation", return_se = FALSE, confidence_intervals = NULL, prediction_intervals = NULL, weighted_metric_weights = NULL, cell = NULL, interpolation_vertices = NULL, boundary_degree_fallback = NULL )
fraction |
Smoothing fraction (between 0 and 1). |
window_capacity |
Maximum number of points kept in the sliding window. |
min_points |
Minimum number of points required before smoothing begins. |
iterations |
Number of robustness iterations (non-negative integer). Default: 3. |
weight_function |
Kernel weight function. One of |
robustness_method |
Outlier downweighting method: |
scaling_method |
Residual scale estimation for robustness weights:
|
boundary_policy |
Boundary handling strategy: |
update_mode |
Window update strategy: |
auto_converge |
Convergence tolerance for early stopping of robustness
iterations. |
return_robustness_weights |
Logical; if |
return_diagnostics |
Logical; if |
return_residuals |
Logical; if |
zero_weight_fallback |
Fallback policy when all robustness weights drop
to zero: |
parallel |
Logical; enable parallel processing. Default: |
degree |
Local polynomial degree: |
dimensions |
Number of predictor dimensions. Default: 1. |
distance_metric |
Distance metric for neighbourhood computation:
|
surface_mode |
Surface evaluation mode: |
return_se |
Logical; if |
confidence_intervals |
Confidence level for confidence intervals
(e.g., 0.95). |
prediction_intervals |
Confidence level for prediction intervals
(e.g., 0.95). |
weighted_metric_weights |
Numeric vector of per-dimension weights used
when |
cell |
Cell size tuning parameter for the interpolation grid.
|
interpolation_vertices |
Number of vertices in the interpolation grid.
|
boundary_degree_fallback |
Logical; if |
An OnlineLoess object.
model <- OnlineLoess(fraction = 0.2, window_capacity = 20) x <- 1:50 y <- sin(x * 0.1) + rnorm(50, 0, 0.1) for (i in seq_along(x)) { result <- model$add_point(x[i], y[i]) if (!is.null(result)) cat("smoothed:", result$smoothed, "\n") }model <- OnlineLoess(fraction = 0.2, window_capacity = 20) x <- 1:50 y <- sin(x * 0.1) + rnorm(50, 0, 0.1) for (i in seq_along(x)) { result <- model$add_point(x[i], y[i]) if (!is.null(result)) cat("smoothed:", result$smoothed, "\n") }
Plot Loess Result
## S3 method for class 'LoessResult' plot(x, main = "LOESS Fit", ...)## S3 method for class 'LoessResult' plot(x, main = "LOESS Fit", ...)
x |
A LoessResult object. |
main |
Plot title. |
... |
Additional arguments passed to plot() and lines(). |
The input object x, invisibly.
x <- seq(0, 10, length.out = 100) y <- sin(x) + rnorm(100, 0, 0.1) model <- Loess(fraction = 0.2) res <- model$fit(x, y) plot(res)x <- seq(0, 10, length.out = 100) y <- sin(x) + rnorm(100, 0, 0.1) model <- Loess(fraction = 0.2) res <- model$fit(x, y) plot(res)
Print Loess Model
## S3 method for class 'Loess' print(x, ...)## S3 method for class 'Loess' print(x, ...)
x |
A Loess object. |
... |
Additional arguments (ignored). |
The input object x, invisibly.
model <- Loess(fraction = 0.3) print(model)model <- Loess(fraction = 0.3) print(model)
Print Loess Result
## S3 method for class 'LoessResult' print(x, ...)## S3 method for class 'LoessResult' print(x, ...)
x |
A LoessResult object. |
... |
Additional arguments (ignored). |
The input object x, invisibly.
x <- seq(0, 10, length.out = 50) y <- sin(x) + rnorm(50, 0, 0.1) model <- Loess(fraction = 0.3) result <- model$fit(x, y) print(result)x <- seq(0, 10, length.out = 50) y <- sin(x) + rnorm(50, 0, 0.1) model <- Loess(fraction = 0.3) result <- model$fit(x, y) print(result)
Print OnlineLoess Model
## S3 method for class 'OnlineLoess' print(x, ...)## S3 method for class 'OnlineLoess' print(x, ...)
x |
An OnlineLoess object. |
... |
Additional arguments. |
The input object x, invisibly.
model <- OnlineLoess(fraction = 0.2, window_capacity = 20L) print(model)model <- OnlineLoess(fraction = 0.2, window_capacity = 20L) print(model)
Print StreamingLoess Model
## S3 method for class 'StreamingLoess' print(x, ...)## S3 method for class 'StreamingLoess' print(x, ...)
x |
A StreamingLoess object. |
... |
Additional arguments. |
The input object x, invisibly.
model <- StreamingLoess(fraction = 0.3, chunk_size = 50L) print(model)model <- StreamingLoess(fraction = 0.3, chunk_size = 50L) print(model)
Create a stateful LOESS model for streaming data.
StreamingLoess( fraction = 0.67, chunk_size = 5000L, overlap = NULL, iterations = 3L, weight_function = "tricube", robustness_method = "bisquare", scaling_method = "mad", boundary_policy = "extend", auto_converge = NULL, return_diagnostics = FALSE, return_residuals = FALSE, return_robustness_weights = FALSE, zero_weight_fallback = "use_local_mean", merge_strategy = "weighted_average", parallel = TRUE, degree = "linear", dimensions = 1L, distance_metric = "normalized", surface_mode = "interpolation", return_se = FALSE, confidence_intervals = NULL, prediction_intervals = NULL, weighted_metric_weights = NULL, cell = NULL, interpolation_vertices = NULL, boundary_degree_fallback = NULL )StreamingLoess( fraction = 0.67, chunk_size = 5000L, overlap = NULL, iterations = 3L, weight_function = "tricube", robustness_method = "bisquare", scaling_method = "mad", boundary_policy = "extend", auto_converge = NULL, return_diagnostics = FALSE, return_residuals = FALSE, return_robustness_weights = FALSE, zero_weight_fallback = "use_local_mean", merge_strategy = "weighted_average", parallel = TRUE, degree = "linear", dimensions = 1L, distance_metric = "normalized", surface_mode = "interpolation", return_se = FALSE, confidence_intervals = NULL, prediction_intervals = NULL, weighted_metric_weights = NULL, cell = NULL, interpolation_vertices = NULL, boundary_degree_fallback = NULL )
fraction |
Smoothing fraction (between 0 and 1). |
chunk_size |
Number of data points per processing chunk. |
overlap |
Number of overlapping points between consecutive chunks. |
iterations |
Number of robustness iterations (non-negative integer). Default: 3. |
weight_function |
Kernel weight function. One of |
robustness_method |
Outlier downweighting method: |
scaling_method |
Residual scale estimation for robustness weights:
|
boundary_policy |
Boundary handling strategy: |
auto_converge |
Convergence tolerance for early stopping of robustness
iterations. |
return_diagnostics |
Logical; if |
return_residuals |
Logical; if |
return_robustness_weights |
Logical; if |
zero_weight_fallback |
Fallback policy when all robustness weights drop
to zero: |
merge_strategy |
Strategy for reconciling overlapping chunk regions:
|
parallel |
Logical; enable parallel processing. Default: |
degree |
Local polynomial degree: |
dimensions |
Number of predictor dimensions. Default: 1. |
distance_metric |
Distance metric for neighbourhood computation:
|
surface_mode |
Surface evaluation mode: |
return_se |
Logical; if |
confidence_intervals |
Confidence level for confidence intervals
(e.g., 0.95). |
prediction_intervals |
Confidence level for prediction intervals
(e.g., 0.95). |
weighted_metric_weights |
Numeric vector of per-dimension weights used
when |
cell |
Cell size tuning parameter for the interpolation grid.
|
interpolation_vertices |
Number of vertices in the interpolation grid.
|
boundary_degree_fallback |
Logical; if |
A StreamingLoess object.
x <- seq(0, 10, length.out = 100) y <- sin(x) + rnorm(100, 0, 0.1) model <- StreamingLoess(fraction = 0.2, chunk_size = 50) res1 <- model$process_chunk(x[1:50], y[1:50]) res2 <- model$process_chunk(x[51:100], y[51:100]) final <- model$finalize()x <- seq(0, 10, length.out = 100) y <- sin(x) + rnorm(100, 0, 0.1) model <- StreamingLoess(fraction = 0.2, chunk_size = 50) res1 <- model$process_chunk(x[1:50], y[1:50]) res2 <- model$process_chunk(x[51:100], y[51:100]) final <- model$finalize()