Skip to contents

Predict From A MALPS Fit

Usage

# S3 method for class 'malps'
predict(
  object,
  newdata = NULL,
  type = c("response"),
  allow.incomplete = FALSE,
  ...
)

Arguments

object

A "malps" object from fit.malps.

newdata

Optional numeric coordinate matrix with the same number of columns as object$X. If NULL, returns stored training-point fitted values. New-point prediction is currently implemented for coordinate-support fits only; it fails informatively for objects fitted with support.metric = "graph.geodesic" because new targets need a graph-attachment/geodesic-distance contract.

type

Prediction type. Currently only "response".

allow.incomplete

Logical; if FALSE, new-point prediction fails when any target has no positive averaging coverage. If TRUE, those targets receive NA_real_.

...

Reserved for future extensions.

Value

Numeric vector of fitted values.

Examples

X <- matrix(seq(0, 1, length.out = 12), ncol = 1)
fit <- fit.malps(X, sin(2 * pi * X[, 1]), support.size = 6L)
predict(fit)
#>  [1] -0.01548055  0.56683483  0.90633187  0.97654649  0.75828612  0.28104520
#>  [7] -0.28104520 -0.75828612 -0.97654649 -0.90633187 -0.56683483  0.01548055