| Title: | Geometric Methods for Nonparametric Regression and Density Estimation |
|---|---|
| Description: | Provides geometric methods for nonparametric regression and density estimation on data represented as coordinate matrices or weighted graphs. Methods include local polynomial smoothing, model-averaged local polynomial smoothing, local polynomial lifting trend filtering, synchronized local polynomial lifting trend filtering, graph low-pass filtering, and Hessian-energy regression. Methodological references include Gajer and Ravel (2025) "Adaptive Geometric Regression for High-Dimensional Structured Data" <doi:10.48550/arXiv.2511.03817>, Fan and Gijbels (1996, ISBN:9780412983214), Wang et al. (2016) "Trend Filtering on Graphs" <https://www.jmlr.org/papers/v17/15-147.html>, and Kim et al. (2009) "Semi-Supervised Regression Using Hessian Energy" <https://papers.nips.cc/paper/3741-semi-supervised-regression-using-hessian-energy-with-an-application-to-semi-supervised-dimensionality-reduction>. |
| Authors: | Pawel Gajer [aut, cre], Gael Guennebaud [ctb] (Eigen), Benoit Jacob [ctb] (Eigen), Authors of Eigen [cph] (Authorship and copyright in the included Eigen library), Yixuan Qiu [ctb, cph] (Spectra), Contributors to Spectra [cph] (Copyright in the included Spectra library), Sunil Arya [ctb, cph] (ANN), David M. Mount [ctb, cph] (ANN), University of Maryland [cph] (ANN) |
| Maintainer: | Pawel Gajer <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.2.0 |
| Built: | 2026-10-08 22:36:28 UTC |
| Source: | https://github.com/pgajer/geosmooth |
Geometric smoothing and conditional expectation methods for coordinate data, point clouds, and weighted graphs. The package provides local polynomial, model-averaged, trend-filtering, graph low-pass, occupation-density, and Hessian-energy methods.
Use browseVignettes("geosmooth") to open the installed HTML guides,
including vignette("function-guide", package = "geosmooth").
The online guide
links to the full reference. The task links below work in installed help
without an internet connection.
Read vignette("function-guide", package = "geosmooth") for a
task-based guide to all exported functions, prediction limits, and examples.
Use fit.lpl.tf or
fit.slpl.tf for residual penalties with optional
prediction synchronization.
Use fit.metric.graph.lowpass for
spectral smoothing or fit.graph.trend.filtering for
graph-difference penalties.
Use fit.ssrhe.hessian.regression
for quadratic energy or fit.ssrhe.hessian.l1.regression
for an absolute-value penalty.
Use fit.density for support weights,
fit.subject.od for repeated visits, and
normalize.density to convert an existing fitted field.
Combine components with
synthetic.spec and draw data with
materialize.synthetic.
Maintainer: Pawel Gajer [email protected]
Authors:
Pawel Gajer [email protected]
Other contributors:
Gael Guennebaud (Eigen) [contributor]
Benoit Jacob (Eigen) [contributor]
Authors of Eigen (Authorship and copyright in the included Eigen library) [copyright holder]
Yixuan Qiu (Spectra) [contributor, copyright holder]
Contributors to Spectra (Copyright in the included Spectra library) [copyright holder]
Sunil Arya (ANN) [contributor, copyright holder]
David M. Mount (ANN) [contributor, copyright holder]
University of Maryland (ANN) [copyright holder]
vignette("function-guide", package = "geosmooth"),
vignette("synthetic-datasets", package = "geosmooth")
X <- matrix(seq(0, 1, length.out = 30), ncol = 1) y <- sin(2 * pi * X[, 1]) fit <- fit.lps(X, y, support.grid = 8L, degree.grid = 1L, kernel.grid = "tricube", foldid = rep(1:3, 10)) head(predict(fit))X <- matrix(seq(0, 1, length.out = 30), ncol = 1) y <- sin(2 * pi * X[, 1]) fit <- fit.lps(X, y, support.grid = 8L, degree.grid = 1L, kernel.grid = "tricube", foldid = rep(1:3, 10)) head(predict(fit))
Applies every requested low-pass parameter to one response or a matrix of responses using a reusable spectral basis.
apply.metric.graph.lowpass.path( basis, y, eta.grid, filter.type = c("heat_kernel", "tikhonov", "cubic_spline", "gaussian", "exponential", "butterworth"), block.size = NULL, truncation.tol = 1e-04, unresolved.action = c("warn", "error", "allow"), exact.zero = TRUE )apply.metric.graph.lowpass.path( basis, y, eta.grid, filter.type = c("heat_kernel", "tikhonov", "cubic_spline", "gaussian", "exponential", "butterworth"), block.size = NULL, truncation.tol = 1e-04, unresolved.action = c("warn", "error", "allow"), exact.zero = TRUE )
basis |
A |
y |
Numeric response vector or matrix with one row per graph vertex. |
eta.grid |
Numeric filter-parameter grid. |
filter.type |
Spectral low-pass filter family. |
block.size |
Optional number of response columns processed together. |
truncation.tol |
Positive tolerance smaller than one used to classify truncated-basis candidates as spectrally resolved. |
unresolved.action |
Action when a truncated-basis candidate exceeds
|
exact.zero |
Logical. For heat filtering, return the input exactly at
|
A list of class "metric.graph.lowpass.path". For one response,
fitted.values is an by matrix. For multiple
responses it is an by by array.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) basis <- metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense") apply.metric.graph.lowpass.path(basis, 1:4, eta.grid = c(0, 0.1, 1))adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) basis <- metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense") apply.metric.graph.lowpass.path(basis, 1:4, eta.grid = c(0, 0.1, 1))
Summarize a synthetic dataset as one metadata row
## S3 method for class 'synthetic_dataset' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'synthetic_dataset' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A |
row.names |
Optional row names. |
optional |
Ignored. |
... |
Ignored. |
A one-row data frame.
x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) as.data.frame(x)x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) as.data.frame(x)
Reuses the supports, local charts, prediction supports, averaging weights,
selected degree, and local-solver controls from an existing
fit.malps object, then repeatedly calls
refit with bootstrap-style case weights. This is a
fixed-selection uncertainty diagnostic: it measures refit variability
conditional on the fitted MALPS support profile and does not rerun
cross-validation or rebuild supports in each replicate.
bootstrap.malps( object, B = 200L, weight.type = c("bayesian", "multinomial"), y = NULL, probs = NULL, conf.level = 0.95, seed = NULL, max.failures = max(10L, B), keep.weights = FALSE, verbose = FALSE, ... )bootstrap.malps( object, B = 200L, weight.type = c("bayesian", "multinomial"), y = NULL, probs = NULL, conf.level = 0.95, seed = NULL, max.failures = max(10L, B), keep.weights = FALSE, verbose = FALSE, ... )
object |
|
B |
Number of successful bootstrap replicates requested. |
weight.type |
Bootstrap weight generator, one of |
y |
Optional response vector. Defaults to |
probs |
Optional nonnegative sampling probabilities for
|
conf.level |
Pointwise interval level used in the returned summary. |
seed |
Optional integer seed for reproducible bootstrap weights. |
max.failures |
Maximum failed refit attempts allowed before stopping. |
keep.weights |
Logical; store the generated bootstrap weights in the returned object. |
verbose |
Logical; emit progress messages every ten successful replicates. |
... |
Reserved for future extensions. |
Two weight generators are available. "bayesian" draws positive
exponential weights and rescales them to have mean one. This is the default
because it preserves positive local support weights and therefore avoids many
local-support degeneracies. "multinomial" draws ordinary
nonparametric bootstrap counts with total count nrow(object$X); this
can fail when a replicate assigns zero weight to all observations in a local
support, and such failures are recorded.
A list of class "malps_bootstrap" containing:
replicate.fitted.values: an matrix of
successful replicate fitted values;
replicate.weights: an optional matrix of
bootstrap weights when keep.weights = TRUE;
failures: a data frame with columns attempt,
failure, and message;
summary: pointwise fitted values, bootstrap summaries, and
empirical lower/upper intervals;
bootstrap metadata such as B.completed, n.failures,
conf.level, and weight.type.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) bootstrap.malps(fit, B = 5L, seed = 1L)X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) bootstrap.malps(fit, B = 5L, seed = 1L)
Runs one candidate graph per process, with dynamically scheduled jobs and no nested fold parallelism. On Unix, forked workers inherit the loaded package sources. Run from Rscript, not a GUI or multithreaded parent process.
compare.masked.graph.fields(operators, studies, workers = 1L, ...)compare.masked.graph.fields(operators, studies, workers = 1L, ...)
operators |
Named list of metric graph low-pass operators. |
studies |
Named list of argument lists containing vertex, y and group. |
workers |
Number of graph workers; choose using available memory and CPU. Defaults to serial execution. Windows currently requires one worker. |
... |
Additional arguments passed to cv.masked.graph.field. |
Named graph results, each containing named study results or an explicit error record. Retains per-observation predictions for common-support scoring.
Compare two synthetic datasets scientifically
compare.synthetic.dataset(x, y, tolerance = c(1e-12, 1e-10))compare.synthetic.dataset(x, y, tolerance = c(1e-12, 1e-10))
x, y
|
Synthetic datasets. |
tolerance |
Absolute-plus-relative comparison tolerance. |
A list with equality and mismatch details.
spec <- synthetic.registry.spec("G1") x <- materialize.synthetic(spec, n = 20L, seed = 1L) y <- materialize.synthetic(spec, n = 20L, seed = 1L) compare.synthetic.dataset(x, y)spec <- synthetic.registry.spec("G1") x <- materialize.synthetic(spec, n = 20L, seed = 1L) y <- materialize.synthetic(spec, n = 20L, seed = 1L) compare.synthetic.dataset(x, y)
Select smoothing within outer training folds, predict held-out groups, and finally tune and refit on all observations. Graph construction is label-free and fixed (transductive prediction). Unsupported predictions remain NA.
cv.masked.graph.field( operator, vertex, y, group, lambdas = 10^seq(-6, 2, length.out = 17), outer.folds = 5L, inner.folds = 4L, seed = 1L, fold.id = NULL, progress = NULL )cv.masked.graph.field( operator, vertex, y, group, lambdas = 10^seq(-6, 2, length.out = 17), outer.folds = 5L, inner.folds = 4L, seed = 1L, fold.id = NULL, progress = NULL )
operator |
An unnormalized |
vertex |
Integer vertex index for each observed response. |
y |
Finite numeric observed responses (no missing-value placeholders). |
group |
Participant or leakage-block identifier per observation. |
lambdas |
Positive finite candidate penalties. |
outer.folds, inner.folds
|
Numbers of grouped folds. |
seed |
Fold seed, independent of worker scheduling. |
fold.id |
Optional preassigned outer fold per observation; a group must occupy exactly one fold. |
progress |
Optional function called after each outer fold with fold and selected penalty; intended for experiment progress records. |
Outer predictions, baseline predictions, scores on supported cases, coverage, tuning records, fold assignments and final full-data field. Scores do not account for selecting a graph after comparing graphs.
Fits a local chart-kernel field by evaluating a Nadaraya–Watson style
smoother at each evaluation point. The function is a general fitted-field
model, not an occupation-density wrapper: density workflows should call
normalize.density on the returned fit.
fit.chart.kernel( X, y, X.eval = NULL, support.size = min(15L, nrow(X)), kernel = c("gaussian", "tricube", "epanechnikov", "triangular"), bandwidth.multiplier = 1, support.grid = NULL, kernel.grid = NULL, bandwidth.multiplier.grid = NULL, foldid = NULL, cv.folds = 5L, cv.seed = 1L, coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, chart.dim.grid = NULL, selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.dim.max = NULL, geometry.margin = 0L, auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), quadrature.weights = NULL, denominator.floor = sqrt(.Machine$double.eps), return.details = TRUE )fit.chart.kernel( X, y, X.eval = NULL, support.size = min(15L, nrow(X)), kernel = c("gaussian", "tricube", "epanechnikov", "triangular"), bandwidth.multiplier = 1, support.grid = NULL, kernel.grid = NULL, bandwidth.multiplier.grid = NULL, foldid = NULL, cv.folds = 5L, cv.seed = 1L, coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, chart.dim.grid = NULL, selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.dim.max = NULL, geometry.margin = 0L, auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), quadrature.weights = NULL, denominator.floor = sqrt(.Machine$double.eps), return.details = TRUE )
X |
Numeric matrix with one row per source/support point. |
y |
Numeric response or mass vector of length |
X.eval |
Optional numeric matrix of evaluation points. Defaults to
|
support.size |
Number of source points in each local support. |
kernel |
Kernel name. Supported values are |
bandwidth.multiplier |
Positive multiplier applied to the local support radius. |
support.grid |
Optional integer candidate neighborhood sizes. If
supplied, or if |
kernel.grid |
Optional kernel candidates for cross-validation. |
bandwidth.multiplier.grid |
Optional bandwidth-multiplier candidates for cross-validation. |
foldid |
Optional positive integer vector assigning source rows to cross-validation folds. |
cv.folds |
Number of folds used when |
cv.seed |
Random seed used to generate folds when |
coordinate.method |
Local coordinate method. |
chart.dim |
Local PCA dimension when |
chart.dim.grid |
Optional candidate chart dimensions for experimental
row-wise cross-validation. Numeric grids can be evaluated with
|
selection.strategy |
Candidate-selection strategy. |
chart.dim.max |
Optional explicit maximum chart dimension for the sparse coupled candidate family. |
geometry.margin |
Nonnegative integer subtracted from the local-PCA
rank cap |
auto.chart.support.metric |
Support system used by |
auto.chart.selection.metric |
Which auto chart-dimension diagnostic to use when both coordinate and operator summaries are requested. |
quadrature.weights |
Optional positive reference-measure weights
|
denominator.floor |
Positive floor used when the local denominator is numerically zero. |
return.details |
Logical; if |
For an evaluation point , the method chooses a local support
, builds either centered ambient coordinates or a local PCA chart, and
computes
Here is the local chart coordinate of ,
is an optional quadrature weight, and is the selected
kernel.
A list with class "chart_kernel" containing
fitted.values, source/evaluation supports, selected controls, and
denominator diagnostics.
X <- matrix(seq(0, 1, length.out = 21), ncol = 1) y <- exp(-20 * (X[, 1] - 0.5)^2) fit.chart.kernel(X, y, support.size = 7L, kernel = "gaussian")X <- matrix(seq(0, 1, length.out = 21), ncol = 1) y <- exp(-20 * (X[, 1] - 0.5)^2) fit.chart.kernel(X, y, support.size = 7L, kernel = "gaussian")
Dispatches to a dedicated density estimator. Subject-occupation density estimation is one application: construct a sparse mass vector over a fixed support set and call this generic density layer.
fit.density( X, weights = NULL, method = c("empirical", "graph_random_walk"), graph = NULL, graph.control = list(), density.control = list(), return.details = TRUE, ... )fit.density( X, weights = NULL, method = c("empirical", "graph_random_walk"), graph = NULL, graph.control = list(), density.control = list(), return.details = TRUE, ... )
X |
Numeric matrix with one row per support point. |
weights |
Optional nonnegative mass/count vector of length
|
method |
Density method identifier. |
graph |
Optional precomputed graph object. |
graph.control |
Named list for random walks: |
density.control |
List controlling clipping, normalization, and
accounting checks. Recognized entries are |
return.details |
Logical; if |
... |
Reserved for future methods; unused arguments are errors. |
A list of class "density_fit" with fields
method.id, status, rho, empirical.rho,
fitted.raw, theta, accounting,
smoothness, timing, diagnostics, and
warnings.
X <- matrix(seq(0, 1, length.out = 6), ncol = 1) fit.density(X, weights = c(1, 0, 2, 0, 0, 1), method = "empirical")X <- matrix(seq(0, 1, length.out = 6), ncol = 1) fit.density(X, weights = c(1, 0, 2, 0, 0, 1), method = "empirical")
Fits graph trend filtering on a supplied undirected graph. Supported orders
are 0L, 1L, and 2L:
fit.graph.trend.filtering( adj.list, weight.list = NULL, y, order = 0L, lambda.grid = NULL, lambda.selection = c("cv", "fixed"), weight.rule = c("conductance", "sqrt.conductance", "unit"), operator.family = c("graph.laplacian.recursive", "path.divided.difference"), path.family = c("branch.continuation", "all.simple"), path.weighting = c("unit", "anchor.mean"), n.lambda = 40L, nfolds = 5L, foldid = NULL, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE )fit.graph.trend.filtering( adj.list, weight.list = NULL, y, order = 0L, lambda.grid = NULL, lambda.selection = c("cv", "fixed"), weight.rule = c("conductance", "sqrt.conductance", "unit"), operator.family = c("graph.laplacian.recursive", "path.divided.difference"), path.family = c("branch.continuation", "all.simple"), path.weighting = c("unit", "anchor.mean"), n.lambda = 40L, nfolds = 5L, foldid = NULL, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE )
adj.list |
List of integer neighbor vectors using 1-based vertex indices. The graph must be undirected: every edge must appear in both endpoint adjacency lists. |
weight.list |
Optional list of positive edge weights parallel to
|
y |
Numeric response vector of length |
order |
Integer trend-filtering order. Supported values are
|
lambda.grid |
Optional non-negative lambda grid. For
|
lambda.selection |
|
weight.rule |
Character scalar. |
operator.family |
Character scalar selecting the penalty operator family.
The default |
path.family |
Character scalar used for
|
path.weighting |
Character scalar used for
|
n.lambda |
Number of default lambda candidates when
|
nfolds |
Number of CV folds. |
foldid |
Optional integer fold assignments of length |
maxsteps |
Maximum number of path steps passed to genlasso. |
minlam |
Minimum lambda passed to genlasso. |
approx |
Logical; passed to genlasso. |
rtol, btol, eps
|
Numerical controls passed to genlasso. |
verbose |
Logical. If |
Graph trend filtering is intended as an -adaptive comparator to
the graph smoothers now housed in geosmooth and the
legacy rdgraph comparator. The low-pass smoother penalizes
broad quadratic graph roughness through a term like
which shrinks high-frequency variation everywhere. Graph trend filtering
instead penalizes absolute graph differences. For order = 0L, this is
so many edge differences can become exactly zero while selected edges carry
jumps. In this sense order = 0L is locally adaptive: fitted values can
be piecewise constant over graph regions. Higher orders use
with .
The supplied weight.list, when used, is interpreted as a graph
trend-filtering edge weight or conductance for
operator.family = "graph.laplacian.recursive". For
operator.family = "path.divided.difference", weight.list is
interpreted as metric edge length and is used to form local path coordinates.
Use weight.rule = "sqrt.conductance" when the recursive graph
square-root convention is desired, and weight.rule = "unit" for an
unweighted recursive graph fused-lasso penalty.
The solver backend is currently genlasso. Cross-validation refits the
generalized-lasso problem on vertex-held-out training sets using a selection
matrix ; this is useful for small and moderate diagnostic problems but
is not yet a scalable production graph-trend-filtering solver.
A list of class "graph.trend.filtering.fit" containing fitted
values, residuals, selected lambda, the operator, path metadata, and CV
diagnostics when requested.
Wang, Y.-X., Sharpnack, J., Smola, A., and Tibshirani, R. J. (2016). Trend filtering on graphs. Journal of Machine Learning Research, 17(105), 1–41. https://www.jmlr.org/papers/v17/15-147.html
if (requireNamespace("genlasso", quietly = TRUE)) { adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) fit.graph.trend.filtering( adj, y = c(0, 0.2, 1.8, 2), lambda.grid = 0.3, lambda.selection = "fixed", weight.rule = "unit" ) }if (requireNamespace("genlasso", quietly = TRUE)) { adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) fit.graph.trend.filtering( adj, y = c(0, 0.2, 1.8, 2), lambda.grid = 0.3, lambda.selection = "fixed", weight.rule = "unit" ) }
Fits a local likelihood model at each evaluation point and reads off one raw
fitted value at that evaluation anchor. Density and Bernoulli workflows
should convert the returned fitted field with normalize.density
when the target is a subject-occupation density.
fit.local.likelihood( X, y, X.eval = NULL, likelihood.family = c("density", "bernoulli"), support.size = min(15L, nrow(X)), degree = 1L, kernel = c("gaussian", "tricube", "epanechnikov", "triangular"), bandwidth.multiplier = 1, support.grid = NULL, degree.grid = NULL, kernel.grid = NULL, bandwidth.multiplier.grid = NULL, lambda.ridge.grid = NULL, foldid = NULL, cv.folds = 5L, cv.seed = 1L, coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, chart.dim.grid = NULL, selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.dim.max = NULL, design.margin = 2L, auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), quadrature.weights = NULL, lambda.ridge = 1e-08, min.local.mass = sqrt(.Machine$double.eps), min.nonzero.mass = 1L, fallback = c("degree0", "zero", "chart_kernel", "na"), optimizer = c("newton", "optim"), max.iter = 50L, tol = 1e-08, return.details = TRUE )fit.local.likelihood( X, y, X.eval = NULL, likelihood.family = c("density", "bernoulli"), support.size = min(15L, nrow(X)), degree = 1L, kernel = c("gaussian", "tricube", "epanechnikov", "triangular"), bandwidth.multiplier = 1, support.grid = NULL, degree.grid = NULL, kernel.grid = NULL, bandwidth.multiplier.grid = NULL, lambda.ridge.grid = NULL, foldid = NULL, cv.folds = 5L, cv.seed = 1L, coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, chart.dim.grid = NULL, selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.dim.max = NULL, design.margin = 2L, auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), quadrature.weights = NULL, lambda.ridge = 1e-08, min.local.mass = sqrt(.Machine$double.eps), min.nonzero.mass = 1L, fallback = c("degree0", "zero", "chart_kernel", "na"), optimizer = c("newton", "optim"), max.iter = 50L, tol = 1e-08, return.details = TRUE )
X |
Numeric matrix with one row per source/support point. |
y |
Numeric response vector. For |
X.eval |
Optional numeric matrix of evaluation points. Defaults to
|
likelihood.family |
Local likelihood family. |
support.size |
Number of source points in each local support. |
degree |
Local chart feature degree. Supported values are 0, 1, and 2. The density branch omits an intercept because the intercept is not identifiable in the normalized local density likelihood. The Bernoulli branch includes an intercept in its internal logistic feature map. |
kernel |
Kernel name. Supported values are |
bandwidth.multiplier |
Positive multiplier applied to the local support radius. |
support.grid |
Optional integer candidate neighborhood sizes for
cross-validation. CV selection is currently implemented for
|
degree.grid |
Optional local polynomial degree candidates for Bernoulli cross-validation. |
kernel.grid |
Optional kernel candidates for Bernoulli cross-validation. |
bandwidth.multiplier.grid |
Optional bandwidth-multiplier candidates for Bernoulli cross-validation. |
lambda.ridge.grid |
Optional ridge-penalty candidates for Bernoulli cross-validation. |
foldid |
Optional positive integer vector assigning source rows to cross-validation folds. |
cv.folds |
Number of folds used when |
cv.seed |
Random seed used to generate folds when |
coordinate.method |
Local coordinate method. |
chart.dim |
Local PCA dimension when |
chart.dim.grid |
Optional candidate chart dimensions for experimental
cross-validation. Numeric grids can be evaluated with
|
selection.strategy |
Candidate-selection strategy. |
chart.dim.max |
Optional explicit maximum chart dimension for the sparse coupled candidate family. |
design.margin |
Nonnegative integer feasibility margin used to screen local polynomial design size before candidate evaluation. |
auto.chart.support.metric |
Support system used by |
auto.chart.selection.metric |
Which auto chart-dimension diagnostic to use when both coordinate and operator summaries are requested. |
quadrature.weights |
Optional positive reference-measure weights. Defaults to unit weights. |
lambda.ridge |
Nonnegative ridge penalty on identifiable coefficients. |
min.local.mass |
Minimum local kernel-weighted mass needed before attempting a higher-degree density fit. For Bernoulli fits this is used only as diagnostic telemetry. |
min.nonzero.mass |
Minimum number of locally weighted positive-mass source points needed before attempting a higher-degree local fit. |
fallback |
Fallback policy for underidentified or failed higher-degree
local fits. Zero local mass always uses |
optimizer |
Optimizer for nonzero-degree density fits. |
max.iter |
Maximum optimizer iterations. |
tol |
Convergence tolerance for gradient norm and step norm. |
return.details |
Logical; if |
The likelihood.family = "density" branch uses a local exponential
tilt of the chart reference measure. The "bernoulli" branch uses a
weighted local logistic likelihood and returns fitted probabilities at the
evaluation anchors.
A list with class "local_likelihood" containing
fitted.values, selected controls, and local solver diagnostics.
X <- matrix(seq(0, 1, length.out = 21), ncol = 1) y <- exp(-20 * (X[, 1] - 0.5)^2) y <- y / sum(y) fit.local.likelihood(X, y, likelihood.family = "density", support.size = 7L, degree = 0L)X <- matrix(seq(0, 1, length.out = 21), ncol = 1) y <- exp(-20 * (X[, 1] - 0.5)^2) y <- y / sum(y) fit.local.likelihood(X, y, likelihood.family = "density", support.size = 7L, degree = 0L)
Fits an LPL-TF estimator with a fixed operator:
fit.lpl.tf( X = NULL, y, operator = NULL, adj.list = NULL, weight.list = NULL, graph = NULL, degree = 2L, lambda.grid = NULL, lambda = NULL, lambda.selection = c("cv", "fixed"), operator.grid = NULL, foldid = NULL, cv.folds = 5L, cv.loss = c("mse", "rmse", "mae"), cv.seed = NULL, cv.repeats = 1L, solver = c("genlasso"), selection = c("min", "one.se"), n.lambda = 80L, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE, ... )fit.lpl.tf( X = NULL, y, operator = NULL, adj.list = NULL, weight.list = NULL, graph = NULL, degree = 2L, lambda.grid = NULL, lambda = NULL, lambda.selection = c("cv", "fixed"), operator.grid = NULL, foldid = NULL, cv.folds = 5L, cv.loss = c("mse", "rmse", "mae"), cv.seed = NULL, cv.repeats = 1L, solver = c("genlasso"), selection = c("min", "one.se"), n.lambda = 80L, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE, ... )
X |
Optional coordinate matrix used to build |
y |
Numeric response vector. |
operator |
Optional |
adj.list, weight.list, graph
|
Optional graph inputs passed to
|
degree |
Polynomial degree passed to |
lambda.grid |
Optional nonnegative lambda grid. |
lambda |
Optional fixed lambda shortcut. If supplied, it is used as the
single fixed lambda and |
lambda.selection |
|
operator.grid |
Optional operator candidate grid. Supply a data
frame with one row per candidate or a list of named lists. Candidate fields
may include operator-construction arguments such as |
foldid |
Optional deterministic fold assignments for CV. |
cv.folds |
Number of generated folds when |
cv.loss |
Cross-validation loss, |
cv.seed |
Reserved for reproducible generated folds. Generated folds
are deterministic even when this is |
cv.repeats |
Number of CV repeats. The current implementation supports only one repeat. |
solver |
Solver backend. The current implementation supports only
|
selection |
Lambda selection rule, |
n.lambda |
Number of generated lambdas when a genlasso path is used and
|
maxsteps, minlam, approx, rtol, btol, eps
|
Genlasso controls. |
verbose |
Logical. |
... |
Additional arguments passed to |
A list of class "lpl_tf".
if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit.lpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda = 0.1, lambda.selection = "fixed") }if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit.lpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda = 0.1, lambda.selection = "fixed") }
Fits a local polynomial smoother (LPS) and selects its support size, polynomial degree, and kernel by cross-validation. By default, the smoother works in the observed ambient coordinates: each prediction point uses its nearest training points in Euclidean distance, centers the support at the prediction point, fits a weighted local polynomial, and uses the fitted intercept as the prediction.
fit.lps( X, y, foldid = NULL, support.grid = c(10L, 15L, 20L), degree.grid = 0:2, kernel.grid = c("gaussian", "tricube"), cv.folds = 5L, cv.seed = 1L, X.eval = NULL, coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, chart.dim.grid = NULL, local.chart.method = c("pca", "second.order.svd"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), backend = c("auto", "R", "cpp", "cpp.local.pca"), design.basis = c("orthogonal.polynomial.drop", "monomial", "weighted.qr", "weighted.qr.drop"), design.drop.tol = 1e-08, ridge.multiplier.grid = c(0, 1e-10, 1e-08), ridge.condition.max = 1e+12, unstable.action = c("na", "mean"), outcome.family = c("gaussian", "bernoulli", "binomial"), bandwidth.multiplier.grid = 1, keep.cv.predictions = FALSE, ridge.shrinkage.target = c("zero", "local.mean"), selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.activation = c("none", "subject.od"), chart.activation.response = NULL, chart.activation.control = list(), chart.dim.max = NULL, design.margin = 2L )fit.lps( X, y, foldid = NULL, support.grid = c(10L, 15L, 20L), degree.grid = 0:2, kernel.grid = c("gaussian", "tricube"), cv.folds = 5L, cv.seed = 1L, X.eval = NULL, coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, chart.dim.grid = NULL, local.chart.method = c("pca", "second.order.svd"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), backend = c("auto", "R", "cpp", "cpp.local.pca"), design.basis = c("orthogonal.polynomial.drop", "monomial", "weighted.qr", "weighted.qr.drop"), design.drop.tol = 1e-08, ridge.multiplier.grid = c(0, 1e-10, 1e-08), ridge.condition.max = 1e+12, unstable.action = c("na", "mean"), outcome.family = c("gaussian", "bernoulli", "binomial"), bandwidth.multiplier.grid = 1, keep.cv.predictions = FALSE, ridge.shrinkage.target = c("zero", "local.mean"), selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.activation = c("none", "subject.od"), chart.activation.response = NULL, chart.activation.control = list(), chart.dim.max = NULL, design.margin = 2L )
X |
Numeric design/coordinate matrix with one observation per row. |
y |
Numeric response vector with length |
foldid |
Optional positive integer vector assigning rows to CV folds. |
support.grid |
Integer candidate neighborhood sizes. |
degree.grid |
Integer polynomial degrees. Currently degrees 0, 1, and 2 are supported. |
kernel.grid |
Candidate kernels. Supported kernels are
|
cv.folds |
Number of folds used when |
cv.seed |
Random seed used to generate folds when |
X.eval |
Optional matrix of prediction locations. Defaults to |
coordinate.method |
Local coordinate system. |
chart.dim |
Chart dimension for |
chart.dim.grid |
Optional candidate chart dimensions for experimental
coupled support-size by chart-dimension selection. When supplied,
|
local.chart.method |
Local chart constructor used when
|
auto.chart.support.metric |
Support system used when
|
auto.chart.selection.metric |
Which auto chart-dimension diagnostic to select when both diagnostics are requested. |
backend |
Computation backend. |
design.basis |
Local polynomial design backend. |
design.drop.tol |
Relative QR tolerance used by
|
ridge.multiplier.grid |
Nonnegative scale-relative ridge multipliers
tried by the R local-solve backend. The smallest multiplier whose
penalized local normal equations pass |
ridge.condition.max |
Maximum allowed condition number for the
penalized local normal equations. Use |
unstable.action |
Action when no local solve passes the rank and
condition guards. |
outcome.family |
Response family. |
bandwidth.multiplier.grid |
Nonnegative bandwidth multipliers added to
the CV candidate grid. For a candidate with multiplier |
keep.cv.predictions |
Logical; if |
ridge.shrinkage.target |
Shrinkage target of the local ridge
penalty in the least-squares solve (E2.13). The default |
selection.strategy |
Candidate-selection strategy. |
chart.activation |
Optional sparse-response chart activation rule.
|
chart.activation.response |
Optional nonnegative response used only by
|
chart.activation.control |
List controlling sparse chart activation.
Supported fields are |
chart.dim.max |
Optional explicit maximum chart dimension for the experimental coupled selector. |
design.margin |
Nonnegative prefit margin used to mark coupled
|
The optional coordinate.method = "local.pca" mode keeps the same
support and kernel weighting rule, but builds the local polynomial in a local
PCA chart centered at each prediction point. With chart.dim = "auto",
the chart dimension is estimated as one global scalar from observed
X only, using the same shared local-PCA dimension helper used by
LPL-TF and S-LPL-TF. The experimental
chart.dim = "local.auto" mode estimates an input-only local chart
dimension separately for each prediction anchor.
A list of class "lps" with response-scale
fitted.values, unmodified local least-squares
fitted.values.raw, selected parameters, a candidate CV table, the
requested local.chart.method, and the effective chart method used
for reporting. In outcome.family = "bernoulli" or
"binomial" mode, fitted.values are response-scale
probabilities in [0,1],
fitted.values.raw are the un-clipped conditional-expectation
estimates for "bernoulli" and the fitted probabilities for
"binomial", cv.table$cv.brier.observed is the observed CV
Brier score of the response-scale (clipped) predictions with
Inf for candidates having any non-finite prediction, and
probability.diagnostics records raw/clipped probability ranges,
out-of-range fractions, and Brier/log-loss diagnostics. The Brier and
log-loss diagnostics are defined only when the fitted predictions have the
same length as the training response, which is the default
X.eval = X path. In "binomial" mode,
logistic.diagnostics records local logistic solve attempts,
convergence statuses, fallback-path counts, event-rate fallback counts,
and NA failure counts separately for CV and final fitting.
First fit: supply X, y, foldid, and small support.grid,
degree.grid, and kernel.grid candidates. See the installed function guide.
Selection: cv.folds, cv.seed, and selection.strategy control the
search. Candidate combinations and folds multiply the fitting work; use
lps.nested.cv() for an outer assessment of the tuning procedure.
Geometry: coordinate.method, chart.dim, and local chart controls
describe neighborhoods and coordinate systems, not a different response model.
Numerics: backend, design.basis, rank thresholds and ridge controls
govern stable local solves. Inspect lps.backend.diagnostics() before
changing them. A numerical ridge is distinct from neighborhood selection.
Diagnostics: selected, cv.table, and diagnostics retain selection
and local-fit information. A dense smoother.matrix needs one entry per
evaluation/training pair; it is restricted to supported configurations.
Fan, J. and Gijbels, I. (1996). Local Polynomial Modelling and Its Applications. Chapman and Hall/CRC. ISBN 9780412983214.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) y <- sin(2 * pi * X[, 1]) fit <- fit.lps( X, y, support.grid = 8L, degree.grid = 1L, kernel.grid = "tricube", cv.folds = 2L, backend = "R" ) head(fit$fitted.values)X <- matrix(seq(0, 1, length.out = 20), ncol = 1) y <- sin(2 * pi * X[, 1]) fit <- fit.lps( X, y, support.grid = 8L, degree.grid = 1L, kernel.grid = "tricube", cv.folds = 2L, backend = "R" ) head(fit$fitted.values)
Fits the current model-averaged local polynomial smoother (MALPS) on a supplied coordinate matrix. MALPS fits local polynomial regressions around observed anchor points and averages all positive-weight local predictions at each training point. The current implementation supports supplied coordinates, observed or supplied coordinate anchors, fixed support parameters, deterministic cross-validation and exact dense GCV over support parameters, local PCA chart coordinates, ordinary and weighted new-response refits, coordinate-space new-point prediction, linear-smoother diagnostics, and fixed-selection bootstrap uncertainty summaries. Graph-geodesic supports are available for training and refit; graph-geodesic new-point prediction is deferred.
fit.malps( X, y, graph = NULL, adj.list = NULL, weight.list = NULL, graph.stage = "final", anchor.index = NULL, anchor.coordinates = NULL, degree = 2L, degree.grid = NULL, support.type = c("adaptive.radius", "knn", "fixed.radius"), support.size = NULL, support.grid = NULL, radius = NULL, radius.grid = NULL, min.support = NULL, min.support.grid = NULL, support.buffer = 3L, kernel = c("epanechnikov", "triangular", "gaussian", "tricube"), kernel.grid = NULL, model.weight.rule = c("none", "condition", "support", "boundary", "quality"), duplicate.action = c("keep", "error"), coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, support.metric = c("auto", "coordinates", "graph.geodesic"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), support.selection = c("fixed", "cv", "gcv"), foldid = NULL, cv.folds = 5L, cv.loss = c("rmse", "mae", "mse"), cv.repeats = 1L, cv.seed = NULL, cv.one.se = FALSE, gcv.exact.max.n = 1000L, local.solver = c("auto", "normal.equations", "qr", "svd"), normal.equations.max.condition = 1e+08, robust.iterations = 0L, robust.tuning.constant = 6, verbose = FALSE, ... )fit.malps( X, y, graph = NULL, adj.list = NULL, weight.list = NULL, graph.stage = "final", anchor.index = NULL, anchor.coordinates = NULL, degree = 2L, degree.grid = NULL, support.type = c("adaptive.radius", "knn", "fixed.radius"), support.size = NULL, support.grid = NULL, radius = NULL, radius.grid = NULL, min.support = NULL, min.support.grid = NULL, support.buffer = 3L, kernel = c("epanechnikov", "triangular", "gaussian", "tricube"), kernel.grid = NULL, model.weight.rule = c("none", "condition", "support", "boundary", "quality"), duplicate.action = c("keep", "error"), coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, support.metric = c("auto", "coordinates", "graph.geodesic"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), support.selection = c("fixed", "cv", "gcv"), foldid = NULL, cv.folds = 5L, cv.loss = c("rmse", "mae", "mse"), cv.repeats = 1L, cv.seed = NULL, cv.one.se = FALSE, gcv.exact.max.n = 1000L, local.solver = c("auto", "normal.equations", "qr", "svd"), normal.equations.max.condition = 1e+08, robust.iterations = 0L, robust.tuning.constant = 6, verbose = FALSE, ... )
X |
Numeric coordinate matrix with one row per observation. |
y |
Numeric response vector with length |
graph |
Optional supported dgraphs graph object, for example from
|
adj.list |
Optional 1-based undirected adjacency list. Must be supplied
together with |
weight.list |
Optional positive edge-length list parallel to
|
graph.stage |
Graph lifecycle stage used when |
anchor.index |
Optional integer vector of observed rows used as local
model anchors. Defaults to all rows when |
anchor.coordinates |
Optional numeric coordinate matrix of off-sample
local model anchors with the same number of columns as |
degree |
Local polynomial degree, one of |
degree.grid |
Optional degree grid used when
|
support.type |
Support construction rule. |
support.size |
Number of nearest observations for
|
support.grid |
Optional kNN support-size grid used when
|
radius |
Radius for |
radius.grid |
Optional radius grid used when
|
min.support |
Minimum positive-weight support size. If |
min.support.grid |
Optional minimum-support grid used when
|
support.buffer |
Nonnegative integer added to the local design size when
deriving the default |
kernel |
Kernel used for local fitting and model averaging. |
kernel.grid |
Optional kernel grid used when
|
model.weight.rule |
Optional per-anchor model-quality multiplier applied
to the ordinary kernel averaging weights. |
duplicate.action |
How duplicate coordinate rows should be handled.
|
coordinate.method |
Coordinate system used for each local polynomial
design. |
chart.dim |
Local chart dimension for |
support.metric |
Distance system used for support construction.
|
auto.chart.support.metric |
Support system used when
|
auto.chart.selection.metric |
Which auto chart-dimension diagnostic to
use for the fitted MALPS model when both diagnostics are available. The
default |
support.selection |
|
foldid |
Optional integer fold assignments. If supplied,
|
cv.folds |
Number of folds generated when |
cv.loss |
Cross-validation loss. |
cv.repeats |
Number of independent fold assignments generated when
|
cv.seed |
Optional seed for generated folds. |
cv.one.se |
Logical; use a one-standard-error rule for support selection. |
gcv.exact.max.n |
Maximum number of observations allowed for exact dense
GCV support selection. Larger datasets should use |
local.solver |
Local weighted least-squares solver.
|
normal.equations.max.condition |
Maximum local design condition number
for normal equations under |
robust.iterations |
Number of Cleveland-style robust residual
reweighting iterations applied inside each local polynomial fit. The
default |
robust.tuning.constant |
Positive bisquare tuning constant. The
default |
verbose |
Logical; reserved for future progress messages. |
... |
Reserved for future extensions. Supplying unused arguments is an error. |
Current development benchmarks suggest using the plain MALPS defaults for
production-style fits unless a specific diagnostic motivates a non-default
option: support.selection = "cv", robust.iterations = 0L,
model.weight.rule = "none", and observed anchors
(anchor.coordinates = NULL). Exact GCV selection
(support.selection = "gcv") is a useful faster option for
fixed-weight, non-robust MALPS fits, especially exploratory continuous
smoothing runs, but it is not yet the universal default. Binary responses
are treated as numeric conditional-expectation targets; fitted values are not
clipped inside the smoother. Grid anchors, empirical-Bayes shrinkage, robust
local residual reweighting, and conservative/smoothed GCV selection remain
experimental controls rather than default recommendations.
Graph construction is supplied by dgraphs or by explicit
adj.list/weight.list payloads. Coordinate MALPS paths and
graph-geodesic payload validation are package-local; shortest-path distances
are computed through dgraphs.
A list of class "malps" with fitted values, local model
coefficients, supports, averaging weights, diagnostics, and selection
metadata.
First fit: supply X, y, degree, and support.type with a suitable
support.size or radius. Coordinate-distance fits support new predictions.
Selection: support and degree grids, foldid, and cv.folds govern
held-out selection. Robust refits recompute residual weights; selection is
not automatically repeated by refit.
Geometry: support.metric, graph inputs, anchors, and chart controls
determine the local models. Graph-geodesic fits require aligned vertices
and do not currently predict at new targets.
Numerics: local.solver, conditioning controls, and robust weighting
have distinct meanings. Keep their defaults until diagnostics identify a need.
Diagnostics: inspect selected, model weights, and stored local fits.
smoother.matrix allocates a dense matrix and applies only to fixed
weighting; its max.n guard makes that cost explicit.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 8L) head(fit$fitted.values)X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 8L) head(fit$fitted.values)
Estimate a conditional mean by weighted least squares with an unnormalized graph Laplacian penalty. Repeated observations at a vertex remain separate. Unobserved components return NA rather than an arbitrary constant.
fit.masked.graph.field(operator, vertex, y, lambda, weights = NULL)fit.masked.graph.field(operator, vertex, y, lambda, weights = NULL)
operator |
An unnormalized |
vertex |
Integer vertex index for each observed response. |
y |
Finite numeric observed responses (no missing-value placeholders). |
lambda |
Positive smoothing parameter. |
weights |
Positive observation weights; normalized to sum to one. |
A list with vertex fitted values, support flags, observation weights, objective, and relative linear-system residual.
Fits graph-spectral low-pass regression on a supplied graph by transforming metric edge lengths into conductances and smoothing the response in the eigenbasis of the weighted graph Laplacian.
fit.metric.graph.lowpass( adj.list, weight.list, y, conductance.rule = c("inverse.length.power", "exp.length", "exp.length.squared", "self.tuned.gaussian"), conductance.epsilon = 1e-08, conductance.alpha = 1, conductance.sigma = NULL, conductance.sigma.rule = c("edge.quantile", "median", "local.k"), conductance.sigma.quantile = 0.75, conductance.local.k = 5L, laplacian.type = c("unnormalized", "symmetric.normalized"), n.eigenpairs = 50L, filter.type = c("heat_kernel", "tikhonov", "cubic_spline", "gaussian", "exponential", "butterworth"), eta.grid = NULL, n.candidates = 40L, eigen.solver = c("auto", "sparse", "dense"), dense.eigen.threshold = 200L, dense.fallback.threshold = 5000L, dense.fallback = c("auto", "never", "always"), verbose = FALSE, eta.search = c("fixed", "guarded.gcv"), eta.expansion.factor = 3, eta.max.expansions = 3L, eta.identity.departure = 0.01, eta.truncation.tol = 1e-04 )fit.metric.graph.lowpass( adj.list, weight.list, y, conductance.rule = c("inverse.length.power", "exp.length", "exp.length.squared", "self.tuned.gaussian"), conductance.epsilon = 1e-08, conductance.alpha = 1, conductance.sigma = NULL, conductance.sigma.rule = c("edge.quantile", "median", "local.k"), conductance.sigma.quantile = 0.75, conductance.local.k = 5L, laplacian.type = c("unnormalized", "symmetric.normalized"), n.eigenpairs = 50L, filter.type = c("heat_kernel", "tikhonov", "cubic_spline", "gaussian", "exponential", "butterworth"), eta.grid = NULL, n.candidates = 40L, eigen.solver = c("auto", "sparse", "dense"), dense.eigen.threshold = 200L, dense.fallback.threshold = 5000L, dense.fallback = c("auto", "never", "always"), verbose = FALSE, eta.search = c("fixed", "guarded.gcv"), eta.expansion.factor = 3, eta.max.expansions = 3L, eta.identity.departure = 0.01, eta.truncation.tol = 1e-04 )
adj.list |
List of integer neighbor vectors using 1-based vertex indices. |
weight.list |
List of positive metric edge lengths parallel to
|
y |
Numeric response vector of length |
conductance.rule |
Character scalar. One of
|
conductance.epsilon |
Positive numeric regularizer used by inverse-power conductances and as a local-scale floor. |
conductance.alpha |
Positive numeric exponent for
|
conductance.sigma |
Optional positive global scale for exponential rules.
If |
conductance.sigma.rule |
Rule for selecting a global scale when needed. |
conductance.sigma.quantile |
Quantile used when
|
conductance.local.k |
Positive integer local incident-edge order
statistic for |
laplacian.type |
Laplacian operator. |
n.eigenpairs |
Positive integer number of eigenpairs to compute. |
filter.type |
Spectral low-pass filter family. |
eta.grid |
Optional numeric eta grid. Values must be positive except
for |
n.candidates |
Number of eta candidates when |
eigen.solver |
|
dense.eigen.threshold |
Exact dense threshold for auto mode. Default
|
dense.fallback.threshold |
Maximum graph size for emergency dense fallback when sparse decomposition fails and fallback is allowed. |
dense.fallback |
|
verbose |
Logical. Reserved for future diagnostic messages. |
eta.search |
Heat-time search controller. |
eta.expansion.factor |
Geometric divisor used by guarded GCV lower-time expansion. |
eta.max.expansions |
Maximum number of guarded GCV lower-time extensions. |
eta.identity.departure |
Smallest allowed departure from the identity at the largest retained graph-Laplacian eigenvalue. |
eta.truncation.tol |
Omitted-mode attenuation tolerance used to certify guarded proposals for a truncated basis. |
A list of class "metric.graph.lowpass.fit".
Gajer, P. and Ravel, J. (2025). Adaptive geometric regression for high-dimensional structured data. arXiv:2511.03817. doi:10.48550/arXiv.2511.03817
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) fit.metric.graph.lowpass( adj, lengths, y = c(0, 0.2, 1.8, 2), n.eigenpairs = 4L, eta.grid = c(0.1, 1), eigen.solver = "dense" )adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) fit.metric.graph.lowpass( adj, lengths, y = c(0, 0.2, 1.8, 2), n.eigenpairs = 4L, eta.grid = c(0.1, 1), eigen.solver = "dense" )
Experimental R reference implementation of prediction-synchronized local polynomial smoothing (PS-LPS). For fixed local polynomial parameters, PS-LPS fits one local polynomial chart per anchor and adds a quadratic penalty that synchronizes chart predictions on overlap points.
fit.ps.lps( X, y, foldid = NULL, support.size = NULL, degree = 2L, kernel = "gaussian", chart.dim = NULL, support.grid = NULL, degree.grid = NULL, kernel.grid = NULL, auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), chart.dim.grid = NULL, selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.dim.max = NULL, design.margin = 2L, lambda.sync.grid = c(0, 0.001, 0.01, 0.1, 1, 10), lambda.sync.search = c("grid", "guarded"), lambda.sync.selection = c("cv", "fixed"), local.candidate.search = c("screened", "full", "subgrid"), local.candidate.search.control = list(), lambda.sync.search.control = list(), lambda.diagnostics = c("all", "selected"), lambda.ridge = 1e-08, design.basis = c("monomial", "weighted.qr", "weighted.qr.drop", "orthogonal.polynomial.drop"), design.drop.tol = sqrt(.Machine$double.eps), ridge.multiplier.grid = NULL, ridge.condition.max = Inf, sync.neighbor.size = NULL, overlap.weight = c("normalized.product", "product"), chart.activation = c("none", "subject.od"), chart.activation.response = NULL, chart.activation.control = list(), ps.lps.geometry.cache = NULL, ps.lps.local.pca.supports = NULL, cv.folds = 5L, cv.seed = 1L )fit.ps.lps( X, y, foldid = NULL, support.size = NULL, degree = 2L, kernel = "gaussian", chart.dim = NULL, support.grid = NULL, degree.grid = NULL, kernel.grid = NULL, auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), chart.dim.grid = NULL, selection.strategy = c("grid", "sparse_kd", "plateau_kd"), chart.dim.max = NULL, design.margin = 2L, lambda.sync.grid = c(0, 0.001, 0.01, 0.1, 1, 10), lambda.sync.search = c("grid", "guarded"), lambda.sync.selection = c("cv", "fixed"), local.candidate.search = c("screened", "full", "subgrid"), local.candidate.search.control = list(), lambda.sync.search.control = list(), lambda.diagnostics = c("all", "selected"), lambda.ridge = 1e-08, design.basis = c("monomial", "weighted.qr", "weighted.qr.drop", "orthogonal.polynomial.drop"), design.drop.tol = sqrt(.Machine$double.eps), ridge.multiplier.grid = NULL, ridge.condition.max = Inf, sync.neighbor.size = NULL, overlap.weight = c("normalized.product", "product"), chart.activation = c("none", "subject.od"), chart.activation.response = NULL, chart.activation.control = list(), ps.lps.geometry.cache = NULL, ps.lps.local.pca.supports = NULL, cv.folds = 5L, cv.seed = 1L )
X |
Numeric covariate matrix. |
y |
Numeric response vector. |
foldid |
Optional integer cross-validation fold assignment. |
support.size |
Optional single neighborhood size for the fixed local
setup path. Use |
degree |
Single local polynomial degree for the fixed local setup path.
Use |
kernel |
Single kernel name for the fixed local setup path. Use
|
chart.dim |
Chart dimension for the local PCA charts. A scalar fixes
one dimension for all anchors; an integer vector supplies one local chart
dimension per anchor. The special value |
support.grid |
Candidate neighborhood sizes. When supplied, PS-LPS
selects over support size, degree, kernel, and synchronization strength by
materialized-fold CV. If both |
degree.grid |
Candidate local polynomial degrees for grid selection.
Defaults to the scalar |
kernel.grid |
Candidate kernels for grid selection. Defaults to the
scalar |
auto.chart.support.metric |
Support system used when
|
auto.chart.selection.metric |
Which auto chart-dimension diagnostic to select when both diagnostics are requested. |
chart.dim.grid |
Optional candidate chart dimensions for experimental
local-candidate selection. Numeric grids can be evaluated with
|
selection.strategy |
Candidate-selection strategy. |
chart.dim.max |
Optional explicit maximum chart dimension for the sparse coupled candidate family. |
design.margin |
Nonnegative integer feasibility margin used to screen local polynomial design size before candidate evaluation. |
lambda.sync.grid |
Candidate synchronization strengths. |
lambda.sync.search |
Lambda-search policy. |
lambda.sync.selection |
Lambda-selection mode. |
local.candidate.search |
Local-candidate search policy when
|
local.candidate.search.control |
Optional list controlling screened
local-candidate search. Supported fields are |
lambda.sync.search.control |
Optional list controlling guarded search.
Supported fields are |
lambda.diagnostics |
Lambda-diagnostic evaluation policy.
|
lambda.ridge |
Nonnegative scale-relative ridge used in the chart
coefficient solve. Use |
design.basis |
Local polynomial design backend. See
|
design.drop.tol |
Relative QR tolerance used by
|
ridge.multiplier.grid |
Optional nonnegative ridge multipliers for
adaptive scale-relative ridge selection. When supplied, the solver uses the
smallest multiplier whose penalized normal equations pass
|
ridge.condition.max |
Maximum allowed condition number for adaptive
ridge selection. Use |
sync.neighbor.size |
Number of nearby anchor pairs considered for synchronization from each anchor support. |
overlap.weight |
Overlap weighting rule. |
chart.activation |
Optional sparse-response chart activation rule.
|
chart.activation.response |
Optional nonnegative vector used only for
|
chart.activation.control |
List controlling sparse chart activation;
see |
ps.lps.geometry.cache |
Optional precomputed geometry cache used by
occupation-density cross-validation. This is an implementation detail;
ordinary callers should leave it as |
ps.lps.local.pca.supports |
Optional precomputed local-PCA supports used
when activation-specific frames must be rebuilt. This is an implementation
detail; ordinary callers should leave it as |
cv.folds |
Number of folds when |
cv.seed |
Fold seed when |
A list with fitted values, selected lambda, CV table, diagnostics, and fitted chart coefficients.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit.ps.lps( X, sin(2 * pi * X[, 1]), support.size = 7L, degree = 1L, chart.dim = 1L, lambda.sync.grid = 0, lambda.sync.selection = "fixed", cv.folds = 2L )X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit.ps.lps( X, sin(2 * pi * X[, 1]), support.size = 7L, degree = 1L, chart.dim = 1L, lambda.sync.grid = 0, lambda.sync.selection = "fixed", cv.folds = 2L )
Fits experimental PTTF regression models from a transported difference
operator produced by pttf.operator. The implementation focuses
on one response vector and explicit operator-row policies, especially the
1-D boundary policy used to separate interior transported rows from endpoint
rows.
fit.pttf.trend.filtering( geometry = NULL, operator = NULL, X = NULL, y, derivative.order = 3L, penalty = c("l1", "l2"), lambda.grid = NULL, lambda.selection = c("cv", "fixed"), n.lambda = 80L, nfolds = 5L, foldid = NULL, cv.loss = c("mse", "mae"), selection = c("min", "one.se"), lambda.extension = c("none", "auto"), solver = c("genlasso", "admm", "auto"), operator.row.policy = c("all", "drop.line.boundary", "diagnostic.only"), line.order = NULL, boundary.trim = NULL, row.mass.rule = c("none", "node.mass"), row.normalize = c("none", "l2"), weights = NULL, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, admm.rho = NULL, admm.maxiter = 2000L, admm.abstol = 1e-04, admm.reltol = 0.001, verbose = FALSE, admm.adaptive.rho = TRUE, ... )fit.pttf.trend.filtering( geometry = NULL, operator = NULL, X = NULL, y, derivative.order = 3L, penalty = c("l1", "l2"), lambda.grid = NULL, lambda.selection = c("cv", "fixed"), n.lambda = 80L, nfolds = 5L, foldid = NULL, cv.loss = c("mse", "mae"), selection = c("min", "one.se"), lambda.extension = c("none", "auto"), solver = c("genlasso", "admm", "auto"), operator.row.policy = c("all", "drop.line.boundary", "diagnostic.only"), line.order = NULL, boundary.trim = NULL, row.mass.rule = c("none", "node.mass"), row.normalize = c("none", "l2"), weights = NULL, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, admm.rho = NULL, admm.maxiter = 2000L, admm.abstol = 1e-04, admm.reltol = 0.001, verbose = FALSE, admm.adaptive.rho = TRUE, ... )
geometry |
Optional |
operator |
Optional |
X |
Optional data matrix used to build |
y |
Numeric response vector. |
derivative.order |
Integer derivative order passed to
|
penalty |
|
lambda.grid |
Optional lambda grid. Required for
|
lambda.selection |
|
n.lambda |
Number of lambdas in a generated grid. |
nfolds |
Number of folds used only when |
foldid |
Optional integer fold assignments. Validation lanes should pass
a materialized |
cv.loss |
Cross-validation loss, |
selection |
Lambda selection rule, |
lambda.extension |
Currently recorded as metadata; no extension heuristic is implemented. |
solver |
L1 solver backend. |
operator.row.policy |
Which operator rows to use for fitting. |
line.order |
Vertex order for 1-D boundary-row policies. |
boundary.trim |
Number of endpoint ranks to drop for
|
row.mass.rule, row.normalize
|
Passed to |
weights |
Optional nonnegative observation weights. |
maxsteps, minlam, approx, rtol, btol, eps
|
Genlasso controls for L1 fits. |
admm.rho, admm.maxiter, admm.abstol, admm.reltol
|
ADMM controls used when
the L1 backend is |
verbose |
Logical. |
admm.adaptive.rho |
Logical; adapt the ADMM penalty during the initial
iterations. Set |
... |
Additional arguments passed to |
A list of class "pttf.trend.filtering.fit".
n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) geometry <- pttf.geometry( X, adj, lengths, graph = "supplied", tangent.dim = 1L ) operator <- pttf.operator(geometry, derivative.order = 2L) fit.pttf.trend.filtering( operator = operator, y = sin(2 * pi * X[, 1]), penalty = "l2", lambda.grid = 0.1, lambda.selection = "fixed" )n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) geometry <- pttf.geometry( X, adj, lengths, graph = "supplied", tangent.dim = 1L ) operator <- pttf.operator(geometry, derivative.order = 2L) fit.pttf.trend.filtering( operator = operator, y = sin(2 * pi * X[, 1]), penalty = "l2", lambda.grid = 0.1, lambda.selection = "fixed" )
Fits the fixed-operator S-LPL-TF estimator
fit.slpl.tf( X = NULL, y, operator = NULL, lambda1 = NULL, lambda2 = 0, lambda1.grid = NULL, lambda2.grid = NULL, lambda.selection = c("fixed", "cv"), operator.grid = NULL, foldid = NULL, cv.folds = 5L, cv.loss = c("mse", "rmse", "mae"), cv.seed = NULL, cv.repeats = 1L, solver = c("genlasso"), selection = c("min", "one.se"), maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE, ... )fit.slpl.tf( X = NULL, y, operator = NULL, lambda1 = NULL, lambda2 = 0, lambda1.grid = NULL, lambda2.grid = NULL, lambda.selection = c("fixed", "cv"), operator.grid = NULL, foldid = NULL, cv.folds = 5L, cv.loss = c("mse", "rmse", "mae"), cv.seed = NULL, cv.repeats = 1L, solver = c("genlasso"), selection = c("min", "one.se"), maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE, ... )
X |
Optional coordinate matrix used to build
|
y |
Numeric response vector. |
operator |
Optional |
lambda1 |
Fixed LPL-TF |
lambda2 |
Fixed quadratic synchronization penalty, or a shortcut for
|
lambda1.grid |
Optional nonnegative |
lambda2.grid |
Optional nonnegative |
lambda.selection |
|
operator.grid |
Optional operator candidate grid. Supply a data frame with one row per candidate or a list of named lists. |
foldid |
Optional deterministic fold assignments for CV. |
cv.folds |
Number of generated folds when |
cv.loss |
Cross-validation loss, |
cv.seed |
Optional seed for reproducible generated folds. |
cv.repeats |
Number of CV repeats. The current implementation supports only one repeat. |
solver |
Current implementation supports only |
selection |
Selection rule, |
maxsteps, minlam, approx, rtol, btol, eps
|
Genlasso controls. |
verbose |
Logical. |
... |
Additional arguments passed to |
A list of class "slpl_tf".
if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit.slpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda1 = 0.1, lambda2 = 0, lambda.selection = "fixed") }if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit.slpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda1 = 0.1, lambda2 = 0, lambda.selection = "fixed") }
Fits an -adaptive SSRHE Hessian comparator using the row
operator from ssrhe.hessian.operator:
fit.ssrhe.hessian.l1.regression( X, y, k = NULL, tangent.dim, lambda.grid = NULL, lambda.selection = c("cv", "fixed"), weights = NULL, n.lambda = 40L, nfolds = 5L, fold.id = NULL, loss = c("mse", "mae"), selection = c("min", "one.se"), nn.index = NULL, neighborhood.type = c("knn", "adaptive.radius", "supplied"), support.index = NULL, adaptive.k.scale = NULL, radius.rule = c("geomean", "max", "min"), radius.factor = 1.25, min.support = NULL, max.support = NULL, support.buffer = 2L, support.topup = c("nearest", "none"), tangent.dim.rule = c("fixed", "eigen.cumulative"), eigen.tolerance = 0.95, derivative.order = 2L, pinv.tol = sqrt(.Machine$double.eps), local.solver = c("auto", "normal.equations", "svd", "qr"), normal.equations.max.condition = 10000, solver = c("genlasso", "admm", "auto"), row.scaling = c("none", "l2"), admm.rho = NULL, admm.maxiter = 2000L, admm.abstol = 1e-06, admm.reltol = 1e-05, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, support.selection = c("rule", "cv"), support.grid = NULL, support.cv.max.candidates = 8L, return.local.diagnostics = FALSE, return.timing = FALSE, verbose = FALSE, admm.adaptive.rho = TRUE )fit.ssrhe.hessian.l1.regression( X, y, k = NULL, tangent.dim, lambda.grid = NULL, lambda.selection = c("cv", "fixed"), weights = NULL, n.lambda = 40L, nfolds = 5L, fold.id = NULL, loss = c("mse", "mae"), selection = c("min", "one.se"), nn.index = NULL, neighborhood.type = c("knn", "adaptive.radius", "supplied"), support.index = NULL, adaptive.k.scale = NULL, radius.rule = c("geomean", "max", "min"), radius.factor = 1.25, min.support = NULL, max.support = NULL, support.buffer = 2L, support.topup = c("nearest", "none"), tangent.dim.rule = c("fixed", "eigen.cumulative"), eigen.tolerance = 0.95, derivative.order = 2L, pinv.tol = sqrt(.Machine$double.eps), local.solver = c("auto", "normal.equations", "svd", "qr"), normal.equations.max.condition = 10000, solver = c("genlasso", "admm", "auto"), row.scaling = c("none", "l2"), admm.rho = NULL, admm.maxiter = 2000L, admm.abstol = 1e-06, admm.reltol = 1e-05, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, support.selection = c("rule", "cv"), support.grid = NULL, support.cv.max.candidates = 8L, return.local.diagnostics = FALSE, return.timing = FALSE, verbose = FALSE, admm.adaptive.rho = TRUE )
X |
Numeric matrix with one observation per row. Distances for the default neighborhood search are Euclidean distances in these coordinates. |
y |
Numeric response vector of length |
k |
Integer number of nearest neighbors per point, including the point
itself, used when |
tangent.dim |
Integer tangent dimension used for the local PCA chart.
Required when |
lambda.grid |
Optional nonnegative lambda grid. For
|
lambda.selection |
|
weights |
Optional nonnegative observation weights. Missing responses automatically receive zero weight. |
n.lambda |
Number of default lambda candidates when
|
nfolds |
Number of validation folds over observed positive-weight
labels. Ignored when |
fold.id |
Optional integer fold assignments of length |
loss |
Validation loss, currently |
selection |
Selection rule. |
nn.index |
Optional integer matrix of neighbor indices, with
|
neighborhood.type |
Local support rule. |
support.index |
Optional list of integer vectors, one per row of
|
adaptive.k.scale |
Integer local-scale k used by
|
radius.rule, radius.factor
|
Adaptive-radius graph parameters passed to
|
min.support |
Optional minimum local support size for adaptive-radius
supports. Defaults to the local quadratic design size plus
|
max.support |
Optional maximum local support size. Oversized adaptive
supports are trimmed to the closest |
support.buffer |
Nonnegative integer added to the local quadratic design
size when choosing the default |
support.topup |
How undersized adaptive-radius supports are enlarged.
|
tangent.dim.rule |
Either |
eigen.tolerance |
Cumulative local PCA variance threshold used when
|
derivative.order |
Integer derivative order of the local SSRHE-style
operator. |
pinv.tol |
Nonnegative tolerance multiplier for local pseudoinverses. |
local.solver |
Local least-squares backend used to map local function
values to derivative coefficients. |
normal.equations.max.condition |
Positive condition-number guard used
by |
solver |
Solver backend. |
row.scaling |
Optional row scaling for the penalty matrix before
solving. |
admm.rho, admm.maxiter, admm.abstol, admm.reltol
|
ADMM controls used by
all backends, including refinement of generalized-lasso candidates.
|
maxsteps, minlam, approx, rtol, btol, eps, verbose
|
Controls passed to genlasso. |
support.selection |
Support-profile selection rule.
|
support.grid |
Optional data frame of support profiles with columns
|
support.cv.max.candidates |
Maximum number of support profiles to try
when |
return.local.diagnostics |
Logical. If |
return.timing |
Logical. If |
admm.adaptive.rho |
Logical; adapt the algorithm penalty during the
first 1000 iterations by balancing tolerance-normalized primal and dual
residuals. Set |
This function exposes the SSRHE local polynomial derivative estimator as an
penalty, rather than as the original SSRHE
Hessian-energy penalty used by
fit.ssrhe.hessian.regression. With
derivative.order = 2L, contains local quadratic/Hessian rows.
With derivative.order = 3L, contains local cubic
third-derivative tensor rows with the same symmetric component scaling used
by ssrhe.hessian.operator. The existing fit
solves a linear system involving . This function instead
keeps the rows of and penalizes their absolute values. It is
therefore closer in spirit to graph trend filtering, while retaining SSRHE's
local-PCA derivative construction.
The default solver backend is genlasso. For larger or numerically
fragile third-order operators, solver = "admm" fits the requested
lambda values directly without computing a generalized-lasso path, and
all backends use ADMM for the returned coefficients. solver = "auto"
can additionally recover from path construction errors with an explicit grid.
Cross-validation removes held-out labels
from the data-fit term by setting their weights to zero, then scores
predictions on those held-out labels.
ADMM uses proximal numerical stabilization, which does not add a ridge
penalty to the requested objective. Convergence requires primal feasibility,
the dual stopping residual, and stationarity of the original weighted L1
objective to meet their reported tolerances. A finite fixed-lambda iterate
that reaches its cap is returned with a warning and
solver$converged = FALSE; it is not a completed fit. Inspect
solver$admm before using it, and consider a larger iteration limit
or an adaptive penalty. Non-finite selected fits are errors.
CV candidates are eligible only when every fold has an acceptable solve.
ADMM iterates that do not converge are not scored. The CV result retains
fold.status, fold.converged, fold.diagnostics,
n.successful.folds, and eligible. If no candidate qualifies,
an error of class ssrhe_l1_cv_error retains fold diagnostics for
inspection with tryCatch. A selected full-data ADMM fit that fails
to converge is also an error in CV mode.
A generalized-lasso path alone can be inaccurate for nearly rank-deficient
operators. It is retained in path for diagnostics, but its coefficients
are not the returned fit. solver$backend = "genlasso_admm_refined"
identifies this route; solver$path.objective records the unrefined
objectives at the grid values. Backend warnings, including its numerical
ridge for underdetermined designs, are retained in solver$warnings.
CV uses the original objective without that additional ridge. The default
ADMM tolerances are absolute 1e-6 and relative 1e-5; convergence
describes numerical stopping at those tolerances, not predictive accuracy.
With row.scaling = "l2", the reported objective uses the scaled
penalty; energies$penalty.l1 is that penalty norm, while
energies$hessian.l1 retains the unscaled operator norm.
With support.selection = "cv", each adaptive-radius support candidate
builds a fresh SSRHE operator and runs the usual lambda CV with shared fold
assignments. The selected fit is the candidate with the smallest selected CV
error. This is useful when the default support-size rule is too rigid, but it
can be much slower than tuning lambda for one fixed operator.
A list of class "ssrhe.hessian.l1.fit" containing fitted
values, residuals, selected lambda, the SSRHE operator, generalized-lasso
path metadata, lambda-grid fitted values, and CV diagnostics when
requested.
First fit: specify X, y, k, tangent.dim, and lambda.grid.
For a single supplied penalty set lambda.selection = "fixed" and
solver = "admm" to avoid constructing a path.
Selection: fold.id, nfolds, loss, and selection control label CV.
A grid requires one solve per penalty per fold; support CV also rebuilds
geometry. Incomplete candidates are excluded, not silently scored.
Geometry: neighborhood, tangent and derivative controls define A.
row.scaling changes the penalty itself and thus the statistical objective.
Numerics: admm.* controls stopping and algorithmic penalties for all
backends. Path controls (maxsteps, rtol, btol, eps) affect the optional
proposal path. They do not certify the final original-objective solve.
Diagnostics: solver$admm, candidate/fold status and objective components
describe numerical acceptance. path and beta.grid can use substantial
memory; use a compact explicit grid with ADMM when no full path is needed.
Kim, K. I., Steinke, F., and Hein, M. (2009). Semi-supervised regression using Hessian energy with an application to semi-supervised dimensionality reduction. Advances in Neural Information Processing Systems 22. https://papers.nips.cc/paper_files/paper/2009/hash/f4552671f8909587cf485ea990207f3b-Abstract.html
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit.ssrhe.hessian.l1.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda.grid = 0.05, lambda.selection = "fixed", solver = "admm" )X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit.ssrhe.hessian.l1.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda.grid = 0.05, lambda.selection = "fixed", solver = "admm" )
Fits the Hessian-energy regularized estimator associated with
ssrhe.hessian.operator. This is a direct SSRHE-style
comparator for Hessian smoothing on point clouds; it is not a replacement
for graph trend-filtering regression and is distinct from
-adaptive graph trend filtering.
fit.ssrhe.hessian.regression( X, y, k = NULL, tangent.dim, lambda1, lambda2 = 0, weights = NULL, nn.index = NULL, neighborhood.type = c("knn", "adaptive.radius", "supplied"), support.index = NULL, adaptive.k.scale = NULL, radius.rule = c("geomean", "max", "min"), radius.factor = 1.25, min.support = NULL, max.support = NULL, support.buffer = 2L, support.topup = c("nearest", "none"), tangent.dim.rule = c("fixed", "eigen.cumulative"), eigen.tolerance = 0.95, derivative.order = 2L, stabilizer = lambda2 > 0, pinv.tol = sqrt(.Machine$double.eps), local.solver = c("auto", "normal.equations", "svd", "qr"), normal.equations.max.condition = 10000, ridge = 0, return.A = TRUE, return.local.diagnostics = FALSE, return.timing = FALSE, verbose = FALSE, lambda.selection = c("fixed", "cv", "gcv"), lambda1.grid = NULL, lambda2.grid = NULL, cv.control = list(), gcv.control = list() )fit.ssrhe.hessian.regression( X, y, k = NULL, tangent.dim, lambda1, lambda2 = 0, weights = NULL, nn.index = NULL, neighborhood.type = c("knn", "adaptive.radius", "supplied"), support.index = NULL, adaptive.k.scale = NULL, radius.rule = c("geomean", "max", "min"), radius.factor = 1.25, min.support = NULL, max.support = NULL, support.buffer = 2L, support.topup = c("nearest", "none"), tangent.dim.rule = c("fixed", "eigen.cumulative"), eigen.tolerance = 0.95, derivative.order = 2L, stabilizer = lambda2 > 0, pinv.tol = sqrt(.Machine$double.eps), local.solver = c("auto", "normal.equations", "svd", "qr"), normal.equations.max.condition = 10000, ridge = 0, return.A = TRUE, return.local.diagnostics = FALSE, return.timing = FALSE, verbose = FALSE, lambda.selection = c("fixed", "cv", "gcv"), lambda1.grid = NULL, lambda2.grid = NULL, cv.control = list(), gcv.control = list() )
X |
Numeric matrix with one observation per row. Distances for the default neighborhood search are Euclidean distances in these coordinates. |
y |
Numeric response vector of length |
k |
Integer number of nearest neighbors per point, including the point
itself, used when |
tangent.dim |
Integer tangent dimension used for the local PCA chart.
Required when |
lambda1 |
Nonnegative Hessian-energy penalty multiplier for
|
lambda2 |
Nonnegative supplemental-stabilizer multiplier for
|
weights |
Optional nonnegative observation weights. May be |
nn.index |
Optional integer matrix of neighbor indices, with
|
neighborhood.type |
Local support rule. |
support.index |
Optional list of integer vectors, one per row of
|
adaptive.k.scale |
Integer local-scale k used by
|
radius.rule, radius.factor
|
Adaptive-radius graph parameters passed to
|
min.support |
Optional minimum local support size for adaptive-radius
supports. Defaults to the local quadratic design size plus
|
max.support |
Optional maximum local support size. Oversized adaptive
supports are trimmed to the closest |
support.buffer |
Nonnegative integer added to the local quadratic design
size when choosing the default |
support.topup |
How undersized adaptive-radius supports are enlarged.
|
tangent.dim.rule |
Either |
eigen.tolerance |
Cumulative local PCA variance threshold used when
|
derivative.order |
Integer derivative order of the local SSRHE-style
operator. |
stabilizer |
Logical. If |
pinv.tol |
Nonnegative tolerance multiplier for local pseudoinverses. |
local.solver |
Local least-squares backend used to map local function
values to derivative coefficients. |
normal.equations.max.condition |
Positive condition-number guard used
by |
ridge |
Nonnegative diagonal ridge added to the linear system for numerical stabilization. |
return.A |
Logical. If |
return.local.diagnostics |
Logical. If |
return.timing |
Logical. If |
verbose |
Logical. If |
lambda.selection |
Penalty selection: |
lambda1.grid, lambda2.grid
|
Nonnegative penalty candidates for CV or
GCV. |
cv.control |
Named list used only with |
gcv.control |
Named list used only with |
For each response column, this function solves
where is the diagonal matrix of observation weights and
is ridge. Fully observed data with
lambda1 = lambda2 = ridge = 0 therefore reproduce the observed
response exactly. Missing responses are excluded from the data-fit term by
setting their weights to zero. The Matlab SSRHE semi-supervised convention is
represented by a 0/1 labeled-indicator weights vector, or
equivalently by setting unlabeled responses to NA: labeled vertices
contribute unit diagonal data-fit terms and unlabeled vertices contribute no
data-fit term.
The lower-level operator is matched to the Kim–Steinke–Hein SSRHE Matlab
construction: self-including kNN neighborhoods, local PCA charts, a
fixed-intercept local quadratic fit, doubled diagonal Hessian components,
and optional supplemental stabilizer. The package exposes both and
; the fitted estimator uses .
A list of class "ssrhe.hessian.fit" containing fitted values,
residuals, input response, weights, lambda parameters, objective/energy
diagnostics, the reused operator, solver metadata, the call, and
lambda.selection. CV adds class "ssrhe.hessian.cv.fit",
cv.table, fold.id, and selection; GCV adds class
"ssrhe.hessian.gcv.fit", gcv.table, gcv.trace, and
selection. Support searches retain selected.support and
the corresponding support.cv.table or support.gcv.table.
Fixed fitting supports response vectors or matrices. CV and GCV currently select penalties for one response vector at a time. Label CV removes each validation fold from the data-fit term and scores its held-out observed positive-weight labels. It supports missing responses. GCV requires a fully observed response and strictly positive observation weights, and minimizes
where .
The exact trace is deterministic. The Hutchinson option uses Rademacher
probes, reports trace standard errors, and is reproducible with
gcv.control = list(trace.method = "hutchinson", trace.seed = ...).
Both selection modes can also search adaptive-radius support profiles:
set support.selection to the same mode in its control list. Each row
of support.grid contains adaptive.k.scale, min.support,
and optionally max.support. A NULL grid is constructed by
ssrhe.support.grid. Each profile requires a new operator and
a full penalty search, so this can substantially increase runtime.
The former fit.ssrhe.hessian.regression.cv() and
fit.ssrhe.hessian.regression.gcv() entry points have been retired.
Use this function with lambda.selection = "cv" or "gcv".
Move fold.id to cv.control$foldid, nfolds to
cv.control$cv.folds, and loss/selection to
cv.control. Move gcv.trace.method, gcv.trace.n.probes,
and gcv.trace.seed to trace.method, trace.n.probes,
and trace.seed in gcv.control. Support search settings also
belong in the active control list; both former support candidate limits
are now named support.max.candidates.
First fit: supply X, y, neighborhood size k, tangent.dim, and
lambda1; use lambda.selection = "fixed" for a specified penalty.
Selection: lambda.selection, lambda1.grid, and lambda2.grid select
penalties. Fold settings belong in cv.control; trace settings belong in
gcv.control. Label CV and GCV are different criteria. Support selection
rebuilds the operator for each candidate and multiplies this work.
Geometry: neighborhood, adaptive-radius, tangent and derivative controls determine the operator. Reuse it when fitting multiple responses.
Numerics: ridge and local conditioning controls stabilize solves. Exact GCV traces require more solves than stochastic trace estimates; the latter report sampling uncertainty and need a reproducible probe seed.
Diagnostics: inspect the selection table, energies, observed-label mask,
and solver metadata. fitted() and residuals() preserve response matrices.
Kim, K. I., Steinke, F., and Hein, M. (2009). Semi-supervised regression using Hessian energy with an application to semi-supervised dimensionality reduction. Advances in Neural Information Processing Systems 22. https://papers.nips.cc/paper_files/paper/2009/hash/f4552671f8909587cf485ea990207f3b-Abstract.html
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit.ssrhe.hessian.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda1 = 0.1 ) fit.ssrhe.hessian.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda.selection = "cv", lambda1.grid = c(0.01, 0.1), cv.control = list(cv.folds = 2L) ) fit.ssrhe.hessian.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda.selection = "gcv", lambda1.grid = c(0.01, 0.1) )X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit.ssrhe.hessian.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda1 = 0.1 ) fit.ssrhe.hessian.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda.selection = "cv", lambda1.grid = c(0.01, 0.1), cv.control = list(cv.folds = 2L) ) fit.ssrhe.hessian.regression( X, sin(2 * pi * X[, 1]), k = 6L, tangent.dim = 1L, lambda.selection = "gcv", lambda1.grid = c(0.01, 0.1) )
Convenience wrapper that converts subject visit indices into a density
input. Density-native methods dispatch to fit.density.
LPS/PS-LPS methods fit ordinary smoother objects first and then call
normalize.density; they are subject-occupation workflows, not
standalone density-native methods.
fit.subject.od( X, subject.index, method = c("empirical", "graph_random_walk", "lps_count", "ps_lps_count", "lps_logistic_binary", "chart_kernel", "local_likelihood_density", "local_likelihood_bernoulli"), graph = NULL, graph.control = list(), od.control = list(), return.details = TRUE, od.cv = c("none", "visit"), visit.foldid = NULL, visit.cv.folds = 5L, visit.cv.seed = 1L, visit.cv.epsilon = 1e-15, ... )fit.subject.od( X, subject.index, method = c("empirical", "graph_random_walk", "lps_count", "ps_lps_count", "lps_logistic_binary", "chart_kernel", "local_likelihood_density", "local_likelihood_bernoulli"), graph = NULL, graph.control = list(), od.control = list(), return.details = TRUE, od.cv = c("none", "visit"), visit.foldid = NULL, visit.cv.folds = 5L, visit.cv.seed = 1L, visit.cv.epsilon = 1e-15, ... )
X |
Numeric matrix with one row per support point. |
subject.index |
Integer row indices of subject visits in |
method |
Density method identifier. |
graph |
Optional precomputed graph object. |
graph.control |
Named list for random walks: |
od.control |
OD-facing alias for |
return.details |
Logical; if |
od.cv |
OD-level selection mode. |
visit.foldid |
Optional positive integer vector assigning subject visits
to OD-level cross-validation folds. Its length must equal
|
visit.cv.folds |
Number of visit folds when |
visit.cv.seed |
Random seed for generated visit folds. |
visit.cv.epsilon |
Positive floor used in held-out
|
... |
Reserved for future methods; unused arguments are errors. |
The "lps_logistic_binary" method name is historical. In the current
OD workflow it calls fit.lps(..., outcome.family = "bernoulli"), which
fits a clipped probability field with the LPS least-squares core and then
converts that field to a density with normalize.density. It is
not the outcome.family = "binomial" local-logistic IRLS path.
When od.cv = "visit", graph random-walk candidates may pass
OD-level grids inside graph.control: walk.step.grid,
affinity.method.grid, affinity.scale.grid,
affinity.epsilon.grid, and normalize.grid. Missing
affinity.scale values mean the usual data-derived affinity scale.
When od.cv = "visit", chart-based and LPS-family methods may pass
chart.dim.grid through .... For "chart_kernel",
"local_likelihood_density", "local_likelihood_bernoulli",
"lps_count", "lps_logistic_binary", and
"ps_lps_count", this grid compares fixed integer chart dimensions
with optional "auto" and "local.auto" chart-dimension policies
under the same held-out-visit negative-log-occupation score. For LPS-family
OD visit CV, each outer candidate is passed to the source smoother as a
scalar local model configuration; this avoids nested row-level
multi-candidate selection inside each held-out-visit fold.
A list of class "density_fit". Its rho component is
the estimated probability mass over the rows of X, and
empirical.rho is the normalized visit-count mass. The
subject component summarizes the number of visits, the number of
distinct visited support points, the largest visit multiplicity, and the
fraction of repeatedly visited support points. Other components describe
the fitted method, normalization accounting, smoothing diagnostics, and
warnings as documented in fit.density. With
od.cv = "visit" and return.details = TRUE, the result also
contains the visit-level cross-validation table, fold assignments, and
held-out predicted masses.
X <- matrix(seq(0, 1, length.out = 6), ncol = 1) fit.subject.od(X, subject.index = c(1L, 3L, 3L, 6L), method = "empirical")X <- matrix(seq(0, 1, length.out = 6), ncol = 1) fit.subject.od(X, subject.index = c(1L, 3L, 3L, 6L), method = "empirical")
Identifies the boundary vertices of a specified region in a graph, defined as vertices in the region that have at least one neighbor outside the region.
get.region.boundary(adj.list, region)get.region.boundary(adj.list, region)
adj.list |
A list of integer vectors, where each vector contains the indices of vertices adjacent to the corresponding vertex. Indices must be 1-based. |
region |
An integer vector of vertex indices (1-based) defining the region for which to find boundary vertices. |
This function determines which vertices in a specified region are positioned at the boundary - meaning they have at least one neighbor that is not part of the region. These boundary vertices are often treated differently in graph-based algorithms, such as harmonic smoothing, where their values are typically fixed as constraints.
The boundary definition used matches the one implemented in the C++ harmonic smoothing functions, focusing on vertices that have connections to the outside of the region.
An integer vector containing the indices of the boundary vertices,
which is a subset of the input region vector. Returns an empty
integer vector if no boundary vertices exist.
perform.harmonic.smoothing, harmonic.smoother
# Create a simple grid graph adjacency list (5x5 grid) create_grid_adj_list <- function(n_rows, n_cols) { n <- n_rows * n_cols adj_list <- vector("list", n) for (i in 1:n_rows) { for (j in 1:n_cols) { v <- (i-1) * n_cols + j neighbors <- numeric(0) # Add neighbors (up, down, left, right) if (i > 1) neighbors <- c(neighbors, (i-2) * n_cols + j) # up if (i < n_rows) neighbors <- c(neighbors, i * n_cols + j) # down if (j > 1) neighbors <- c(neighbors, (i-1) * n_cols + (j-1)) # left if (j < n_cols) neighbors <- c(neighbors, (i-1) * n_cols + (j+1)) # right adj_list[[v]] <- neighbors } } return(adj_list) } # Create a 5x5 grid graph grid_adj_list <- create_grid_adj_list(5, 5) # Define a region (central 3x3 subgrid) central_region <- c(7:9, 12:14, 17:19) # Find boundary vertices of the central region boundary <- get.region.boundary(grid_adj_list, central_region) print(boundary) # Expected output: c(7, 8, 9, 12, 14, 17, 18, 19) # (all except the center vertex 13)# Create a simple grid graph adjacency list (5x5 grid) create_grid_adj_list <- function(n_rows, n_cols) { n <- n_rows * n_cols adj_list <- vector("list", n) for (i in 1:n_rows) { for (j in 1:n_cols) { v <- (i-1) * n_cols + j neighbors <- numeric(0) # Add neighbors (up, down, left, right) if (i > 1) neighbors <- c(neighbors, (i-2) * n_cols + j) # up if (i < n_rows) neighbors <- c(neighbors, i * n_cols + j) # down if (j > 1) neighbors <- c(neighbors, (i-1) * n_cols + (j-1)) # left if (j < n_cols) neighbors <- c(neighbors, (i-1) * n_cols + (j+1)) # right adj_list[[v]] <- neighbors } } return(adj_list) } # Create a 5x5 grid graph grid_adj_list <- create_grid_adj_list(5, 5) # Define a region (central 3x3 subgrid) central_region <- c(7:9, 12:14, 17:19) # Find boundary vertices of the central region boundary <- get.region.boundary(grid_adj_list, central_region) print(boundary) # Expected output: c(7, 8, 9, 12, 14, 17, 18, 19) # (all except the center vertex 13)
Builds the weighted graph difference operators used by graph trend
filtering. The default operator.family = "graph.laplacian.recursive"
uses recursive graph operators
and
The experimental operator.family = "path.divided.difference" builds
canonical path rows and computes position-aware finite differences along
graph paths using weight.list as metric edge lengths.
graph.trend.filtering.operator( adj.list, weight.list = NULL, order = 0L, weight.rule = c("conductance", "sqrt.conductance", "unit"), operator.family = c("graph.laplacian.recursive", "path.divided.difference"), path.family = c("branch.continuation", "all.simple"), path.weighting = c("unit", "anchor.mean"), return.sparse = TRUE )graph.trend.filtering.operator( adj.list, weight.list = NULL, order = 0L, weight.rule = c("conductance", "sqrt.conductance", "unit"), operator.family = c("graph.laplacian.recursive", "path.divided.difference"), path.family = c("branch.continuation", "all.simple"), path.weighting = c("unit", "anchor.mean"), return.sparse = TRUE )
adj.list |
List of integer neighbor vectors using 1-based vertex indices. The graph must be undirected: every edge must appear in both endpoint adjacency lists. |
weight.list |
Optional list of positive edge weights parallel to
|
order |
Integer trend-filtering order. Supported values are
|
weight.rule |
Character scalar. |
operator.family |
Character scalar selecting the penalty operator family.
The default |
path.family |
Character scalar used for
|
path.weighting |
Character scalar used for
|
return.sparse |
Logical. If |
A list of class "graph.trend.filtering.operator" containing
the canonical graph, edge table, trend-filtering weights, incidence,
weighted Laplacian, selected penalty operator, and nullity estimate.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) graph.trend.filtering.operator(adj, order = 1L, weight.rule = "unit")adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) graph.trend.filtering.operator(adj, order = 1L, weight.rule = "unit")
Relaxes graph values while recording changes in local extrema. Boundary vertices have neighbors outside the region and retain their original values.
harmonic.smoother( adj.list, weight.list, values, region.vertices, max.iterations = 100, tolerance = 1e-06, record.frequency = 1, stability.window = 3, stability.threshold = 0.05 )harmonic.smoother( adj.list, weight.list, values, region.vertices, max.iterations = 100, tolerance = 1e-06, record.frequency = 1, stability.window = 3, stability.threshold = 0.05 )
adj.list |
A list of integer vectors, where each vector contains indices of vertices adjacent to the corresponding vertex. Indices must be 1-based. |
weight.list |
A list of numeric vectors containing weights of edges
corresponding to adjacencies in |
values |
A numeric vector of function values defined at each vertex. |
region.vertices |
An integer vector of vertex indices (1-based) defining the region to be smoothed. Boundary vertices will have fixed values. |
max.iterations |
Integer scalar, the maximum number of relaxation iterations to perform. Default is 100. |
tolerance |
Numeric scalar, the convergence threshold for value changes. Default is 1e-6. |
record.frequency |
Integer scalar, how often to record states (every N iterations). Default is 1 (record every iteration). |
stability.window |
Integer scalar, number of consecutive recorded differences to check for extrema stability. Default is 3. |
stability.threshold |
Numeric scalar in |
Uses the same inverse-length neighbor averages and boundary definition as
perform.harmonic.smoothing. Unlike the basic function, it also
relaxes regions with no boundary. Such a problem is not uniquely anchored;
synchronous updates can oscillate on bipartite graphs, including paths.
The recorded diagnostic compares sets of (vertex, minimum/maximum) pairs.
Its value is one minus twice the number of shared pairs divided by the sum
of the two set sizes (zero for two empty sets). A detection means that the
last stability.window recorded differences are at most
stability.threshold. It does not establish numerical convergence,
optimal smoothing, noise removal, or stability of full attraction basins.
In particular, recording every two iterations can conceal an alternating
oscillation. Always inspect converged and max_residual separately.
Stability detection does not stop relaxation or select the returned fit.
The initial and final states are always recorded, including a final partial
recording interval. Disconnected components without fixed boundary values
have the same lack of anchoring as a region without a boundary.
A list of class "harmonic_smoother" containing:
harmonic_predictions |
Numeric vector of smoothed function values |
i_harmonic_predictions |
Matrix of function values at each recorded iteration (columns are iterations) |
i_basins |
List of matrices representing extrema at each iteration |
stable_iteration |
First iteration with a detected extrema-stability
window, or |
stability_detected |
Whether an extrema-stability window was detected |
num_iterations, recorded_iterations
|
Number of relaxation updates and their actual indices for the recorded columns, starting at zero |
max_change, max_residual
|
Per-update maximum change and harmonic
residual. Both must fall below |
status |
|
topology_differences |
Numeric vector of differences between consecutive recorded iterations |
basin_cx_differences |
Alias of |
converged |
Logical indicator of whether the relaxation converged |
num_region, num_boundary, num_interior
|
Vertex counts for the requested region and its boundary/interior split |
perform.harmonic.smoothing for basic smoothing,
plot.harmonic_smoother for visualization methods,
summary.harmonic_smoother for summary statistics
adj.list <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weight.list <- list(1, c(1, 1), c(1, 1), 1) values <- c(0, 2, -1, 1) result <- harmonic.smoother( adj.list, weight.list, values, region.vertices = seq_along(values), max.iterations = 20, record.frequency = 2 ) smoothed.values <- result$harmonic_predictions smoothed.valuesadj.list <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weight.list <- list(1, c(1, 1), c(1, 1), 1) values <- c(0, 2, -1, 1) result <- harmonic.smoother( adj.list, weight.list, values, region.vertices = seq_along(values), max.iterations = 20, record.frequency = 2 ) smoothed.values <- result$harmonic_predictions smoothed.values
Builds the Local Polynomial Lifting Trend Filtering (LPL-TF) analysis
operator from local polynomial prediction residuals. For each observed
target point , the operator predicts
from nearby values using a local polynomial model and
stores the residual row
lpl.tf.operator( X, adj.list = NULL, weight.list = NULL, graph = NULL, graph.stage = "final", anchor.index = NULL, anchor.coordinates = NULL, degree = 2L, support.type = c("adaptive.radius", "knn", "fixed.radius"), support.size = NULL, radius = NULL, min.support = NULL, support.buffer = 3L, kernel = c("epanechnikov", "triangular", "gaussian", "tricube"), coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, support.metric = c("auto", "coordinates", "graph.geodesic"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), exclude.self = TRUE, row.normalize = c("l2", "none", "l1"), local.solver = c("auto", "normal.equations", "qr", "svd"), normal.equations.max.condition = 1e+08, duplicate.action = c("keep", "error"), drop.rank.deficient = TRUE, verbose = FALSE, ... )lpl.tf.operator( X, adj.list = NULL, weight.list = NULL, graph = NULL, graph.stage = "final", anchor.index = NULL, anchor.coordinates = NULL, degree = 2L, support.type = c("adaptive.radius", "knn", "fixed.radius"), support.size = NULL, radius = NULL, min.support = NULL, support.buffer = 3L, kernel = c("epanechnikov", "triangular", "gaussian", "tricube"), coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, support.metric = c("auto", "coordinates", "graph.geodesic"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), exclude.self = TRUE, row.normalize = c("l2", "none", "l1"), local.solver = c("auto", "normal.equations", "qr", "svd"), normal.equations.max.condition = 1e+08, duplicate.action = c("keep", "error"), drop.rank.deficient = TRUE, verbose = FALSE, ... )
X |
Numeric coordinate matrix with one row per observation. |
adj.list, weight.list
|
Optional supplied undirected graph adjacency and positive edge-length lists using 1-based vertex indices. |
graph |
Optional graph object returned by
|
graph.stage |
Graph stage to extract from |
anchor.index |
Optional integer vector of observed anchor/target indices. The current implementation supports observed anchors only. |
anchor.coordinates |
Reserved for later off-observation anchors; this
implementation requires |
degree |
Polynomial degree. The current implementation supports
|
support.type |
Coordinate support rule. |
support.size |
Positive integer for |
radius |
Positive coordinate radius for
|
min.support |
Minimum number of positive-weight predictors after self
exclusion. If |
support.buffer |
Nonnegative integer added to the local polynomial design size when choosing default supports. |
kernel |
Kernel used to weight local predictors by distance. |
coordinate.method |
Coordinate chart used for the local polynomial
design. |
chart.dim |
Chart dimension. For |
support.metric |
Support-distance rule. |
auto.chart.support.metric |
Support system used when
|
auto.chart.selection.metric |
Which auto chart-dimension diagnostic to
use for the fitted operator when |
exclude.self |
Logical. LPL-TF residual rows require |
row.normalize |
Complete-row normalization rule applied after setting
target coefficient |
local.solver |
Local linear algebra rule. |
normal.equations.max.condition |
Maximum condition number for
|
duplicate.action |
Duplicate coordinate policy. |
drop.rank.deficient |
Logical. The current implementation requires
|
verbose |
Logical. Reserved for diagnostic messages. |
... |
Reserved. |
The operator uses observed anchors, excludes the target point from every
predictor support, and drops requested-degree rank-deficient rows with
explicit metadata. There is no silent degree downgrade. Graph support
distances affect support selection and kernel bandwidths only; local
polynomial coordinates are controlled separately by coordinate.method.
Graph construction is supplied by dgraphs or by explicit
adj.list/weight.list payloads. Coordinate support paths and
graph-geodesic payload validation are package-local; shortest-path distances
are computed through dgraphs.
If is the complete assembled residual row, then
row.normalize = "l2" uses , and
row.normalize = "l1" uses . Normalization is
applied to the whole row, not only to predictor coefficients.
A list of class "lpl_tf_operator" containing the sparse
operator matrix A, row metadata, supports, local design summaries,
diagnostics, settings, and the matched call.
X <- matrix(seq(0, 1, length.out = 18), ncol = 1) lpl.tf.operator(X, degree = 1L, support.type = "knn", support.size = 7L, kernel = "gaussian")X <- matrix(seq(0, 1, length.out = 18), ncol = 1) lpl.tf.operator(X, degree = 1L, support.type = "knn", support.size = 7L, kernel = "gaussian")
Builds a compact one-row diagnostic table for a fitted local polynomial smoother. The table records the requested backend, the backend actually used, the requested chart-dimension rule, the resolved chart dimension, selected tuning parameters, and whether the fit follows the current deployable local-PCA auto-dimension contract.
lps.backend.diagnostics(object)lps.backend.diagnostics(object)
object |
A fitted |
The current backend policy is conservative: backend = "auto" uses the
C++ backend for ambient-coordinate LPS, but uses the R reference backend for
coordinate.method = "local.pca". The native local-PCA backend
"cpp.local.pca" remains an explicit opt-in backend. This helper
makes that policy visible in reports and downstream experiment manifests
without changing the default.
For real-data local-PCA runs, the deployable chart-dimension contract is
the ordinary local.chart.method = "pca" path with
chart.dim = "auto" or "local.auto" and observed-covariate
auto-dimension diagnostics.
In P7-style experiments this is paired with
auto.chart.support.metric = "both" and
auto.chart.selection.metric = "operator". The experimental
"second.order.svd" chart path is reported explicitly but is not
certified by this deployable local-PCA contract. For LPS itself, which uses
coordinate supports, the operator-support diagnostic is currently equivalent
to the coordinate-support diagnostic; the fields are still recorded so the
same manifest schema can be shared with LPL-TF and S-LPL-TF experiments.
A one-row data.frame with backend, chart-dimension, selection,
candidate-count, and policy fields.
X <- matrix(seq(0, 1, length.out = 16), ncol = 1) fit <- fit.lps(X, X[, 1]^2, support.grid = 6L, degree.grid = 1L, kernel.grid = "gaussian", cv.folds = 2L, backend = "R") lps.backend.diagnostics(fit)X <- matrix(seq(0, 1, length.out = 16), ncol = 1) fit <- fit.lps(X, X[, 1]^2, support.grid = 6L, degree.grid = 1L, kernel.grid = "gaussian", cv.folds = 2L, backend = "R") lps.backend.diagnostics(fit)
Assigns whole clusters to cross-validation folds so that no cluster is
split across folds: every observation of a cluster receives the same fold
id, and therefore no training set ever shares a cluster with the fold held
out against it. Folds are built by a deterministic size-balanced greedy
rule: clusters are taken largest first (ties by first appearance in
cluster.id) and each is placed into the currently smallest fold
(ties by lowest fold index). With v equal to the number of
clusters this reduces to leave-cluster-out.
lps.grouped.foldid(cluster.id, v = 5L, shuffle.seed = NULL)lps.grouped.foldid(cluster.id, v = 5L, shuffle.seed = NULL)
cluster.id |
Vector of cluster labels (factor, character, or integer-like), one per observation, no missing values. |
v |
Number of folds; an integer between 2 and the number of distinct clusters. |
shuffle.seed |
Optional integer seed for a randomized cluster order;
|
The assignment is fully deterministic when shuffle.seed is
NULL. Supplying shuffle.seed applies one seeded permutation
to the cluster order before the greedy pass (the seed is consumed
immediately via set.seed), giving a reproducible randomized
variant; callers following the LPS evidence conventions should record the
seed they pass.
An integer fold-id vector of length length(cluster.id) with
values in 1:v; every fold is nonempty and every cluster maps to
exactly one fold.
lps.nested.cv() for nested cross-validation that can consume
grouped folds at both the outer and inner level.
cluster <- rep(letters[1:6], each = 2) lps.grouped.foldid(cluster, v = 3L)cluster <- rep(letters[1:6], each = 2) lps.grouped.foldid(cluster, v = 3L)
Runs outer-fold nested cross-validation around fit.lps(): for each outer
fold, candidate selection is one ordinary fit.lps call on the
inner-training rows only, with an explicit inner fold id and
X.eval set to the held-out outer-test rows, so the held-out fold
never participates in inner selection. The pooled outer-test error is the
nested generalization estimate. The same call also computes the
selected-min arm — an ordinary fit.lps on all rows using the
same outer.foldid — so optimism comparisons are paired on
one fold assignment by construction.
lps.nested.cv( X, y, outer.foldid, fit.args = list(), inner.folds = 5L, cluster.id = NULL, inner.foldid.method = c("round.robin", "grouped"), inner.shuffle.seed = NULL )lps.nested.cv( X, y, outer.foldid, fit.args = list(), inner.folds = 5L, cluster.id = NULL, inner.foldid.method = c("round.robin", "grouped"), inner.shuffle.seed = NULL )
X |
Numeric matrix of observations (rows) used for training. |
y |
Numeric response vector with |
outer.foldid |
Positive integer vector of length |
fit.args |
Named list of additional arguments passed to every
|
inner.folds |
Number of inner selection folds (integer >= 2). |
cluster.id |
Optional cluster labels (length |
inner.foldid.method |
Inner fold construction: |
inner.shuffle.seed |
Optional integer; per-fold offset seed for the randomized variants described above. Recorded in the return value. |
The existing fit.lps behavior is untouched: this utility consumes
the public API with explicit foldid only. It currently supports
outcome.family = "gaussian" (the default) and scores with RMSE.
Inner folds are built per outer fold and fully recorded in the return
value: "round.robin" assigns rep_len(1:inner.folds, n) over
the inner-training rows in row order (deterministic; if
inner.shuffle.seed is supplied, fold k — by position — uses
set.seed(inner.shuffle.seed + k) and permutes the balanced
assignment, giving a reproducible randomized variant);
"grouped" builds cluster-respecting inner folds with
lps.grouped.foldid() on the inner-training rows of cluster.id
(passing the same per-fold offset seed when inner.shuffle.seed is
supplied).
A list of class "lps_nested_cv":
nested.rmsepooled RMSE of the outer-test predictions over all rows with finite predictions.
n.missing.predictionscount of non-finite outer-test
predictions (e.g. unstable.action = "na" fallbacks).
foldsone row per outer fold: fold label, test size,
selected support.size / degree / kernel /
bandwidth.multiplier, the inner selected-min CV score, and
the fold's outer-test RMSE.
predictionslength-nrow(X) vector of outer-test
predictions (each row predicted by the fold that held it out).
selected.minthe paired selected-min arm on the same
outer.foldid: selected (the fit.lps selected
row), cv.score (its observed CV RMSE), foldid, and
fit (the full-data fit.lps object, usable for
deployment on an external test set).
outer.foldid, test.index, train.index,
inner.foldid, inner.foldid.used,
inner.cv.table
complete fold/index telemetry: the realized
inner fold ids as constructed and as recorded by each inner
fit.lps ($foldid), per-fold index sets, and each
fold's full inner CV candidate table.
outer.cluster.wholeTRUE/FALSE whether
every cluster lies wholly inside one outer fold (NA when
cluster.id is absent).
inner.folds, inner.foldid.method,
inner.shuffle.seed, fit.args, call
the recorded configuration.
lps.grouped.foldid() for the grouped fold constructor.
X <- matrix(seq(0, 1, length.out = 18), ncol = 1) y <- sin(2 * pi * X[, 1]) nested <- lps.nested.cv( X, y, outer.foldid = rep(1:3, length.out = 18), inner.folds = 2L, fit.args = list(support.grid = 6L, degree.grid = 1L, kernel.grid = "gaussian", backend = "R") ) nested$rmseX <- matrix(seq(0, 1, length.out = 18), ncol = 1) y <- sin(2 * pi * X[, 1]) nested <- lps.nested.cv( X, y, outer.foldid = rep(1:3, length.out = 18), inner.folds = 2L, fit.args = list(support.grid = 6L, degree.grid = 1L, kernel.grid = "gaussian", backend = "R") ) nested$rmse
Computes, from the analytically extracted linear-smoother matrix S of a
fixed-configuration LPS fit (see smoother.matrix()), the pointwise
variance Var(fitted_i) = sigma^2 * sum_j S_ij^2, the effective degrees of
freedom df = tr(S), the plug-in noise estimate
sigma.hat^2 = RSS / (n - 2*tr(S) + sum(S^2)), and the pointwise confidence band
fitted_i +/- z * sigma * ||S_i.||_2 with
z = qnorm(1 - (1 - level) / 2).
lps.pointwise.band( object, sigma = NULL, level = 0.95, check.tol = 1e-10, variance.method = c("residual", "legacy") )lps.pointwise.band( object, sigma = NULL, level = 0.95, check.tol = 1e-10, variance.method = c("residual", "legacy") )
object |
A fitted |
sigma |
Known noise standard deviation (positive scalar), or |
level |
Confidence level of the band, a single number strictly
between 0 and 1. Default |
check.tol |
Passed to |
variance.method |
Noise-variance denominator: |
With sigma supplied (known noise standard deviation), the band uses it
directly (sigma.source = "known"); with sigma = NULL the plug-in
sigma.hat is used (sigma.source = "plug.in"). sigma.hat is reported
in both modes. The variance is purely the linear-smoother sampling
variance: the band makes no bias correction, so where bias dominates
(boundary, high curvature) undercoverage is expected and must be reported,
not masked.
Requires X.eval identical to X (the square training-fit smoother, on
which tr(S) and RSS are defined), in addition to all restrictions of
smoother.matrix(). If any evaluation point's local fit returned NA,
its variance/band entries are NA, and df, rss, and sigma.hat are
NA as well; supplying a known sigma still yields bands at the
unaffected points.
A list of class "lps.pointwise.band" with named fields:
fitted (the fit's raw fitted values), se, variance, lower,
upper, level, z, sigma (the supplied known sigma, or NA in
plug-in mode), sigma.hat, sigma.source ("known" or "plug.in"),
df (tr(S)), residual.df, variance.method, rss, n.train, smoother.row.norm (||S_i.||_2),
and configuration (the pinned fit configuration).
set.seed(1) n <- 30 X <- matrix(runif(2 * n, -1, 1), ncol = 2) y <- sin(pi * X[, 1]) + 0.1 * rnorm(n) fit <- fit.lps(X, y, foldid = rep(1:2, length.out = n), support.grid = 12L, degree.grid = 1L, kernel.grid = "tricube", backend = "R", design.basis = "orthogonal.polynomial.drop", ridge.multiplier.grid = 0, ridge.condition.max = Inf, unstable.action = "na") band.known <- lps.pointwise.band(fit, sigma = 0.1) band.plugin <- lps.pointwise.band(fit) band.known$df band.plugin$sigma.hatset.seed(1) n <- 30 X <- matrix(runif(2 * n, -1, 1), ncol = 2) y <- sin(pi * X[, 1]) + 0.1 * rnorm(n) fit <- fit.lps(X, y, foldid = rep(1:2, length.out = n), support.grid = 12L, degree.grid = 1L, kernel.grid = "tricube", backend = "R", design.basis = "orthogonal.polynomial.drop", ridge.multiplier.grid = 0, ridge.condition.max = Inf, unstable.action = "na") band.known <- lps.pointwise.band(fit, sigma = 0.1) band.plugin <- lps.pointwise.band(fit) band.known$df band.plugin$sigma.hat
Computes effective degrees of freedom, generalized cross-validation (GCV),
and analytic leave-one-out residual diagnostics from a MALPS smoother matrix.
These diagnostics are exact for fixed-support, fixed-weight linear MALPS
fits. For cross-validated fits they are conditional on the selected support
profile. Robust fits are rejected by default for the same reason described
in smoother.matrix.
malps.gcv( object, y = NULL, smoother.matrix = NULL, include.loocv = TRUE, max.n = 1000L, allow.robust = FALSE, ... )malps.gcv( object, y = NULL, smoother.matrix = NULL, include.loocv = TRUE, max.n = 1000L, allow.robust = FALSE, ... )
object |
|
y |
Optional response vector. Defaults to |
smoother.matrix |
Optional precomputed matrix from
|
include.loocv |
Logical; include analytic leave-one-out residuals and mean squared error. |
max.n |
Maximum dense smoother size passed to
|
allow.robust |
Logical; passed to |
... |
Reserved for future extensions. |
The GCV score is computed as
The analytic leave-one-out residuals are computed as
A list with residual, fitted-value, EDF, GCV, and optional LOOCV diagnostics.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) malps.gcv(fit)$gcvX <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) malps.gcv(fit)$gcv
Materialize a synthetic-data specification
materialize.synthetic( spec, n = NULL, seed, rng.policy = c("named.stream.v1", "legacy"), validate = TRUE )materialize.synthetic( spec, n = NULL, seed, rng.policy = c("named.stream.v1", "legacy"), validate = TRUE )
spec |
A |
n |
Sample size, or |
seed |
Scalar whole-number seed. |
rng.policy |
Versioned RNG policy. |
validate |
Whether to validate the returned dataset. |
A synthetic_dataset.
spec <- synthetic.registry.spec("G1") materialize.synthetic(spec, n = 20L, seed = 1L)spec <- synthetic.registry.spec("G1") materialize.synthetic(spec, n = 20L, seed = 1L)
Materialize a frozen synthetic instance
materialize.synthetic.instance(instance.id, validate = TRUE)materialize.synthetic.instance(instance.id, validate = TRUE)
instance.id |
Frozen instance ID. |
validate |
Whether to validate and checksum the result. |
A synthetic_dataset whose dataset.id is instance.id.
materialize.synthetic.instance("geosmooth.g1.default.v1")materialize.synthetic.instance("geosmooth.g1.default.v1")
Creates a positive heat-time grid from a
"metric.graph.lowpass.basis" object.
metric.graph.heat.eta.grid( basis, rule = c("spectral_guarded", "w1_inverse_spectrum"), n.initial = 40L, include.zero = FALSE, truncation.tol = 1e-04, equilibrium.tol = 1e-04 )metric.graph.heat.eta.grid( basis, rule = c("spectral_guarded", "w1_inverse_spectrum"), n.initial = 40L, include.zero = FALSE, truncation.tol = 1e-04, equilibrium.tol = 1e-04 )
basis |
A |
rule |
Grid rule. |
n.initial |
Number of positive grid values. |
include.zero |
Logical. Include the exact no-smoothing endpoint. |
truncation.tol |
Positive tolerance smaller than one for the conservative omitted-mode attenuation bound. |
equilibrium.tol |
Positive tolerance smaller than one for the slowest positive retained mode at the upper endpoint. |
A numeric vector with grid-construction metadata stored as attributes.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) basis <- metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense") metric.graph.heat.eta.grid(basis, n.initial = 6L)adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) basis <- metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense") metric.graph.heat.eta.grid(basis, n.initial = 6L)
Proposes one lower positive heat time after an external search controller has classified the current lower endpoint. The helper enforces a geometric expansion step, an identity-departure floor, a maximum number of expansion rounds, and the truncated-basis resolution certificate. It does not decide whether an endpoint is competitive; fold-level or cohort-level search logic remains the caller's responsibility.
metric.graph.heat.extend.lower( basis, eta.grid, endpoint.status = c("active", "inactive", "unresolved"), expansion.factor = 3, max.expansions = 3L, expansions.completed = 0L, identity.departure = 0.01, truncation.tol = 1e-04, unresolved.action = c("error", "mark") )metric.graph.heat.extend.lower( basis, eta.grid, endpoint.status = c("active", "inactive", "unresolved"), expansion.factor = 3, max.expansions = 3L, expansions.completed = 0L, identity.departure = 0.01, truncation.tol = 1e-04, unresolved.action = c("error", "mark") )
basis |
A |
eta.grid |
Current finite positive heat-time grid. The exact identity
time |
endpoint.status |
External lower-endpoint classification:
|
expansion.factor |
Finite numeric factor greater than one. An active
proposal is |
max.expansions |
Nonnegative integer maximum number of lower-extension rounds. |
expansions.completed |
Nonnegative integer number of extension rounds already admitted under the same search contract. |
identity.departure |
Positive number smaller than one. The proposed
time cannot be smaller than
|
truncation.tol |
Positive tolerance smaller than one for the conservative omitted-mode attenuation bound. |
unresolved.action |
Action when an active proposal is not certified by
a truncated basis: |
A list of class "metric.graph.heat.lower.extension" with the
augmented or unchanged grid and proposal telemetry. A proposal is added
only when admitted is TRUE.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) basis <- metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense") eta <- metric.graph.heat.eta.grid(basis, n.initial = 6L) metric.graph.heat.extend.lower(basis, eta, endpoint.status = "active")adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) basis <- metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense") eta <- metric.graph.heat.eta.grid(basis, n.initial = 6L) metric.graph.heat.extend.lower(basis, eta, endpoint.status = "active")
Builds a metric-conductance graph Laplacian and computes the low-frequency eigensystem used by graph low-pass filters. The resulting object is response-independent and can be reused for many responses and filter parameters.
metric.graph.lowpass.basis( adj.list, weight.list, conductance.rule = c("inverse.length.power", "exp.length", "exp.length.squared", "self.tuned.gaussian"), conductance.epsilon = 1e-08, conductance.alpha = 1, conductance.sigma = NULL, conductance.sigma.rule = c("edge.quantile", "median", "local.k"), conductance.sigma.quantile = 0.75, conductance.local.k = 5L, laplacian.type = c("unnormalized", "symmetric.normalized"), n.eigenpairs = 50L, eigen.solver = c("auto", "sparse", "dense"), dense.eigen.threshold = 200L, dense.fallback.threshold = 5000L, dense.fallback = c("auto", "never", "always"), verbose = FALSE )metric.graph.lowpass.basis( adj.list, weight.list, conductance.rule = c("inverse.length.power", "exp.length", "exp.length.squared", "self.tuned.gaussian"), conductance.epsilon = 1e-08, conductance.alpha = 1, conductance.sigma = NULL, conductance.sigma.rule = c("edge.quantile", "median", "local.k"), conductance.sigma.quantile = 0.75, conductance.local.k = 5L, laplacian.type = c("unnormalized", "symmetric.normalized"), n.eigenpairs = 50L, eigen.solver = c("auto", "sparse", "dense"), dense.eigen.threshold = 200L, dense.fallback.threshold = 5000L, dense.fallback = c("auto", "never", "always"), verbose = FALSE )
adj.list |
List of integer neighbor vectors using 1-based vertex indices. |
weight.list |
List of positive metric edge lengths parallel to
|
conductance.rule |
Character scalar. One of
|
conductance.epsilon |
Positive numeric regularizer used by inverse-power conductances and as a local-scale floor. |
conductance.alpha |
Positive numeric exponent for
|
conductance.sigma |
Optional positive global scale for exponential rules.
If |
conductance.sigma.rule |
Rule for selecting a global scale when needed. |
conductance.sigma.quantile |
Quantile used when
|
conductance.local.k |
Positive integer local incident-edge order
statistic for |
laplacian.type |
Laplacian operator. |
n.eigenpairs |
Positive integer number of eigenpairs to compute. |
eigen.solver |
|
dense.eigen.threshold |
Exact dense threshold for auto mode. |
dense.fallback.threshold |
Maximum graph size for emergency dense fallback when sparse decomposition fails and fallback is allowed. |
dense.fallback |
|
verbose |
Logical. Reserved for future diagnostic messages. |
The basis is complete only when it contains one eigenvector per graph vertex. A truncated basis represents only the retained low-frequency subspace. The largest retained eigenvalue supplies a conservative proxy for bounding the contribution of omitted modes because all omitted eigenvalues are at least as large.
A list of class "metric.graph.lowpass.basis" containing the
graph operator, eigenvalues, eigenvectors, solver metadata, and spectral
completeness diagnostics.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense")adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) metric.graph.lowpass.basis(adj, lengths, n.eigenpairs = 4L, eigen.solver = "dense")
Builds a weighted graph Laplacian by transforming metric edge lengths into conductances. This operator is a direct metric-conductance comparator to the legacy rdgraph regression smoother, not a replacement for the Riemannian-complex/overlap-density smoother.
metric.graph.lowpass.operator( adj.list, weight.list, conductance.rule = c("inverse.length.power", "exp.length", "exp.length.squared", "self.tuned.gaussian"), conductance.epsilon = 1e-08, conductance.alpha = 1, conductance.sigma = NULL, conductance.sigma.rule = c("edge.quantile", "median", "local.k"), conductance.sigma.quantile = 0.75, conductance.local.k = 5L, laplacian.type = c("unnormalized", "symmetric.normalized"), return.sparse = TRUE, verbose = FALSE )metric.graph.lowpass.operator( adj.list, weight.list, conductance.rule = c("inverse.length.power", "exp.length", "exp.length.squared", "self.tuned.gaussian"), conductance.epsilon = 1e-08, conductance.alpha = 1, conductance.sigma = NULL, conductance.sigma.rule = c("edge.quantile", "median", "local.k"), conductance.sigma.quantile = 0.75, conductance.local.k = 5L, laplacian.type = c("unnormalized", "symmetric.normalized"), return.sparse = TRUE, verbose = FALSE )
adj.list |
List of integer neighbor vectors using 1-based vertex indices. |
weight.list |
List of positive metric edge lengths parallel to
|
conductance.rule |
Character scalar. One of
|
conductance.epsilon |
Positive numeric regularizer used by inverse-power conductances and as a local-scale floor. |
conductance.alpha |
Positive numeric exponent for
|
conductance.sigma |
Optional positive global scale for exponential rules.
If |
conductance.sigma.rule |
Rule for selecting a global scale when needed. |
conductance.sigma.quantile |
Quantile used when
|
conductance.local.k |
Positive integer local incident-edge order
statistic for |
laplacian.type |
Laplacian operator. |
return.sparse |
Logical. If |
verbose |
Logical. Reserved for future diagnostic messages. |
The legacy rdgraph regression precomputed-graph path uses
supplied weight.list values as edge lengths for neighborhood ordering.
The spectral conductance in that smoother is overlap-density based:
where is computed by the Riemannian-complex density machinery.
This function instead constructs conductances directly from metric lengths:
Supported transforms are
and
For laplacian.type = "symmetric.normalized", smoothing is performed
in the Euclidean eigenbasis of . The null vector is
proportional to , not the constant vector, so this mode does
not preserve constant responses in the same way as the unnormalized
Laplacian.
A list of class "metric.graph.lowpass.operator" containing
the edge table, conductances, degree vector, Laplacian triplets, summaries,
and optionally a sparse Laplacian matrix.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) metric.graph.lowpass.operator(adj, lengths)adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) metric.graph.lowpass.operator(adj, lengths)
Summaries expose stored settings and diagnostics without recomputing geometry, fitting, or selection. Console output is bounded; the summary's structured fields retain selected controls, criterion tables, local diagnostic counts, solver information, and density accounting for closer inspection.
## S3 method for class 'summary.geosmooth_fit' print(x, ...) ## S3 method for class 'lps' summary(object, ...) ## S3 method for class 'malps' summary(object, ...) ## S3 method for class 'ps_lps' summary(object, ...) ## S3 method for class 'chart_kernel' summary(object, ...) ## S3 method for class 'local_likelihood' summary(object, ...) ## S3 method for class 'lpl_tf' summary(object, ...) ## S3 method for class 'slpl_tf' summary(object, ...) ## S3 method for class 'metric.graph.lowpass.fit' summary(object, ...) ## S3 method for class 'metric.graph.lowpass.refit' summary(object, ...) ## S3 method for class 'ssrhe.hessian.fit' summary(object, ...) ## S3 method for class 'ssrhe.hessian.refit' summary(object, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' summary(object, ...) ## S3 method for class 'graph.trend.filtering.fit' summary(object, ...) ## S3 method for class 'pttf.trend.filtering.fit' summary(object, ...) ## S3 method for class 'density_fit' summary(object, ...) ## S3 method for class 'lpl_tf' print(x, ...) ## S3 method for class 'slpl_tf' print(x, ...) ## S3 method for class 'density_fit' print(x, ...) ## S3 method for class 'ps_lps' print(x, ...) ## S3 method for class 'chart_kernel' print(x, ...) ## S3 method for class 'local_likelihood' print(x, ...)## S3 method for class 'summary.geosmooth_fit' print(x, ...) ## S3 method for class 'lps' summary(object, ...) ## S3 method for class 'malps' summary(object, ...) ## S3 method for class 'ps_lps' summary(object, ...) ## S3 method for class 'chart_kernel' summary(object, ...) ## S3 method for class 'local_likelihood' summary(object, ...) ## S3 method for class 'lpl_tf' summary(object, ...) ## S3 method for class 'slpl_tf' summary(object, ...) ## S3 method for class 'metric.graph.lowpass.fit' summary(object, ...) ## S3 method for class 'metric.graph.lowpass.refit' summary(object, ...) ## S3 method for class 'ssrhe.hessian.fit' summary(object, ...) ## S3 method for class 'ssrhe.hessian.refit' summary(object, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' summary(object, ...) ## S3 method for class 'graph.trend.filtering.fit' summary(object, ...) ## S3 method for class 'pttf.trend.filtering.fit' summary(object, ...) ## S3 method for class 'density_fit' summary(object, ...) ## S3 method for class 'lpl_tf' print(x, ...) ## S3 method for class 'slpl_tf' print(x, ...) ## S3 method for class 'density_fit' print(x, ...) ## S3 method for class 'ps_lps' print(x, ...) ## S3 method for class 'chart_kernel' print(x, ...) ## S3 method for class 'local_likelihood' print(x, ...)
... |
Reserved; unused arguments are rejected. |
object, x
|
A fitted object, or a summary for its print method. |
A finite result is not a convergence certificate. Where the algorithm records no stopping certificate, convergence is explicitly unavailable. Local fallback counts and failed evaluations are reported separately. Selection criteria are conditional tuning scores; they are not an independent assessment of prediction error. GCV, CV MSE, RMSE, and likelihood losses have different interpretations.
summary() returns a summary.geosmooth_fit list with model,
n.training, n.evaluation, n.responses, n.observed, nonfinite,
status, convergence, prediction.domain, selected, criteria,
diagnostics, solver, mass, accounting, and warnings fields.
Print methods return their input invisibly.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.chart.kernel(X, X[, 1]^2, support.size = 8L) fit summary(fit) mass <- normalize.density(c(1, 2, 3)) mass summary(mass)$accountingX <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.chart.kernel(X, X[, 1]^2, support.size = 8L) fit summary(fit) mass <- normalize.density(c(1, 2, 3)) mass summary(mass)$accounting
Use fitted(object) for the stored response-scale fitted values, preserving
vector or matrix shape, row order, names, and missing values. It does not
recompute a fit or imply prediction at new points. For harmonic.smoother()
results it returns harmonic_predictions. The basic
perform.harmonic.smoothing() result remains an unclassed list, accessed
through $harmonic_predictions; density probability masses remain $rho.
## S3 method for class 'lps' fitted(object, ...) ## S3 method for class 'lps' residuals(object, ...) ## S3 method for class 'malps' fitted(object, ...) ## S3 method for class 'malps' residuals(object, ...) ## S3 method for class 'ps_lps' fitted(object, ...) ## S3 method for class 'ps_lps' residuals(object, ...) ## S3 method for class 'chart_kernel' fitted(object, ...) ## S3 method for class 'chart_kernel' residuals(object, ...) ## S3 method for class 'local_likelihood' fitted(object, ...) ## S3 method for class 'local_likelihood' residuals(object, ...) ## S3 method for class 'lpl_tf' fitted(object, ...) ## S3 method for class 'lpl_tf' residuals(object, ...) ## S3 method for class 'slpl_tf' fitted(object, ...) ## S3 method for class 'slpl_tf' residuals(object, ...) ## S3 method for class 'metric.graph.lowpass.fit' fitted(object, ...) ## S3 method for class 'metric.graph.lowpass.fit' residuals(object, ...) ## S3 method for class 'metric.graph.lowpass.refit' fitted(object, ...) ## S3 method for class 'metric.graph.lowpass.refit' residuals(object, ...) ## S3 method for class 'ssrhe.hessian.fit' fitted(object, ...) ## S3 method for class 'ssrhe.hessian.fit' residuals(object, ...) ## S3 method for class 'ssrhe.hessian.refit' fitted(object, ...) ## S3 method for class 'ssrhe.hessian.refit' residuals(object, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' fitted(object, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' residuals(object, ...) ## S3 method for class 'graph.trend.filtering.fit' fitted(object, ...) ## S3 method for class 'graph.trend.filtering.fit' residuals(object, ...) ## S3 method for class 'pttf.trend.filtering.fit' fitted(object, ...) ## S3 method for class 'pttf.trend.filtering.fit' residuals(object, ...) ## S3 method for class 'harmonic_smoother' fitted(object, ...)## S3 method for class 'lps' fitted(object, ...) ## S3 method for class 'lps' residuals(object, ...) ## S3 method for class 'malps' fitted(object, ...) ## S3 method for class 'malps' residuals(object, ...) ## S3 method for class 'ps_lps' fitted(object, ...) ## S3 method for class 'ps_lps' residuals(object, ...) ## S3 method for class 'chart_kernel' fitted(object, ...) ## S3 method for class 'chart_kernel' residuals(object, ...) ## S3 method for class 'local_likelihood' fitted(object, ...) ## S3 method for class 'local_likelihood' residuals(object, ...) ## S3 method for class 'lpl_tf' fitted(object, ...) ## S3 method for class 'lpl_tf' residuals(object, ...) ## S3 method for class 'slpl_tf' fitted(object, ...) ## S3 method for class 'slpl_tf' residuals(object, ...) ## S3 method for class 'metric.graph.lowpass.fit' fitted(object, ...) ## S3 method for class 'metric.graph.lowpass.fit' residuals(object, ...) ## S3 method for class 'metric.graph.lowpass.refit' fitted(object, ...) ## S3 method for class 'metric.graph.lowpass.refit' residuals(object, ...) ## S3 method for class 'ssrhe.hessian.fit' fitted(object, ...) ## S3 method for class 'ssrhe.hessian.fit' residuals(object, ...) ## S3 method for class 'ssrhe.hessian.refit' fitted(object, ...) ## S3 method for class 'ssrhe.hessian.refit' residuals(object, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' fitted(object, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' residuals(object, ...) ## S3 method for class 'graph.trend.filtering.fit' fitted(object, ...) ## S3 method for class 'graph.trend.filtering.fit' residuals(object, ...) ## S3 method for class 'pttf.trend.filtering.fit' fitted(object, ...) ## S3 method for class 'pttf.trend.filtering.fit' residuals(object, ...) ## S3 method for class 'harmonic_smoother' fitted(object, ...)
object |
A supported fitted model; see Methods below. |
... |
Reserved; unused arguments are rejected. |
residuals(object) returns stored response residuals where available,
including missing-label masks. Otherwise it computes y - fitted.values
only when the evaluation coordinates equal the training coordinates.
Residuals at different evaluation points are undefined and cause an error,
even when training and evaluation have the same number of rows. Binomial
residuals are on the response (probability) scale, not Pearson or deviance
residuals. These accessors do not change which refit results are reusable.
The stored vector or matrix, or response residuals of the same shape.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) model <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) head(fitted(model)) head(residuals(model))X <- matrix(seq(0, 1, length.out = 20), ncol = 1) model <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) head(fitted(model)) head(residuals(model))
Converts a numeric field or fitted smoother/regression object into a
probability mass vector over the evaluation support. This is the explicit
adapter between ordinary smoothers such as fit.lps,
fit.ps.lps, and fit.metric.graph.lowpass and
density or occupation-density workflows.
normalize.density(x, ...) ## S3 method for class 'numeric' normalize.density( x, X = NULL, density.control = list(), method.id = "normalized_numeric", keep.source.fit = FALSE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## Default S3 method: normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'lps' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'ps_lps' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'metric.graph.lowpass.fit' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'metric.graph.lowpass.refit' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... )normalize.density(x, ...) ## S3 method for class 'numeric' normalize.density( x, X = NULL, density.control = list(), method.id = "normalized_numeric", keep.source.fit = FALSE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## Default S3 method: normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'lps' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'ps_lps' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'metric.graph.lowpass.fit' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... ) ## S3 method for class 'metric.graph.lowpass.refit' normalize.density( x, X = NULL, density.control = list(), method.id = NULL, keep.source.fit = TRUE, adj.list = NULL, empirical.rho = NULL, return.details = TRUE, ... )
x |
Numeric vector or fitted object with a |
... |
Additional arguments passed to methods. |
X |
Optional support/evaluation matrix. If omitted, methods use the
fitted object's stored |
density.control |
List controlling clipping, normalization, and
accounting checks. See |
method.id |
Character method identifier recorded in the returned object. |
keep.source.fit |
Logical; if |
adj.list |
Optional adjacency list used to compute graph-local smoothness diagnostics for the normalized density. |
empirical.rho |
Optional empirical probability mass vector used for accounting diagnostics. |
return.details |
Logical; if |
A list of class "density_fit".
normalize.density(c(0.5, -0.1, 0.6, 0), X = matrix(1:4, ncol = 1))normalize.density(c(0.5, -0.1, 0.6, 0), X = matrix(1:4, ncol = 1))
Applies harmonic smoothing to function values defined on vertices of a graph, preserving values at the boundary of a specified region while smoothly interpolating interior values. This function implements a discrete Laplace equation solution using weighted averaging.
perform.harmonic.smoothing( adj.list, weight.list, values, region.vertices, max.iterations = 100, tolerance = 1e-06 )perform.harmonic.smoothing( adj.list, weight.list, values, region.vertices, max.iterations = 100, tolerance = 1e-06 )
adj.list |
A list of integer vectors, where each vector contains indices of vertices adjacent to the corresponding vertex. Indices must be 1-based. |
weight.list |
A list of numeric vectors containing weights of edges
corresponding to adjacencies in |
values |
A numeric vector of function values defined at each vertex. |
region.vertices |
An integer vector of vertex indices (1-based) defining the region to be smoothed. Boundary vertices will have fixed values. |
max.iterations |
Integer scalar, the maximum number of relaxation iterations to perform. Default is 100. |
tolerance |
Numeric scalar, the convergence threshold for value changes. Default is 1e-6. |
Boundary vertices are exactly the region vertices with a neighbor outside
the region. Degree-one vertices are not automatically boundary vertices.
Boundary values and values outside the region remain fixed. Each synchronous
relaxation step replaces interior values by neighbor averages with conductance
, where is the supplied edge length.
With no boundary, this function returns the input unchanged, with status
"no_boundary" and converged = FALSE. With no interior there
is nothing to solve: status is "no_interior" and convergence is true.
On a disconnected region, components without a connection to fixed boundary
values are not uniquely anchored; relaxation can oscillate. Inspect convergence
before using the result as a harmonic solution. Unlike this basic function,
harmonic.smoother() also runs relaxation when the whole region has no
boundary, retaining its historical behavior.
A list containing:
harmonic_predictions: the numeric vector of smoothed values;
converged: whether both the maximum update and discrete
harmonic residual fell below tolerance;
num_region, num_boundary, and num_interior:
vertex counts for the requested region and its boundary/interior split;
num_iterations: the number of relaxation iterations run;
max_change and max_residual: per-iteration convergence
diagnostics;
status: converged, iteration_limit,
no_boundary, or no_interior.
harmonic.smoother for smoothing with topology tracking,
get.region.boundary for boundary vertex identification
adj.list <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weight.list <- list(1, c(1, 1), c(1, 1), 1) values <- c(0, 2, -1, 1) result <- perform.harmonic.smoothing( adj.list, weight.list, values, region.vertices = 1:3 ) result$harmonic_predictionsadj.list <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weight.list <- list(1, c(1, 1), c(1, 1), 1) values <- c(0, 2, -1, 1) result <- perform.harmonic.smoothing( adj.list, weight.list, values, region.vertices = 1:3 ) result$harmonic_predictions
Creates various plots to visualize the results of harmonic smoothing with topology tracking.
## S3 method for class 'harmonic_smoother' plot(x, y = NULL, ..., type = c("topology", "extrema", "values"))## S3 method for class 'harmonic_smoother' plot(x, y = NULL, ..., type = c("topology", "extrema", "values"))
x |
An object of class |
y |
Ignored (included for S3 method consistency). |
... |
Additional graphical parameters passed to |
type |
Character string specifying the type of plot. Options are:
|
Invisibly returns the input object.
adj.list <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weight.list <- list(1, c(1, 1), c(1, 1), 1) values <- c(0, 2, -1, 1) result <- harmonic.smoother( adj.list, weight.list, values, region.vertices = seq_along(values), max.iterations = 20, record.frequency = 2 ) plot(result, type = "values")adj.list <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weight.list <- list(1, c(1, 1), c(1, 1), 1) values <- c(0, 2, -1, 1) result <- harmonic.smoother( adj.list, weight.list, values, region.vertices = seq_along(values), max.iterations = 20, record.frequency = 2 ) plot(result, type = "values")
The default view = "auto" preserves the dimension-dependent display:
one latent coordinate shows response and truth against that coordinate;
otherwise the first two predictor coordinates show a geometry projection.
Select "geometry" explicitly to see a curve's embedding, or "response"
to see responses against the first latent coordinate (observation index when
latent coordinates are absent). A two-coordinate projection can hide
separation in higher ambient dimensions. Plotting does not draw random values.
## S3 method for class 'synthetic_dataset' plot( x, color = c("response", "truth", "region"), ..., view = c("auto", "geometry", "response"), legend = TRUE, col = NULL )## S3 method for class 'synthetic_dataset' plot( x, color = c("response", "truth", "region"), ..., view = c("auto", "geometry", "response"), legend = TRUE, col = NULL )
x |
A |
color |
Color mapping for points: response, truth, or region. Region mapping requires stored region labels. Numeric keys display the actual range. |
... |
Additional arguments passed to |
view |
|
legend |
Logical; show point-color and response/truth keys. A user-supplied
|
col |
Optional explicit point color, overriding the color mapping. |
x, invisibly.
x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) plot(x) plot(x, view = "geometry", color = "truth")x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) plot(x) plot(x, view = "geometry", color = "truth")
Predict From A Local Polynomial Lifting Trend Filter
## S3 method for class 'lpl_tf' predict( object, newdata = NULL, type = c("response"), allow.incomplete = FALSE, ... )## S3 method for class 'lpl_tf' predict( object, newdata = NULL, type = c("response"), allow.incomplete = FALSE, ... )
object |
A |
newdata |
Must be |
type |
Prediction type. The current implementation supports only
|
allow.incomplete |
Reserved. |
... |
Reserved. |
Fitted values at the training points.
if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.lpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda = 0.1, lambda.selection = "fixed") predict(fit) }if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.lpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda = 0.1, lambda.selection = "fixed") predict(fit) }
Predict from an LPS Fit
## S3 method for class 'lps' predict(object, newdata = NULL, type = c("response", "raw"), ...)## S3 method for class 'lps' predict(object, newdata = NULL, type = c("response", "raw"), ...)
object |
A fitted |
newdata |
Optional prediction matrix. Defaults to the fitted object's
stored |
type |
Prediction scale. |
... |
Unused. |
A numeric vector of predictions.
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.lps(X, sin(2 * pi * X[, 1]), support.grid = 6L) predict(fit)X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.lps(X, sin(2 * pi * X[, 1]), support.grid = 6L) predict(fit)
Predict From A MALPS Fit
## S3 method for class 'malps' predict( object, newdata = NULL, type = c("response"), allow.incomplete = FALSE, ... )## S3 method for class 'malps' predict( object, newdata = NULL, type = c("response"), allow.incomplete = FALSE, ... )
object |
A |
newdata |
Optional numeric coordinate matrix with the same number of
columns as |
type |
Prediction type. Currently only |
allow.incomplete |
Logical; if |
... |
Reserved for future extensions. |
Numeric vector of fitted values.
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.malps(X, sin(2 * pi * X[, 1]), support.size = 6L) predict(fit)X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.malps(X, sin(2 * pi * X[, 1]), support.size = 6L) predict(fit)
Predict From A Fixed-Operator Synchronized LPL-TF Model
## S3 method for class 'slpl_tf' predict(object, newdata = NULL, type = c("response"), ...)## S3 method for class 'slpl_tf' predict(object, newdata = NULL, type = c("response"), ...)
object |
A |
newdata |
Must be |
type |
Prediction type. The current implementation supports only
|
... |
Reserved. |
Fitted values at the training points.
if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.slpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda1 = 0.1, lambda2 = 0, lambda.selection = "fixed") predict(fit) }if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.slpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L, support.type = "knn", support.size = 7L, lambda1 = 0.1, lambda2 = 0, lambda.selection = "fixed") predict(fit) }
Print concise summaries for fitted geosmooth models and constructed operators.
## S3 method for class 'graph.trend.filtering.fit' print(x, ...) ## S3 method for class 'lpl_tf_operator' print(x, ...) ## S3 method for class 'lps' print(x, ...) ## S3 method for class 'malps' print(x, ...) ## S3 method for class 'malps_bootstrap' print(x, ...) ## S3 method for class 'metric.graph.lowpass.fit' print(x, ...) ## S3 method for class 'metric.graph.lowpass.refit' print(x, ...) ## S3 method for class 'pttf.trend.filtering.fit' print(x, ...) ## S3 method for class 'pttf_operator' print(x, ...) ## S3 method for class 'slpl_tf_operator' print(x, ...) ## S3 method for class 'ssrhe.hessian.operator' print(x, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' print(x, ...) ## S3 method for class 'ssrhe.hessian.fit' print(x, ...) ## S3 method for class 'ssrhe.hessian.refit' print(x, ...) ## S3 method for class 'ssrhe.hessian.cv.fit' print(x, ...) ## S3 method for class 'ssrhe.hessian.gcv.fit' print(x, ...) ## S3 method for class 'transported.graph.hessian.operator' print(x, ...)## S3 method for class 'graph.trend.filtering.fit' print(x, ...) ## S3 method for class 'lpl_tf_operator' print(x, ...) ## S3 method for class 'lps' print(x, ...) ## S3 method for class 'malps' print(x, ...) ## S3 method for class 'malps_bootstrap' print(x, ...) ## S3 method for class 'metric.graph.lowpass.fit' print(x, ...) ## S3 method for class 'metric.graph.lowpass.refit' print(x, ...) ## S3 method for class 'pttf.trend.filtering.fit' print(x, ...) ## S3 method for class 'pttf_operator' print(x, ...) ## S3 method for class 'slpl_tf_operator' print(x, ...) ## S3 method for class 'ssrhe.hessian.operator' print(x, ...) ## S3 method for class 'ssrhe.hessian.l1.fit' print(x, ...) ## S3 method for class 'ssrhe.hessian.fit' print(x, ...) ## S3 method for class 'ssrhe.hessian.refit' print(x, ...) ## S3 method for class 'ssrhe.hessian.cv.fit' print(x, ...) ## S3 method for class 'ssrhe.hessian.gcv.fit' print(x, ...) ## S3 method for class 'transported.graph.hessian.operator' print(x, ...)
x |
A geosmooth S3 object. |
... |
Additional arguments, currently ignored. |
Invisibly returns x.
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.lps(X, sin(2 * pi * X[, 1]), support.grid = 6L) print(fit)X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.lps(X, sin(2 * pi * X[, 1]), support.grid = 6L) print(fit)
Prints a concise summary of harmonic smoother results.
## S3 method for class 'harmonic_smoother' print(x, ...)## S3 method for class 'harmonic_smoother' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Invisibly returns the input object.
harmonic.smoother, summary.harmonic_smoother
fit <- structure( list( stable_iteration = 2L, i_harmonic_predictions = matrix(1:4, nrow = 2), i_basins = list(matrix(c(1, 1), ncol = 2)), topology_differences = numeric() ), class = "harmonic_smoother" ) print(fit)fit <- structure( list( stable_iteration = 2L, i_harmonic_predictions = matrix(1:4, nrow = 2), i_basins = list(matrix(c(1, 1), ncol = 2)), topology_differences = numeric() ), class = "harmonic_smoother" ) print(fit)
Prints the summary of harmonic smoother results in a formatted manner.
## S3 method for class 'summary.harmonic_smoother' print(x, ...)## S3 method for class 'summary.harmonic_smoother' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Invisibly returns the input object.
object <- structure( list( stable_iteration = 2L, iterations_recorded = 1L, initial_extrema = 1L, initial_maxima = 1L, initial_minima = 0L, final_extrema = 1L, final_maxima = 1L, final_minima = 0L, extrema_reduction = 0L, topology_diff_summary = NULL ), class = "summary.harmonic_smoother" ) print(object)object <- structure( list( stable_iteration = 2L, iterations_recorded = 1L, initial_extrema = 1L, initial_maxima = 1L, initial_minima = 0L, final_extrema = 1L, final_maxima = 1L, final_minima = 0L, extrema_reduction = 0L, topology_diff_summary = NULL ), class = "summary.harmonic_smoother" ) print(object)
Print a canonical synthetic dataset
## S3 method for class 'synthetic_dataset' print(x, ...)## S3 method for class 'synthetic_dataset' print(x, ...)
x |
A |
... |
Ignored. |
x, invisibly.
x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) print(x)x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) print(x)
Builds the geometry layer for the experimental parallel-transport trend filtering (PTTF) route. The returned object contains graph supports, local PCA tangent frames, edge directions, orthogonal edge transports, sampling density metadata, and diagnostics. It does not assemble transported difference operators and it does not fit a response.
pttf.geometry( X, adj.list = NULL, weight.list = NULL, graph = c("rknn", "supplied"), tangent.dim, local.support = c("graph.disk", "neighbors"), min.support = NULL, max.hops = 3L, support.k = NULL, graph.k.scale = 1L, graph.radius.factor = 1, graph.radius.rule = "geomean", transport.rule = c("procrustes"), synchronize.orientation = TRUE, density.method = c("support.radius"), alpha = 1, diagnostics = TRUE )pttf.geometry( X, adj.list = NULL, weight.list = NULL, graph = c("rknn", "supplied"), tangent.dim, local.support = c("graph.disk", "neighbors"), min.support = NULL, max.hops = 3L, support.k = NULL, graph.k.scale = 1L, graph.radius.factor = 1, graph.radius.rule = "geomean", transport.rule = c("procrustes"), synchronize.orientation = TRUE, density.method = c("support.radius"), alpha = 1, diagnostics = TRUE )
X |
Numeric data matrix with one row per vertex. |
adj.list |
Optional supplied graph adjacency list using 1-based vertex indices. |
weight.list |
Optional positive edge-length list parallel to
|
graph |
Graph source. |
tangent.dim |
Fixed global tangent dimension for local geometry. |
local.support |
Local support construction rule. |
min.support |
Minimum support size. Defaults to
|
max.hops |
Maximum hop radius used when topping up local supports. |
support.k |
Optional cap on local support size after top-up. The center vertex is always retained and remaining vertices are selected by graph metric distance, with vertex-index tie breaking. |
graph.k.scale, graph.radius.factor, graph.radius.rule
|
Adaptive-radius
graph controls passed to |
transport.rule |
Edge transport rule. The current implementation uses
|
synchronize.orientation |
Logical. If |
density.method |
Sampling-density metadata rule. The current
implementation uses |
alpha |
Numeric exponent used only to report proposed future density-normalization weights. |
diagnostics |
Logical. If |
The stored transport convention is column-vector based. For an oriented edge
, Oij maps tangent coordinates from frame
into frame :
For shared-support Procrustes, row-coordinate matrices and
are formed on the same vertex set. The row problem
gives when
. The stored column map is
; the reported residual is
.
A list of class "pttf_geometry".
n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) pttf.geometry(X, adj, lengths, graph = "supplied", tangent.dim = 1L)n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) pttf.geometry(X, adj, lengths, graph = "supplied", tangent.dim = 1L)
Assembles experimental parallel-transport trend-filtering (PTTF)
transported-difference operators from a pttf.geometry object.
This is an operator-construction function only: it does not fit a response,
tune a penalty parameter, or run an / smoother.
pttf.operator( geometry, derivative.order = 3L, edge.status.policy = c("ok.only", "frame.fallback"), regression.weight.rule = c("inverse.length.squared", "inverse.length", "unit"), edge.length.epsilon = 1e-08, tensor.scaling = c("hs", "raw"), row.mass.rule = c("node.mass", "none"), row.normalize = c("none", "l2"), min.operator.rank.tol = 1e-10, max.operator.condition = 1e+08, return.intermediate = TRUE, return.A = TRUE, return.B = TRUE, diagnostics = TRUE )pttf.operator( geometry, derivative.order = 3L, edge.status.policy = c("ok.only", "frame.fallback"), regression.weight.rule = c("inverse.length.squared", "inverse.length", "unit"), edge.length.epsilon = 1e-08, tensor.scaling = c("hs", "raw"), row.mass.rule = c("node.mass", "none"), row.normalize = c("none", "l2"), min.operator.rank.tol = 1e-10, max.operator.condition = 1e+08, return.intermediate = TRUE, return.A = TRUE, return.B = TRUE, diagnostics = TRUE )
geometry |
A |
derivative.order |
Integer derivative order, one of |
edge.status.policy |
Edge transport policy. |
regression.weight.rule |
Local regression edge-weight rule. |
edge.length.epsilon |
Positive numeric edge-length floor. |
tensor.scaling |
Symmetric tensor coordinate scaling. |
row.mass.rule |
Final row-mass multiplier. |
row.normalize |
Optional final row normalization. |
min.operator.rank.tol |
Relative singular-value tolerance for local derivative regression rank. |
max.operator.condition |
Maximum allowed weighted local-design condition number. |
return.intermediate |
Logical. If |
return.A |
Logical. If |
return.B |
Logical. If |
diagnostics |
Logical. If |
The operator keeps a full logical vertex/component layout internally. For
order , the logical field has one block of
components at each vertex. The returned
A is compact: it includes rows only for accepted final-order
vertex/component blocks, and row.table$full.row records the original
full logical row.
For derivative level , the local regression uses blocks
,
lifted weights
,
and transported predecessor differences
. Unavailable predecessor blocks are never filled
with zero; affected neighbors are dropped and recorded.
A list of class "pttf_operator" containing sparse operators,
row/vertex provenance, tensor-basis metadata, and diagnostics.
n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) geometry <- pttf.geometry( X, adj, lengths, graph = "supplied", tangent.dim = 1L ) pttf.operator(geometry, derivative.order = 2L)n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) geometry <- pttf.geometry( X, adj, lengths, graph = "supplied", tangent.dim = 1L ) pttf.operator(geometry, derivative.order = 2L)
Creates a new "pttf_operator" object with a subset of compact
operator rows. The sparse triplet payload is rebuilt from the filtered
matrix so triplet row indices always refer to the filtered fit rows, while
original compact and full logical row identities remain in row.table.
pttf.operator.filter.rows( operator, rows, reason = NULL, preserve.original = TRUE )pttf.operator.filter.rows( operator, rows, reason = NULL, preserve.original = TRUE )
operator |
A |
rows |
Integer, logical, or character row selector. Character selectors
are matched against |
reason |
Optional character reason stored in |
preserve.original |
Logical. If |
A filtered "pttf_operator" object.
n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) geometry <- pttf.geometry( X, adj, lengths, graph = "supplied", tangent.dim = 1L ) operator <- pttf.operator(geometry, derivative.order = 2L) pttf.operator.filter.rows(operator, seq_len(max(1L, nrow(operator$A) - 2L)))n <- 10L X <- matrix(seq(0, 1, length.out = n), ncol = 1) adj <- lapply(seq_len(n), function(i) intersect(c(i - 1L, i + 1L), 1:n)) lengths <- Map(function(i, j) abs(X[j, 1] - X[i, 1]), seq_len(n), adj) geometry <- pttf.geometry( X, adj, lengths, graph = "supplied", tangent.dim = 1L ) operator <- pttf.operator(geometry, derivative.order = 2L) pttf.operator.filter.rows(operator, seq_len(max(1L, nrow(operator$A) - 2L)))
Fit a new response while reusing the geometry or operators in a supported
fitted object. R selects the method from the class of object.
refit(object, y, ...) ## Default S3 method: refit(object, y, ...)refit(object, y, ...) ## Default S3 method: refit(object, y, ...)
object |
A fitted MALPS, local polynomial lifting trend filter, synchronized lifting trend filter, metric graph low-pass, quadratic Hessian-energy, or Hessian L1 model. |
y |
New response. MALPS and the two lifting trend filters accept a
vector; Hessian L1 accepts one response; metric graph low-pass and
quadratic Hessian methods also accept a matrix with one response per
column. MALPS and both Hessian methods reuse the stored response when
|
... |
Method-specific controls, described in the linked method help. Unrecognized arguments are errors. |
Refitting does not automatically repeat the original model selection:
malpsrefit.malps reuses supports and
averaging weights; accepts observation weights. Robust local
residual weights, if used, are recomputed for the new response.
lpl_tfrefit.lpl_tf reuses the residual
operator and penalty, or accepts a new fixed lambda.
slpl_tfrefit.slpl_tf reuses both operators
and penalties, or accepts fixed lambda1 and lambda2.
metric.graph.lowpass.fitrefit.metric.graph.lowpass.fit reuses the spectral basis
and smoothing parameter. Set per.column.gcv = TRUE to select a
parameter for each response column.
ssrhe.hessian.fitrefit.ssrhe.hessian.fit reuses the Hessian operator and
fixed penalties, with optional lambda1, lambda2,
weights, and ridge. This also handles CV- and GCV-selected
fits, retaining their selected penalties by default.
ssrhe.hessian.l1.fitrefit.ssrhe.hessian.l1.fit reuses the derivative operator
with fixed or CV-selected penalties; accepts lambda.grid,
lambda.selection, and solver controls.
Use the original fitted object for repeated metric graph low-pass or quadratic Hessian refits: their refit results are summaries, not reusable input fits. Other supported families return reusable fitted objects.
A refitted object or refit summary, as documented by the method.
The six former exported refit.*() functions are replaced by
refit(object, y, ...). Replace named fitted.model and
y.new arguments with object and y, respectively.
Method-specific controls and return classes are preserved. Call the
generic rather than an individual S3 method; the former help names remain
available for navigation.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) updated <- refit(fit, y = X[, 1]^3) head(predict(updated))X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) updated <- refit(fit, y = X[, 1]^3) head(predict(updated))
Reuses the fixed operator and selected lambda from an existing LPL-TF fit.
## S3 method for class 'lpl_tf' refit(object, y, lambda = NULL, reuse.lambda = TRUE, verbose = FALSE, ...)## S3 method for class 'lpl_tf' refit(object, y, lambda = NULL, reuse.lambda = TRUE, verbose = FALSE, ...)
object |
A |
y |
New numeric response vector. |
lambda |
Optional fixed lambda. |
reuse.lambda |
Logical. If |
verbose |
Logical. |
... |
Reserved. |
A refitted "lpl_tf" object.
refit for supported fitted objects and migration.
if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.lpl.tf(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 7L, lambda = 0.1, lambda.selection = "fixed") refit(fit, y = X[, 1]^3) }if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.lpl.tf(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 7L, lambda = 0.1, lambda.selection = "fixed") refit(fit, y = X[, 1]^3) }
Reuses the anchors, selected support profile, local supports, prediction
supports, coordinate method, kernel, degree, and local-solver controls from a
previous fit.malps result, then recomputes local polynomial
coefficients for a new response vector. Observation weights, when supplied,
multiply the stored geometric fitting weights for local coefficient
estimation. Supports and model-averaging weights remain fixed. A weighted
refit requires every stored local support to retain at least one positive
effective fitting weight; sparse bootstrap-style weights can therefore fail
even when the global weight vector is not all zero. If the original fit used
robust local residual reweighting, robust weights are recomputed for the new
response because they are response-dependent.
## S3 method for class 'malps' refit( object, y = NULL, weights = NULL, reuse.selection = TRUE, refit.local.coefficients = TRUE, verbose = FALSE, ... )## S3 method for class 'malps' refit( object, y = NULL, weights = NULL, reuse.selection = TRUE, refit.local.coefficients = TRUE, verbose = FALSE, ... )
object |
A |
y |
Optional new numeric response vector with length
|
weights |
Optional nonnegative numeric observation weights with length
|
reuse.selection |
Currently requires |
refit.local.coefficients |
Currently requires |
verbose |
Logical; reserved for future progress messages. |
... |
Reserved for future extensions. |
A "malps" object with the same support profile and new fitted
values.
refit for supported fitted objects and migration.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) refit(fit, y = X[, 1]^3)X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) refit(fit, y = X[, 1]^3)
Reuses a fitted metric graph low-pass eigensystem to smooth new responses.
## S3 method for class 'metric.graph.lowpass.fit' refit( object, y, per.column.gcv = FALSE, eta.grid = NULL, n.candidates = 40L, n.cores = 1L, block.size = NULL, verbose = FALSE, ... )## S3 method for class 'metric.graph.lowpass.fit' refit( object, y, per.column.gcv = FALSE, eta.grid = NULL, n.candidates = 40L, n.cores = 1L, block.size = NULL, verbose = FALSE, ... )
object |
A |
y |
Numeric vector or matrix with one row per graph vertex. |
per.column.gcv |
Logical. If |
eta.grid |
Optional positive numeric eta grid for per-column GCV. |
n.candidates |
Number of eta candidates when |
n.cores |
Positive integer retained for compatibility. Response
columns are always processed sequentially; values greater than one do not
enable parallel execution. Per-column GCV results report
|
block.size |
Optional block size for fixed-eta multi-column refits. |
verbose |
Logical progress flag. |
... |
Additional arguments are not currently supported. |
A list of class "metric.graph.lowpass.refit".
refit for supported fitted objects and migration.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) fit <- fit.metric.graph.lowpass( adj, lengths, y = 1:4, n.eigenpairs = 4L, eta.grid = c(0.1, 1), eigen.solver = "dense" ) refit(fit, y = 4:1)adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) lengths <- list(1, c(1, 1), c(1, 1), 1) fit <- fit.metric.graph.lowpass( adj, lengths, y = 1:4, n.eigenpairs = 4L, eta.grid = c(0.1, 1), eigen.solver = "dense" ) refit(fit, y = 4:1)
Refit A Fixed-Operator Synchronized LPL-TF Model
## S3 method for class 'slpl_tf' refit( object, y, lambda1 = NULL, lambda2 = NULL, reuse.lambda = TRUE, verbose = FALSE, ... )## S3 method for class 'slpl_tf' refit( object, y, lambda1 = NULL, lambda2 = NULL, reuse.lambda = TRUE, verbose = FALSE, ... )
object |
A |
y |
New numeric response vector. |
lambda1, lambda2
|
Optional fixed penalties. Defaults reuse
|
reuse.lambda |
Logical. If |
verbose |
Logical. |
... |
Reserved. |
A refitted "slpl_tf" object.
refit for supported fitted objects and migration.
if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.slpl.tf(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 7L, lambda1 = 0.1, lambda2 = 0, lambda.selection = "fixed") refit(fit, y = X[, 1]^3) }if (requireNamespace("genlasso", quietly = TRUE)) { X <- matrix(seq(0, 1, length.out = 18), ncol = 1) fit <- fit.slpl.tf(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 7L, lambda1 = 0.1, lambda2 = 0, lambda.selection = "fixed") refit(fit, y = X[, 1]^3) }
Reuses the operator from fit.ssrhe.hessian.regression to fit
new responses or new fixed penalty weights without rebuilding local PCA
neighborhoods or Hessian-energy matrices.
## S3 method for class 'ssrhe.hessian.fit' refit( object, y = NULL, lambda1 = object$lambda$lambda1, lambda2 = object$lambda$lambda2, weights = NULL, ridge = object$lambda$ridge, verbose = FALSE, ... )## S3 method for class 'ssrhe.hessian.fit' refit( object, y = NULL, lambda1 = object$lambda$lambda1, lambda2 = object$lambda$lambda2, weights = NULL, ridge = object$lambda$ridge, verbose = FALSE, ... )
object |
A |
y |
New numeric response vector or matrix with one row per vertex.
If |
lambda1 |
Nonnegative Hessian-energy penalty multiplier for
|
lambda2 |
Nonnegative supplemental-stabilizer multiplier for
|
weights |
Optional nonnegative observation weights. May be |
ridge |
Nonnegative diagonal ridge added to the linear system for numerical stabilization. |
verbose |
Logical. If |
... |
Additional arguments are not currently supported. |
A list of class "ssrhe.hessian.refit".
refit for supported fitted objects and migration.
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.ssrhe.hessian.regression( X, X[, 1]^2, k = 6L, tangent.dim = 1L, lambda1 = 0.1 ) refit(fit, y = X[, 1]^3)X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.ssrhe.hessian.regression( X, X[, 1]^2, k = 6L, tangent.dim = 1L, lambda1 = 0.1 ) refit(fit, y = X[, 1]^3)
Reuses the operator from
fit.ssrhe.hessian.l1.regression to fit a new response or a new
lambda grid without rebuilding local neighborhoods or local PCA Hessian
rows.
## S3 method for class 'ssrhe.hessian.l1.fit' refit( object, y = NULL, lambda.grid = object$lambda, lambda.selection = c("fixed", "cv"), weights = NULL, n.lambda = 40L, nfolds = 5L, fold.id = NULL, loss = c("mse", "mae"), selection = c("min", "one.se"), solver = c("genlasso", "admm", "auto"), row.scaling = c("none", "l2"), admm.rho = NULL, admm.maxiter = 2000L, admm.abstol = 1e-06, admm.reltol = 1e-05, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE, admm.adaptive.rho = TRUE, ... )## S3 method for class 'ssrhe.hessian.l1.fit' refit( object, y = NULL, lambda.grid = object$lambda, lambda.selection = c("fixed", "cv"), weights = NULL, n.lambda = 40L, nfolds = 5L, fold.id = NULL, loss = c("mse", "mae"), selection = c("min", "one.se"), solver = c("genlasso", "admm", "auto"), row.scaling = c("none", "l2"), admm.rho = NULL, admm.maxiter = 2000L, admm.abstol = 1e-06, admm.reltol = 1e-05, maxsteps = 2000L, minlam = 0, approx = FALSE, rtol = 1e-07, btol = 1e-07, eps = 1e-04, verbose = FALSE, admm.adaptive.rho = TRUE, ... )
object |
A |
y |
Optional new numeric response vector. If |
lambda.grid |
Optional nonnegative lambda grid. For
|
lambda.selection |
|
weights |
Optional nonnegative observation weights. Missing responses automatically receive zero weight. |
n.lambda |
Number of default lambda candidates when
|
nfolds |
Number of validation folds over observed positive-weight
labels. Ignored when |
fold.id |
Optional integer fold assignments of length |
loss |
Validation loss, currently |
selection |
Selection rule. |
solver |
Solver backend. |
row.scaling |
Optional row scaling for the penalty matrix before
solving. |
admm.rho, admm.maxiter, admm.abstol, admm.reltol
|
ADMM controls used by
all backends, including refinement of generalized-lasso candidates.
|
maxsteps, minlam, approx, rtol, btol, eps, verbose
|
Controls passed to genlasso. |
admm.adaptive.rho |
Logical; adapt the algorithm penalty during the
first 1000 iterations by balancing tolerance-normalized primal and dual
residuals. Set |
... |
Additional arguments are not currently supported. |
A list of class "ssrhe.hessian.l1.refit".
refit for supported fitted objects and migration.
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.ssrhe.hessian.l1.regression( X, X[, 1]^2, k = 6L, tangent.dim = 1L, lambda.grid = 0.05, lambda.selection = "fixed", solver = "admm" ) refit( fit, y = X[, 1]^3, solver = "admm" )X <- matrix(seq(0, 1, length.out = 12), ncol = 1) fit <- fit.ssrhe.hessian.l1.regression( X, X[, 1]^2, k = 6L, tangent.dim = 1L, lambda.grid = 0.05, lambda.selection = "fixed", solver = "admm" ) refit( fit, y = X[, 1]^3, solver = "admm" )
Chooses the graph using inner-fold loss only, then assembles its outer-fold predictions. Only graphs with full inner-fold prediction coverage compete; unsupported outer predictions remain NA. Candidate vertex identities and ordering must agree. Final graph selection uses full-data inner CV.
select.masked.graph.field(comparison, study)select.masked.graph.field(comparison, study)
comparison |
Output from compare.masked.graph.fields. |
study |
Name of the study used to choose graphs (for example HMP). |
Selected graph per outer fold, outer predictions and coverage, participant-balanced MSE, final graph name, and its final fitted field.
Builds the fixed S-LPL-TF operator pair. The LPL component
is the accepted self-excluded LPL-TF residual
operator from lpl.tf.operator. The synchronization component
compares inclusive local polynomial prediction maps
over overlapping supports.
slpl.tf.operator( X, adj.list = NULL, weight.list = NULL, graph = NULL, graph.stage = "final", anchor.index = NULL, anchor.coordinates = NULL, degree = 2L, support.type = c("adaptive.radius", "knn", "fixed.radius"), support.size = NULL, radius = NULL, min.support = NULL, support.buffer = 3L, kernel = c("epanechnikov", "triangular", "gaussian", "tricube"), coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, support.metric = c("auto", "coordinates", "graph.geodesic"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), row.normalize = c("l2", "none", "l1"), local.solver = c("auto", "normal.equations", "qr", "svd"), normal.equations.max.condition = 1e+08, duplicate.action = c("keep", "error"), drop.rank.deficient = TRUE, sync.row.normalize = c("l2"), sync.min.norm = 1e-12, verbose = FALSE, ... )slpl.tf.operator( X, adj.list = NULL, weight.list = NULL, graph = NULL, graph.stage = "final", anchor.index = NULL, anchor.coordinates = NULL, degree = 2L, support.type = c("adaptive.radius", "knn", "fixed.radius"), support.size = NULL, radius = NULL, min.support = NULL, support.buffer = 3L, kernel = c("epanechnikov", "triangular", "gaussian", "tricube"), coordinate.method = c("coordinates", "local.pca"), chart.dim = NULL, support.metric = c("auto", "coordinates", "graph.geodesic"), auto.chart.support.metric = c("coordinates", "operator", "both"), auto.chart.selection.metric = c("coordinates", "operator"), row.normalize = c("l2", "none", "l1"), local.solver = c("auto", "normal.equations", "qr", "svd"), normal.equations.max.condition = 1e+08, duplicate.action = c("keep", "error"), drop.rank.deficient = TRUE, sync.row.normalize = c("l2"), sync.min.norm = 1e-12, verbose = FALSE, ... )
X |
Numeric coordinate matrix with one row per observation. |
adj.list, weight.list
|
Optional supplied undirected graph adjacency and positive edge-length lists using 1-based vertex indices. |
graph |
Optional graph object returned by
|
graph.stage |
Graph stage to extract from |
anchor.index |
Optional integer vector of observed anchor/target indices. The current implementation supports observed anchors only. |
anchor.coordinates |
Reserved for later off-observation anchors; this
implementation requires |
degree |
Polynomial degree. The current implementation supports
|
support.type |
Coordinate support rule. |
support.size |
Positive integer for |
radius |
Positive coordinate radius for
|
min.support |
Minimum number of positive-weight predictors after self
exclusion. If |
support.buffer |
Nonnegative integer added to the local polynomial design size when choosing default supports. |
kernel |
Kernel used to weight local predictors by distance. |
coordinate.method |
Coordinate chart used for the local polynomial
design. |
chart.dim |
Chart dimension. For |
support.metric |
Support-distance rule. |
auto.chart.support.metric |
Support system used when
|
auto.chart.selection.metric |
Which auto chart-dimension diagnostic to
use for the fitted operator when |
row.normalize |
Complete-row normalization rule applied after setting
target coefficient |
local.solver |
Local linear algebra rule. |
normal.equations.max.condition |
Maximum condition number for
|
duplicate.action |
Duplicate coordinate policy. |
drop.rank.deficient |
Logical. The current implementation requires
|
sync.row.normalize |
Synchronization-row normalization. The current
implementation uses |
sync.min.norm |
Minimum raw synchronization-row norm. Rows below this threshold are dropped with metadata. |
verbose |
Logical. Reserved for diagnostic messages. |
... |
Reserved. |
A list of class "slpl_tf_operator" containing
A_LPL, C_sync, row metadata, diagnostics, settings, and the
embedded "lpl_tf_operator".
X <- matrix(seq(0, 1, length.out = 18), ncol = 1) slpl.tf.operator(X, degree = 1L, support.type = "knn", support.size = 7L, kernel = "gaussian")X <- matrix(seq(0, 1, length.out = 18), ncol = 1) slpl.tf.operator(X, degree = 1L, support.type = "knn", support.size = 7L, kernel = "gaussian")
Extract the linear map from responses to predictions for a supported
fitted model. R selects the method from the class of object.
smoother.matrix(object, ...) ## Default S3 method: smoother.matrix(object, ...)smoother.matrix(object, ...) ## Default S3 method: smoother.matrix(object, ...)
object |
An |
... |
Method-specific controls: |
smoother.matrix.lps requires a fixed-configuration Gaussian
LPS fit using the R backend, the orthogonal polynomial drop basis, singleton
tuning grids, and fixed chart dimension. It returns one row per evaluation
point and checks that the matrix reproduces the stored raw fitted values.
smoother.matrix.malps returns a training-point matrix
conditional on stored supports, charts, and weights. Its default size
limit is max.n = 1000L. Robust fits are rejected unless
allow.robust = TRUE; that option freezes the final robust weights
and does not represent how those weights change with the response.
Neither method represents uncertainty from repeating model selection.
A numeric matrix mapping training responses to predictions. See the method help for dimensions and attributes.
Replace lps.smoother.matrix(fit, ...) and
malps.smoother.matrix(fit, ...) with
smoother.matrix(fit, ...). Existing method-specific arguments and
restrictions are preserved. The former functions are no longer exported;
their help aliases lead to the corresponding methods.
refit, lps.pointwise.band,
malps.gcv
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) S <- smoother.matrix(fit) max(abs(as.vector(S %*% fit$y) - predict(fit)))X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) S <- smoother.matrix(fit) max(abs(as.vector(S %*% fit$y) - predict(fit)))
For a fixed configuration (singleton support.grid, degree.grid, and
kernel.grid, with an explicit numeric chart dimension) the LPS fitted
vector is linear in the response: fitted = S %*% y with S depending on
X, the kernel weights, and the configuration, but not on y. This
function reconstructs S analytically, one evaluation row at a time, by
rebuilding each local fit's support, kernel weights, local chart, and
design through the same internal routines fit.lps() used, and reading off
the influence row of the local weighted least-squares solve.
## S3 method for class 'lps' smoother.matrix(object, check.tol = 1e-10, ...)## S3 method for class 'lps' smoother.matrix(object, check.tol = 1e-10, ...)
object |
A fitted |
check.tol |
Positive scalar: maximum allowed absolute discrepancy of
the self-guard identity |
... |
Additional arguments are not currently supported. |
The extraction refuses configurations where the linearity premise fails or
is unsupported: it requires outcome.family = "gaussian", the R backend,
design.basis = "orthogonal.polynomial.drop", singleton grids (no
data-driven selection: the CV-selected pipeline is not a linear
smoother), and coordinate.method = "coordinates" or "local.pca" with an
explicit numeric chart.dim (never "auto" or "local.auto").
Self-guard: before returning, the function verifies
max(abs(S %*% y - fitted.values.raw)) <= check.tol against the fit it was
given (and that the NA patterns agree), so any divergence between the
reconstruction and the estimator is a hard error, never a silent drift.
Local fits that fell back are represented honestly: a weighted-mean
fallback (unstable.action = "mean") contributes its exact linear row
w / sum(w); an unstable.action = "na" non-fit contributes an all-NA
row.
A numeric matrix S with nrow(object$X.eval) rows and
nrow(object$X) columns: row i holds the weights through which the
training responses enter the prediction at evaluation point i.
lps.pointwise.band() for pointwise variances and confidence
bands derived from S.
smoother.matrix for supported fitted objects and migration.
set.seed(1) n <- 30 X <- matrix(runif(2 * n, -1, 1), ncol = 2) y <- sin(pi * X[, 1]) + 0.1 * rnorm(n) fit <- fit.lps(X, y, foldid = rep(1:2, length.out = n), support.grid = 12L, degree.grid = 1L, kernel.grid = "tricube", backend = "R", design.basis = "orthogonal.polynomial.drop", ridge.multiplier.grid = 0, ridge.condition.max = Inf, unstable.action = "na") S <- smoother.matrix(fit) max(abs(S %*% y - fit$fitted.values)) # ~1e-15: the linear identity sum(diag(S)) # effective degrees of freedomset.seed(1) n <- 30 X <- matrix(runif(2 * n, -1, 1), ncol = 2) y <- sin(pi * X[, 1]) + 0.1 * rnorm(n) fit <- fit.lps(X, y, foldid = rep(1:2, length.out = n), support.grid = 12L, degree.grid = 1L, kernel.grid = "tricube", backend = "R", design.basis = "orthogonal.polynomial.drop", ridge.multiplier.grid = 0, ridge.condition.max = Inf, unstable.action = "na") S <- smoother.matrix(fit) max(abs(S %*% y - fit$fitted.values)) # ~1e-15: the linear identity sum(diag(S)) # effective degrees of freedom
Constructs the exact training-point smoother matrix for a fitted
fit.malps object, conditional on the stored supports, local
charts, fitting weights, and averaging weights. For a non-robust MALPS fit
or weighted refit with fixed supports, the returned matrix satisfies
. If the original fit used cross-validation, this matrix
is conditional on the selected support profile; it does not account for the
response-dependence of the model-selection step.
## S3 method for class 'malps' smoother.matrix(object, max.n = 1000L, allow.robust = FALSE, ...)## S3 method for class 'malps' smoother.matrix(object, max.n = 1000L, allow.robust = FALSE, ...)
object |
|
max.n |
Maximum number of training observations for which a dense
smoother matrix may be constructed. Use |
allow.robust |
Logical; allow fixed-final-weight linearization for fits
with |
... |
Reserved for future extensions. |
Robust residual reweighting makes the effective fitting weights depend on
the response. By default this function therefore rejects robust MALPS fits.
Setting allow.robust = TRUE constructs the fixed-final-weight
linearization, which reproduces the stored fit but should not be interpreted
as the exact response-to-fit map.
A dense numeric matrix with attributes describing
whether the matrix is conditional on support selection and whether it used
a robust fixed-weight linearization.
smoother.matrix for supported fitted objects and migration.
X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) S <- smoother.matrix(fit) max(abs(S %*% fit$y - fit$fitted.values))X <- matrix(seq(0, 1, length.out = 20), ncol = 1) fit <- fit.malps(X, X[, 1]^2, degree = 1L, support.type = "knn", support.size = 8L) S <- smoother.matrix(fit) max(abs(S %*% fit$y - fit$fitted.values))
Constructs the discrete local Hessian operator used by the semi-supervised
regularization framework of Kim, Steinke, and Hein (2009). The constructor
is intended as a package-facing, auditable R/C++ port of the reference
behavior: it returns the sparse row operator , the quadratic energy
matrix , and optionally the supplemental stabilizer
.
ssrhe.hessian.operator( X, k = NULL, tangent.dim, nn.index = NULL, neighborhood.type = c("knn", "adaptive.radius", "supplied"), support.index = NULL, adaptive.k.scale = NULL, radius.rule = c("geomean", "max", "min"), radius.factor = 1.25, min.support = NULL, max.support = NULL, support.buffer = 2L, support.topup = c("nearest", "none"), tangent.dim.rule = c("fixed", "eigen.cumulative"), eigen.tolerance = 0.95, derivative.order = 2L, stabilizer = FALSE, pinv.tol = sqrt(.Machine$double.eps), local.solver = c("auto", "normal.equations", "svd", "qr"), normal.equations.max.condition = 10000, return.A = TRUE, return.B = TRUE, return.BS = stabilizer, return.sparse = TRUE, return.local.diagnostics = TRUE, return.timing = FALSE, verbose = FALSE )ssrhe.hessian.operator( X, k = NULL, tangent.dim, nn.index = NULL, neighborhood.type = c("knn", "adaptive.radius", "supplied"), support.index = NULL, adaptive.k.scale = NULL, radius.rule = c("geomean", "max", "min"), radius.factor = 1.25, min.support = NULL, max.support = NULL, support.buffer = 2L, support.topup = c("nearest", "none"), tangent.dim.rule = c("fixed", "eigen.cumulative"), eigen.tolerance = 0.95, derivative.order = 2L, stabilizer = FALSE, pinv.tol = sqrt(.Machine$double.eps), local.solver = c("auto", "normal.equations", "svd", "qr"), normal.equations.max.condition = 10000, return.A = TRUE, return.B = TRUE, return.BS = stabilizer, return.sparse = TRUE, return.local.diagnostics = TRUE, return.timing = FALSE, verbose = FALSE )
X |
Numeric matrix with one observation per row. Distances for the default neighborhood search are Euclidean distances in these coordinates. |
k |
Integer number of nearest neighbors per point, including the point
itself, used when |
tangent.dim |
Integer tangent dimension used for the local PCA chart.
Required when |
nn.index |
Optional integer matrix of neighbor indices, with
|
neighborhood.type |
Local support rule. |
support.index |
Optional list of integer vectors, one per row of
|
adaptive.k.scale |
Integer local-scale k used by
|
radius.rule, radius.factor
|
Adaptive-radius graph parameters passed to
|
min.support |
Optional minimum local support size for adaptive-radius
supports. Defaults to the local quadratic design size plus
|
max.support |
Optional maximum local support size. Oversized adaptive
supports are trimmed to the closest |
support.buffer |
Nonnegative integer added to the local quadratic design
size when choosing the default |
support.topup |
How undersized adaptive-radius supports are enlarged.
|
tangent.dim.rule |
Either |
eigen.tolerance |
Cumulative local PCA variance threshold used when
|
derivative.order |
Integer derivative order of the local SSRHE-style
operator. |
stabilizer |
Logical. If |
pinv.tol |
Nonnegative tolerance multiplier for local pseudoinverses. |
local.solver |
Local least-squares backend used to map local function
values to derivative coefficients. |
normal.equations.max.condition |
Positive condition-number guard used
by |
return.A |
Logical. If |
return.B |
Logical. If |
return.BS |
Logical. If |
return.sparse |
Logical. If |
return.local.diagnostics |
Logical. If |
return.timing |
Logical. If |
verbose |
Logical. If |
For each point , the operator constructs a local PCA chart from a
self-including local support, projects the support into
, and centers the local coordinates at . A local
quadratic model is then fitted with the intercept fixed at :
The local linear map from function values to the quadratic coefficients is the Matlab-compatible
where is the reduced quadratic-plus-linear design and
copies the center value into all local rows. Diagonal
Hessian components are scaled by and off-diagonal components
by , so that the row energy matches the reference Hessian energy.
With derivative.order = 3L, the reduced local design uses cubic
monomials first, followed by quadratic and linear monomials. The returned
rows estimate unique symmetric third-derivative components
with scale
where is the factorial monomial-to-derivative multiplier
( for , for , and for three
distinct indices) and is the ordered-tensor multiplicity
(, , or ). Thus approximates the
squared Frobenius norm of the full symmetric third-derivative tensor.
The returned is the stacked sparse matrix of these local derivative
coefficient rows. The SSRHE penalty is
Exposing is useful for auditability and for future
-style variants based on .
Adaptive-radius graph construction uses dgraphs; fixed-k and supplied neighborhoods are package-local geosmooth paths.
A list of class "ssrhe.hessian.operator" containing:
A: sparse local Hessian row operator, if requested;
B: sparse quadratic energy matrix , if requested;
BS: optional supplemental stabilizer matrix;
A.triplet, BS.triplet: raw sparse triplets;
nn.index: neighbor index matrix for rectangular kNN
neighborhoods, if used;
support.index: list of actual local supports used by the
backend;
neighborhoods: support-construction diagnostics;
row.table: one row per Hessian component row of ;
diagnostics: local design rank, condition, and PCA summaries;
local.diagnostics: if requested, one row per center vertex with support
size, design rank/condition, PCA variance, chart-distortion,
boundary-asymmetry, and curvature-bias proxy diagnostics;
timing: if requested, a phase-level elapsed-time table;
native.timing: if requested, a C++ backend subphase timing
table for native operator construction;
parity: notes documenting reference-behavior conventions.
Kim, K. I., Steinke, F., and Hein, M. (2009). Semi-supervised regression using Hessian energy with an application to semi-supervised dimensionality reduction. Advances in Neural Information Processing Systems 22. https://papers.nips.cc/paper_files/paper/2009/hash/f4552671f8909587cf485ea990207f3b-Abstract.html
X <- matrix(seq(0, 1, length.out = 12), ncol = 1) ssrhe.hessian.operator(X, k = 6L, tangent.dim = 1L)X <- matrix(seq(0, 1, length.out = 12), ncol = 1) ssrhe.hessian.operator(X, k = 6L, tangent.dim = 1L)
Constructs a compact grid of adaptive-radius support profiles for use with
support.selection = "cv" in SSRHE fitting functions. Each row gives an
adaptive.k.scale value and a requested min.support. The grid is
intentionally small by default because support selection nests operator
construction inside response cross-validation.
ssrhe.support.grid( n, tangent.dim, derivative.order = 2L, support.buffer = 2L, max.candidates = 8L )ssrhe.support.grid( n, tangent.dim, derivative.order = 2L, support.buffer = 2L, max.candidates = 8L )
n |
Number of observations. |
tangent.dim |
Tangent dimension used by the SSRHE local polynomial design. |
derivative.order |
SSRHE derivative order, currently |
support.buffer |
Nonnegative integer added to the local design size when constructing the smallest candidate support. |
max.candidates |
Maximum number of candidate support profiles to return. |
A data frame with columns adaptive.k.scale,
min.support, and max.support. max.support is
NA by default, meaning no truncation.
ssrhe.support.grid(n = 50L, tangent.dim = 2L, max.candidates = 4L)ssrhe.support.grid(n = 50L, tangent.dim = 2L, max.candidates = 4L)
Provides detailed summary statistics for harmonic smoother results, including the evolution of extrema counts and basin structure differences.
## S3 method for class 'harmonic_smoother' summary(object, ...)## S3 method for class 'harmonic_smoother' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
An object of class "summary.harmonic_smoother" containing:
stable_iteration, stability_detected
|
Extrema-stability detection, separate from numerical convergence; iteration is NA if undetected |
converged, status, num_iterations
|
Numerical relaxation status |
iterations_recorded |
Total number of recorded iterations |
initial_extrema |
Number of extrema at the first iteration |
initial_maxima |
Number of maxima at the first iteration |
initial_minima |
Number of minima at the first iteration |
final_extrema |
Number of extrema at the final iteration |
final_maxima |
Number of maxima at the final iteration |
final_minima |
Number of minima at the final iteration |
extrema_reduction |
Reduction in number of extrema |
topology_diff_summary |
Summary statistics of topology differences |
harmonic.smoother, print.summary.harmonic_smoother
fit <- structure( list( stable_iteration = 2L, i_basins = list(matrix(c(1, 1), ncol = 2)), topology_differences = numeric() ), class = "harmonic_smoother" ) summary(fit)fit <- structure( list( stable_iteration = 2L, i_basins = list(matrix(c(1, 1), ncol = 2)), topology_differences = numeric() ), class = "harmonic_smoother" ) summary(fit)
Reports graph-hop distance to the nearest observed vertex and the number of distinct measured participants at each vertex and its immediate neighbors. These are descriptive support measures, not uncertainty intervals or a guarantee of transportability. Vertex order follows the supplied operator.
support.masked.graph.field(operator, vertex, group)support.masked.graph.field(operator, vertex, group)
operator |
An unnormalized metric.graph.lowpass.operator. |
vertex |
Integer vertex indices of observed responses. |
group |
Nonmissing participant identifiers for the observations. |
A data frame with nearest.observation.hops (Inf if unreachable), local.participants and component.supported for each vertex.
Compute the canonical content checksum of a synthetic dataset
synthetic.dataset.checksum(x)synthetic.dataset.checksum(x)
x |
A |
A lowercase SHA-256 string.
x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) synthetic.dataset.checksum(x)x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) synthetic.dataset.checksum(x)
List maintained synthetic recipe IDs
synthetic.registry.ids()synthetic.registry.ids()
Character recipe IDs.
head(synthetic.registry.ids())head(synthetic.registry.ids())
Resolve the legacy seed for an SSRHE registry recipe
synthetic.registry.seed( recipe.id, replicate = 1L, n = NULL, base.seed = 273001L )synthetic.registry.seed( recipe.id, replicate = 1L, n = NULL, base.seed = 273001L )
recipe.id |
A one-dimensional, flat, or quadform SSRHE recipe ID. |
replicate |
Positive replicate number. |
n |
Sample size. Required for flat and quadform recipes. |
base.seed |
One-dimensional suite base seed. |
A validated integer seed.
synthetic.registry.seed("S16.V1", replicate = 2L)synthetic.registry.seed("S16.V1", replicate = 2L)
Default recipes are reconstructed from normalized component foreign keys. Parameter overrides are accepted only for the legacy G-family compatibility surface and remain content-bound, non-frozen specifications.
synthetic.registry.spec(recipe.id, parameters = list())synthetic.registry.spec(recipe.id, parameters = list())
recipe.id |
One of |
parameters |
Optional named parameter overrides. |
A validated synthetic_spec.
synthetic.registry.spec("G1")synthetic.registry.spec("G1")
Bernoulli response specification
synthetic.response.bernoulli(minimum.positive = 0L, maximum.attempts = 1L)synthetic.response.bernoulli(minimum.positive = 0L, maximum.attempts = 1L)
minimum.positive |
Minimum accepted positive responses. |
maximum.attempts |
Maximum complete redraw attempts. |
A synthetic response component.
synthetic.response.bernoulli(minimum.positive = 1L, maximum.attempts = 5L)synthetic.response.bernoulli(minimum.positive = 1L, maximum.attempts = 5L)
Clustered Gaussian response specification
synthetic.response.clustered.gaussian(residual.sd, intraclass.correlation)synthetic.response.clustered.gaussian(residual.sd, intraclass.correlation)
residual.sd |
Residual standard deviation. |
intraclass.correlation |
Intraclass correlation in |
A synthetic response component.
synthetic.response.clustered.gaussian(0.2, 0.3)synthetic.response.clustered.gaussian(0.2, 0.3)
Gaussian response specification
synthetic.response.gaussian(sd)synthetic.response.gaussian(sd)
sd |
Response standard deviation. |
A synthetic response component.
synthetic.response.gaussian(sd = 0.2)synthetic.response.gaussian(sd = 0.2)
Heteroskedastic Gaussian response specification
synthetic.response.heteroskedastic.gaussian(base.sd, truth.multiplier)synthetic.response.heteroskedastic.gaussian(base.sd, truth.multiplier)
base.sd |
Base standard deviation. |
truth.multiplier |
Multiplier applied to truth. |
A synthetic response component.
synthetic.response.heteroskedastic.gaussian(0.1, 0.2)synthetic.response.heteroskedastic.gaussian(0.1, 0.2)
Laplace response with Gaussian contamination
synthetic.response.laplace.outlier( laplace.scale, outlier.fraction, outlier.sd, minimum.outliers = 0L, count.rounding = "round", laplace.algorithm = "uniform.inverse.v1" )synthetic.response.laplace.outlier( laplace.scale, outlier.fraction, outlier.sd, minimum.outliers = 0L, count.rounding = "round", laplace.algorithm = "uniform.inverse.v1" )
laplace.scale |
Laplace scale. |
outlier.fraction |
Fraction contaminated. |
outlier.sd |
Contamination standard deviation. |
minimum.outliers |
Minimum contamination count. |
count.rounding |
Count policy. |
laplace.algorithm |
Versioned Laplace algorithm. |
A synthetic response component.
synthetic.response.laplace.outlier(0.1, 0.05, 1)synthetic.response.laplace.outlier(0.1, 0.05, 1)
Legacy G4 stratified sampling specification
synthetic.sampling.stratified( fraction.a = 0.5, algorithm = c("stratum.sequential.v1", "legacy.g4.stratum.sequential.v1") )synthetic.sampling.stratified( fraction.a = 0.5, algorithm = c("stratum.sequential.v1", "legacy.g4.stratum.sequential.v1") )
fraction.a |
Fraction allocated to stratum A. |
algorithm |
Versioned traversal algorithm. |
A synthetic sampling component.
synthetic.sampling.stratified(fraction.a = 0.6)synthetic.sampling.stratified(fraction.a = 0.6)
Combines draw-free geometry, sampling, truth, and response components into one canonically hashable specification.
synthetic.spec( geometry, sampling, truth, response, recipe.id = NULL, registry.tag = NULL, compatibility = NULL, metadata = list() )synthetic.spec( geometry, sampling, truth, response, recipe.id = NULL, registry.tag = NULL, compatibility = NULL, metadata = list() )
geometry |
A synthetic geometry component. |
sampling |
A synthetic sampling component. |
truth |
A synthetic truth component. |
response |
A synthetic response component. |
recipe.id |
Optional readable recipe label. |
registry.tag |
Optional stable experimental-plan tag. |
compatibility |
Optional serializable legacy compatibility metadata. |
metadata |
Optional serializable scientific metadata. |
A synthetic_spec.
spec <- synthetic.spec( dgraphs::synthetic.circle(), dgraphs::synthetic.sampling.uniform.interval(0, 2 * pi), synthetic.truth.named("helix.sin.v1"), synthetic.response.gaussian(0.1) ) spec$specification.sha256spec <- synthetic.spec( dgraphs::synthetic.circle(), dgraphs::synthetic.sampling.uniform.interval(0, 2 * pi), synthetic.truth.named("helix.sin.v1"), synthetic.response.gaussian(0.1) ) spec$specification.sha256
Specify a Gaussian-mixture truth
synthetic.truth.gaussian.mixture( centers, scales, weights, normalize = c("none", "sample.max"), evaluation.coordinates = "latent" )synthetic.truth.gaussian.mixture( centers, scales, weights, normalize = c("none", "sample.max"), evaluation.coordinates = "latent" )
centers |
Component centers, one per row. |
scales |
Positive isotropic standard deviations or covariance matrices. |
weights |
Nonnegative mixture weights. |
normalize |
Normalization scope. |
evaluation.coordinates |
Coordinates on which to evaluate. |
A synthetic truth component.
synthetic.truth.gaussian.mixture( centers = rbind(-1, 1), scales = c(0.5, 0.5), weights = c(1, 1) )synthetic.truth.gaussian.mixture( centers = rbind(-1, 1), scales = c(0.5, 0.5), weights = c(1, 1) )
Specify a sinusoidal finite-design logit truth
synthetic.truth.logit( amplitude = 1.5, target.prevalence = 0.5, clip = c(0.05, 0.95) )synthetic.truth.logit( amplitude = 1.5, target.prevalence = 0.5, clip = c(0.05, 0.95) )
amplitude |
Sinusoidal log-odds amplitude. |
target.prevalence |
Target mean pre-clipping probability. |
clip |
Probability bounds. |
A synthetic truth component.
synthetic.truth.logit(amplitude = 1, target.prevalence = 0.4)synthetic.truth.logit(amplitude = 1, target.prevalence = 0.4)
Specify a versioned named truth evaluator
synthetic.truth.named(id, parameters = list())synthetic.truth.named(id, parameters = list())
id |
Evaluator ID. |
parameters |
Serializable evaluator parameters. |
A synthetic truth component.
synthetic.truth.named("intrinsic.linear.first.v1")synthetic.truth.named("intrinsic.linear.first.v1")
The analytic Gaussian-mixture density is transformed to Bernoulli
occupation probabilities by
probability.maximum * density^gamma / max(density^gamma).
synthetic.truth.occupation.mixture( centers, covariances, weights, gamma = 1, probability.maximum = 0.65, normalization = "design.maximum" )synthetic.truth.occupation.mixture( centers, covariances, weights, gamma = 1, probability.maximum = 0.65, normalization = "design.maximum" )
centers |
Component centers, one per row. |
covariances |
Positive-definite covariance matrices. |
weights |
Nonnegative mixture weights. |
gamma |
Positive density-shape exponent. |
probability.maximum |
Maximum realized occupation probability. |
normalization |
Currently |
A finite-design synthetic truth component.
synthetic.truth.occupation.mixture( centers = rbind(c(-1, 0), c(1, 0)), covariances = list(diag(2), diag(2)), weights = c(1, 1) )synthetic.truth.occupation.mixture( centers = rbind(c(-1, 0), c(1, 0)), covariances = list(diag(2), diag(2)), weights = c(1, 1) )
Specify a polynomial truth
synthetic.truth.polynomial(coefficients, evaluation.coordinates = "latent")synthetic.truth.polynomial(coefficients, evaluation.coordinates = "latent")
coefficients |
Named polynomial coefficients. |
evaluation.coordinates |
Coordinates on which to evaluate. |
A synthetic truth component.
synthetic.truth.polynomial(c(b0 = 1, b1 = 2, b11 = -0.5))synthetic.truth.polynomial(c(b0 = 1, b1 = 2, b11 = -0.5))
Builds an experimental transported-Hessian graph operator without fitting a response. This diagnostic layer constructs directed edge differences, matches directions across a base dart, assembles a second- or third-difference diagnostic operator, and returns diagnostics that make the transport rule auditable.
transported.graph.hessian.operator( adj.list, weight.list = NULL, transport.order = 2L, transport.rule = c("exact.coordinate", "local.embedding.soft", "edge.angle.hard", "edge.angle.soft", "regression.gradient"), coordinates = NULL, direction.labels = NULL, polynomial.probes = NULL, local.embedding.method = c("auto", "coordinates", "grip.edge.kk", "mds.edge.kk", "cmdscale"), local.embedding.dim = 2L, local.disk.hops = 1L, local.max.vertices = 50L, return.sparse = TRUE, tol = 1e-08, soft.angle.scale = NULL, soft.length.scale = NULL, soft.bandwidth = 0.25, max.match.angle = NULL, max.length.relative.error = NULL, min.match.margin = NULL, max.effective.matches = NULL, match.threshold.rule = c("none", "fixed", "local.quantile", "local.robust.z"), match.score.quantile = 0.25, match.margin.quantile = 0.5, min.best.score.z = 1, min.margin.z = 0, max.effective.match.fraction = NULL, edge.angle.scale = NULL, edge.length.scale = NULL, edge.angle.bandwidth = 0.35, edge.angle.max.angle.difference = NULL, edge.angle.max.length.relative.error = NULL, gradient.coordinate.method = c("coordinates", "local.embedding"), gradient.embedding.method = c("grip.edge.kk", "mds.edge.kk", "cmdscale"), gradient.embedding.dim = NULL, gradient.disk.hops = local.disk.hops, gradient.max.vertices = local.max.vertices, gradient.disk.rule = c("hops", "metric.diameter.fraction", "metric.local.scale"), gradient.disk.radius.fraction = 0.1, gradient.disk.local.scale.method = c("knn.distance", "median.incident.length", "quantile.incident.length"), gradient.disk.local.scale.k = 8L, gradient.disk.local.scale.quantile = 0.75, gradient.disk.local.scale.multiplier = 2, gradient.disk.min.vertices = 0L, gradient.chart.selection = c("fixed", "adaptive"), gradient.embedding.candidates = c("cmdscale", "mds.edge.kk"), gradient.disk.rule.candidates = c("hops", "metric.diameter.fraction", "metric.local.scale"), gradient.disk.hops.candidates = 1:5, gradient.disk.radius.fraction.candidates = c(0.05, 0.075, 0.1, 0.15, 0.2), gradient.disk.local.scale.multiplier.candidates = c(1, 1.5, 2, 3, 4), gradient.ridge = 1e-08, gradient.quadratic.disk.hops = 2L, gradient.quadratic.max.vertices = gradient.max.vertices )transported.graph.hessian.operator( adj.list, weight.list = NULL, transport.order = 2L, transport.rule = c("exact.coordinate", "local.embedding.soft", "edge.angle.hard", "edge.angle.soft", "regression.gradient"), coordinates = NULL, direction.labels = NULL, polynomial.probes = NULL, local.embedding.method = c("auto", "coordinates", "grip.edge.kk", "mds.edge.kk", "cmdscale"), local.embedding.dim = 2L, local.disk.hops = 1L, local.max.vertices = 50L, return.sparse = TRUE, tol = 1e-08, soft.angle.scale = NULL, soft.length.scale = NULL, soft.bandwidth = 0.25, max.match.angle = NULL, max.length.relative.error = NULL, min.match.margin = NULL, max.effective.matches = NULL, match.threshold.rule = c("none", "fixed", "local.quantile", "local.robust.z"), match.score.quantile = 0.25, match.margin.quantile = 0.5, min.best.score.z = 1, min.margin.z = 0, max.effective.match.fraction = NULL, edge.angle.scale = NULL, edge.length.scale = NULL, edge.angle.bandwidth = 0.35, edge.angle.max.angle.difference = NULL, edge.angle.max.length.relative.error = NULL, gradient.coordinate.method = c("coordinates", "local.embedding"), gradient.embedding.method = c("grip.edge.kk", "mds.edge.kk", "cmdscale"), gradient.embedding.dim = NULL, gradient.disk.hops = local.disk.hops, gradient.max.vertices = local.max.vertices, gradient.disk.rule = c("hops", "metric.diameter.fraction", "metric.local.scale"), gradient.disk.radius.fraction = 0.1, gradient.disk.local.scale.method = c("knn.distance", "median.incident.length", "quantile.incident.length"), gradient.disk.local.scale.k = 8L, gradient.disk.local.scale.quantile = 0.75, gradient.disk.local.scale.multiplier = 2, gradient.disk.min.vertices = 0L, gradient.chart.selection = c("fixed", "adaptive"), gradient.embedding.candidates = c("cmdscale", "mds.edge.kk"), gradient.disk.rule.candidates = c("hops", "metric.diameter.fraction", "metric.local.scale"), gradient.disk.hops.candidates = 1:5, gradient.disk.radius.fraction.candidates = c(0.05, 0.075, 0.1, 0.15, 0.2), gradient.disk.local.scale.multiplier.candidates = c(1, 1.5, 2, 3, 4), gradient.ridge = 1e-08, gradient.quadratic.disk.hops = 2L, gradient.quadratic.max.vertices = gradient.max.vertices )
adj.list |
List of integer neighbor vectors using 1-based vertex indices. The graph must be undirected. |
weight.list |
Optional list of positive edge lengths parallel to
|
transport.order |
Integer scalar, either |
transport.rule |
Character scalar. |
coordinates |
Optional numeric matrix with one row per vertex. For
|
direction.labels |
Optional list parallel to |
polynomial.probes |
Optional numeric vector or matrix with one row per
vertex. If supplied, residual diagnostics
|
local.embedding.method |
Character scalar controlling the coordinates
used by |
local.embedding.dim |
Positive integer embedding dimension for local graph-disk embeddings. |
local.disk.hops |
Non-negative integer hop radius around each base dart used by graph-derived local embedding methods. |
local.max.vertices |
Positive integer cap on local disk size. If a disk is larger, the nearest vertices by hop distance are retained. |
return.sparse |
Logical. If |
tol |
Positive numeric tolerance for coordinate-axis direction inference. |
soft.angle.scale, soft.length.scale
|
Optional positive numeric scales
for the soft transport angular and length score components. If |
soft.bandwidth |
Positive numeric softmax bandwidth |
max.match.angle |
Optional non-negative numeric angle threshold in radians. For soft transport, candidate Hessian rows whose best match has angle larger than this threshold are dropped. |
max.length.relative.error |
Optional non-negative numeric threshold for
the best match's relative edge-length error,
|
min.match.margin |
Optional non-negative numeric threshold for the difference between the second-best and best soft-match scores. Candidate rows with smaller margins are dropped. |
max.effective.matches |
Optional positive numeric threshold for
|
match.threshold.rule |
Character scalar. |
match.score.quantile, match.margin.quantile
|
Quantile thresholds used
by |
min.best.score.z, min.margin.z
|
Non-negative robust-z thresholds used
by |
max.effective.match.fraction |
Optional positive numeric threshold for
|
edge.angle.scale, edge.length.scale
|
Optional positive numeric scales
for edge-angle matching. If |
edge.angle.bandwidth |
Positive numeric softmax bandwidth used only by
|
edge.angle.max.angle.difference |
Optional non-negative threshold, in radians, for accepting an edge-angle match. |
edge.angle.max.length.relative.error |
Optional non-negative threshold for accepting an edge-angle match based on relative edge-length error. |
gradient.coordinate.method |
Character scalar used only by
|
gradient.embedding.method |
Character scalar used by
|
gradient.embedding.dim |
Optional positive integer dimension for
graph-derived regression-gradient local charts. If |
gradient.disk.hops |
Non-negative integer hop radius for graph-derived regression-gradient local charts. |
gradient.max.vertices |
Positive integer cap on graph-derived regression-gradient local chart size. |
gradient.disk.rule |
Character scalar controlling graph-derived
regression-gradient disk construction. |
gradient.disk.radius.fraction |
Positive numeric scalar used by
|
gradient.disk.local.scale.method |
Character scalar controlling the
per-vertex metric scale used by |
gradient.disk.local.scale.k |
Positive integer neighborhood index used
by |
gradient.disk.local.scale.quantile |
Numeric probability in
|
gradient.disk.local.scale.multiplier |
Positive numeric scalar
multiplier for |
gradient.disk.min.vertices |
Non-negative integer lower target for
metric disk coverage. Metric disks whose radius selects too few vertices
are expanded to include at least this many nearest vertices, subject to
|
gradient.chart.selection |
Character scalar used only by graph-derived
regression-gradient transport. |
gradient.embedding.candidates |
Character vector of graph-derived local
embedding backends considered by |
gradient.disk.rule.candidates |
Character vector of disk construction
rules considered by |
gradient.disk.hops.candidates |
Non-negative integer vector of hop
radii considered by |
gradient.disk.radius.fraction.candidates |
Positive numeric vector of
graph-diameter fractions considered by |
gradient.disk.local.scale.multiplier.candidates |
Positive numeric
vector of local-scale multipliers considered by
|
gradient.ridge |
Non-negative ridge parameter used by
|
gradient.quadratic.disk.hops |
Non-negative integer hop radius for the
supplied-coordinate local quadratic regressions used by
|
gradient.quadratic.max.vertices |
Positive integer cap on local
quadratic-regression disk size for |
For a dart , the first difference is
For a base dart and a matched outgoing direction
, the transported Hessian row is
The reference rule, transport.rule = "exact.coordinate", matches
directions with identical coordinate labels. Labels may be supplied directly
through direction.labels, or inferred from axis-aligned
coordinates. The first general metric rule,
transport.rule = "local.embedding.soft", uses supplied coordinates to
softly match directions by angle and edge length. The edge-angle rules,
"edge.angle.hard" and "edge.angle.soft", match directions by
comparing their angle relative to the transported base edge.
transport.rule = "regression.gradient" estimates local
least-squares gradients and compares gradient components across graph darts.
Those gradients can be computed either from supplied coordinates or from a
graph-derived local embedding built in a shared disk around each base dart.
A list of class "transported.graph.hessian.operator" with the
canonical graph, directed-edge table, first-difference matrix, transported
Hessian matrix, row metadata, dropped candidate rows, and diagnostics. For
graph-derived regression-gradient transport with supplied
coordinates, the embedding diagnostics also include synthetic
chart-quality checks against those ambient coordinates.
adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weights <- list(1, c(1, 1), c(1, 1), 1) x <- 0:3 transported.graph.hessian.operator( adj, weights, coordinates = matrix(x, ncol = 1), polynomial.probes = cbind(1, x, x^2) )adj <- list(2L, c(1L, 3L), c(2L, 4L), 3L) weights <- list(1, c(1, 1), c(1, 1), 1) x <- 0:3 transported.graph.hessian.operator( adj, weights, coordinates = matrix(x, ncol = 1), polynomial.probes = cbind(1, x, x^2) )
Validate a canonical synthetic dataset
validate.synthetic.dataset(x)validate.synthetic.dataset(x)
x |
A |
x, invisibly.
x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) validate.synthetic.dataset(x)x <- materialize.synthetic(synthetic.registry.spec("G1"), n = 20L, seed = 1L) validate.synthetic.dataset(x)