Skip to contents

Fits the percentage-error LS-SVR of the paper: Model 3 when sym_type = "none", and the symmetric-kernel Model 4 when sym_type is "even" or "odd". There is no quadratic program and no sparsity: the fit is a single solve of the \((N+1) \times (N+1)\) augmented linear system $$\begin{pmatrix} 0 & 1^{\top} \\ 1 & \Omega + Y_{\Gamma}\end{pmatrix} \begin{pmatrix} b \\ \alpha \end{pmatrix} = \begin{pmatrix} 0 \\ y \end{pmatrix}$$ with \(Y_{\Gamma} = \mathrm{diag}(y_1^2/\Gamma, \ldots, y_N^2/\Gamma)\), and \(\Omega_s\) replacing \(\Omega\) in the symmetric case. Every training point contributes to the prediction.

Usage

psvr_rmspe(
  X,
  y,
  sym_type = c("none", "even", "odd"),
  kernel,
  gamma,
  precondition = "auto",
  ...
)

Arguments

X

Numeric matrix of training inputs, one observation per row (\(N \times p\)).

y

Numeric vector of training targets, length \(N\). Must satisfy \(y_k > 0\) for every \(k\); percentage-error loss is undefined otherwise, and this is checked rather than coerced.

sym_type

Symmetry type, one of "none" (default), "even" or "odd". Maps onto the symmetry parameter \(a\) of the paper: "none" fits Model 3 and imposes no symmetry constraint; "even" sets \(a = +1\), enforcing \(f(x) = f(-x)\); "odd" sets \(a = -1\), enforcing \(f(x) = -f(-x)\). This is the same vocabulary as the sym_type argument of the parsnip specifications, so the two public surfaces agree. The symmetric variants require a kernel satisfying Assumption 3 of the paper – see make_kernel().

kernel

A kernel function created by make_kernel().

gamma

Regularization parameter \(\Gamma > 0\). Required. Larger values weight the squared percentage residuals more heavily against the norm penalty.

precondition

One of "auto" (default), "always", "never", or a positive numeric threshold. Controls a symmetric rescaling of the linear system by \(P = \mathrm{diag}(1/y)\). Unpreconditioned, the system carries the target-weighted diagonal \(y_k^2/\Gamma\), whose entries span the square of the target range; solving \(P \Omega P\) instead replaces it with the constant \(1/\Gamma\), so the diagonal no longer inflates the condition number when the targets differ by orders of magnitude. The multipliers are rescaled back on the way out, leaving the solution unchanged in exact arithmetic. "auto" applies it when the target ratio \(\max(y)/\min(y)\) exceeds 10; a numeric value sets that threshold explicitly. Whether it fired is reported in fit$precondition_applied.

...

Must be empty. Passing anything here is an error, which is how a mistyped argument name is caught.

Value

For sym_type = "none", an object of class "psvr_rmspe": a list with components alpha (the length-\(N\) multipliers), b, X_train, y_train, fitted_values, kernel, gamma, n_train, p_train and precondition_applied.

For sym_type = "even" or "odd", an object of class "psvr_rmspe_sym": the same components plus a (the symmetry parameter).

Methods are available for predict(), print(), coef(), summary(), fitted() and residuals(). Note that coef() returns three components here (alpha, b, support_data) against five for the MAPE classes: LS-SVR has no alpha_star and no pruned beta, and the absent components are not materialised as NULL.

Details

For the epsilon-SVR / MAPE family (Models 1 and 2) see psvr_mape(). The two are deliberately separate functions: they share no solver, no dual structure and no hyperparameter search space. The name psvr() is reserved for a future automatic-selection front end and is not a synonym for either.

See also

psvr_mape() for the epsilon-SVR / MAPE family, make_kernel() for kernels.

Examples

set.seed(1)
X <- matrix(rnorm(40), 20, 2)
y <- rlnorm(20)
K <- make_kernel("rbf", sigma = 1)

fit <- psvr_rmspe(X, y, kernel = K, gamma = 100)
predict(fit, X[1:3, , drop = FALSE])
#> [1] 0.9189556 0.7369731 0.8524386

# Even-symmetric variant (Model 4): f(x) = f(-x).
fit_sym <- psvr_rmspe(X, y, sym_type = "even", kernel = K, gamma = 100)
predict(fit_sym, X[1:3, , drop = FALSE])
#> [1] 1.1583805 0.7439030 0.5084087