---
title: 'GRKneg: Negative-Augmented OC-SVM Kernel'
url: https://www.emergentmind.com/topics/generalized-reference-kernel-grkneg
type: topic
---

# GRKneg: Negative-Augmented OC-SVM Kernel

A Generalized Reference Kernel with Negative Samples (GRKneg) is a kernel engineering technique for one-class support vector machines (OC-SVM) designed to leverage small sets of labeled negative samples to enhance outlier detection accuracy. Unlike classical OC-SVM, which constructs kernels solely from positive class data, GRKneg constructs a kernel that incorporates both actual and generated negative examples, thereby regularizing and reshaping the feature space in a principled manner while retaining compatibility with standard OC-SVM solvers. This approach demonstrates significant empirical improvements in low-negative-sample regimes, offering a drop-in replacement for the base RBF kernel in one-class classification tasks [2506.14895].

## 1. Mathematical Formulation

Let $P = \{p_1, ..., p_P\} \subset \mathbb{R}^d$ denote the positive (inlier) training set, $N = \{n_1, ..., n_N\} \subset \mathbb{R}^d$ the available negative (outlier) training set, and $\widetilde{k}(x, y)$ the base kernel, frequently chosen as RBF. The GRKneg approach forms an augmented reference vector set
$$
R_{\text{ref}} = N \cup M, \quad |R_{\text{ref}}| = N + G,
$$
where $M = \{m_1, ..., m_G\}$ are $G$ generated negatives sampled independently from a Gaussian $\mathcal{N}(\mu_{\text{neg}}, \Sigma_{\text{neg}})$, with $\mu_{\text{neg}} = \mathrm{mean}(N)$ and $\Sigma_{\text{neg}} = \mathrm{diag}(\mathrm{std}(N)^2)$.

The centered reference-reference and reference-positive kernel matrices,
\[
\widetilde{K}_{RR},\ \widetilde{K}_{RP},
\]
are computed and centered via
\[
H_R = I_R - \frac{1}{R} \mathbf{1}_R \mathbf{1}_R^\top
\]
to obtain $\widetilde{K}_{RR}^{\text{centered}}$ and $\widetilde{K}_{RP}^{\text{centered}}$.

The GRKneg kernel matrix on the positive set is
\[
K_{\text{GRKneg}}(P, P) = \widetilde{K}_{RP}^{\text{centered} \top} \, \widetilde{K}_{RR}^+ \, \widetilde{K}_{RP}^{\text{centered}}
\]
where $\widetilde{K}_{RR}^+$ is the Moore–Penrose pseudoinverse, computed using eigen-decomposition with only nonzero eigenvalues retained.

For any $x, y \in \mathbb{R}^d$, the GRKneg kernel is given by
\[
k_{\text{GRKneg}}(x, y) = [\widetilde{k}_R(x)]^\top \widetilde{K}_{RR}^+ \widetilde{k}_R(y),
\]
with $[\widetilde{k}_R(x)]_i = \widetilde{k}(r_i, x)$ after centering. This construction is a valid Mercer kernel and defines an implicit mapping
\[
\varphi_{\text{GRKneg}}(x) = \widetilde{K}_{RR}^{+1/2} \widetilde{k}_R(x).
\]
No additional explicit regularization is introduced apart from spectral thresholding in the pseudoinverse [2506.14895, 2205.00534].

## 2. Reference Vector Generation and Selection

Nine reference vector selection/generation strategies were evaluated. The optimal variant concatenates the original $N$ negative training samples and $G=P$ generated negatives from $\mathcal{N}(\mu_{\text{neg}}, \sigma_{\text{neg}}^2)$. The process is:

1. Compute $\mu_{\text{neg}}, \sigma_{\text{neg}}$ from negatives.
2. Generate $P$ synthetic negatives $m_j \sim \mathcal{N}(\mu_{\text{neg}}, \sigma_{\text{neg}}^2)$.
3. Concatenate $n_1, ..., n_N, m_1, ..., m_P$ to form $R_{\text{ref}}$ ($R = N + P$).
4. Construct and center the kernel matrices as previously specified.
5. Perform eigen-decomposition and compute the pseudoinverse.
6. Form the final GRKneg kernel matrix.

Using only positives as references was found to be ineffective for OC-SVM, while using a mixture of true and generated negatives maximized kernel informativeness, particularly when real negatives are scarce [2506.14895].

## 3. Integration with OC-SVM Framework

GRKneg serves as a direct replacement for the conventional kernel in standard OC-SVM pipelines. The OC-SVM dual maximization for $\nu$-SVM remains:
\[
\max_{\alpha \in \mathbb{R}^P} W(\alpha) = -\frac{1}{2} \sum_{i, j=1}^P \alpha_i \alpha_j k_{\text{GRKneg}}(p_i, p_j)
\]
subject to $0 \leq \alpha_i \leq 1/(\nu P)$, $\sum_{i=1}^P \alpha_i = 1$.

All other algorithmic details, including parameter $\nu$, thresholding, and solver mechanics, are unchanged from standard OC-SVM usage; only the kernel is replaced [2506.14895].

## 4. Algorithmic Workflow

The GRKneg process comprises four main stages:

- **Preprocessing:** Standardize all positive samples and negative samples using positive-set statistics.
- **Reference Kernel Construction:**
  1. Estimate $\mu_{\text{neg}}, \sigma_{\text{neg}}$.
  2. Generate $P$ synthetic negatives.
  3. Build $R_{\text{ref}}$, form and center the $R \times R$ and $R \times P$ base kernel matrices.
  4. Perform spectral decomposition and compute pseudoinverse to construct $K_{\text{GRKneg}}(P, P)$.
- **OC-SVM Model Training:** Use $K_{\text{GRKneg}}(P, P)$ and parameter $\nu$ in standard OC-SVM dual optimization to obtain $\alpha_i$, threshold $\rho$.
- **Testing:** For a test point $y$, compute the centered $\widetilde{k}_R(y)$ vector, assemble $K_{\text{GRKneg}}(P, y)$, and apply the OC-SVM scoring rule: $f(y) = \sum_i \alpha_i K_{\text{GRKneg}}(p_i, y) - \rho$; classify as an outlier if $f(y) < 0$ [2506.14895].

## 5. Hyperparameterization and Implementation

Principal parameters and settings include:
- Base-kernel bandwidth $\sigma = \sqrt{s \cdot d_{\text{avg}}}$, with $d_{\text{avg}}$ the mean squared distance among training samples, and $s$ swept over $\{10^{-1}, ..., 10^3\}$.
- OC-SVM parameter $\nu \in \{0.05, 0.1, 0.15, 0.2\}$.
- Number of generated negative samples $G = P$.
- Eigenvalue truncation: retain nonzero eigenvalues (as in LIBSVM pseudo-inverse defaults).
- Parameter selection via 5-fold cross-validation within training data.

Implementation is realized in MATLAB and LIBSVM via custom precomputed kernels (option $-t\ 4$) [2506.14895].

## 6. Empirical Evaluation

Experiments were performed across 14 one-class benchmarks (UCI Iris, Seeds, Ionosphere, Sonar, Bankruptcy, Happiness) at negative counts $5, 10, 20, 30, \text{all}$. The geometric mean (Gmean $= \sqrt{\text{TPR} \cdot \text{TNR}}$) was the principal metric.

Key findings, averaged across tasks, include:

| Negatives | SVM (Binary) | OC-SVM (RBF) | GRKneg (Variant 7) | GRK-Only Negatives (Var 3) |
|-----------|--------------|--------------|--------------------|----------------------------|
| 5         | 70.0 ± 12.7  | 73.7 ± 6.1   | 79.5 ± 9.0         | 74.6 ± 7.4                 |
| 10        | 76.4 ± 5.9   | 75.0 ± 4.7   | 81.9 ± 4.6         | 79.2 ± 6.7                 |
| 20        | 84.1 ± 3.2   | 75.9 ± 4.0   | 83.7 ± 4.1         | 82.8 ± 5.7                 |

For very small negative sample sizes ($5$ or $10$), GRKneg outperformed both baseline OC-SVM and classical binary SVM. For larger negative sets ($\geq 20$), binary SVM achieved the highest Gmean, but GRKneg remained competitive [2506.14895]. These patterns are consistent with general findings for negative-augmented GRK variants [2205.00534].

## 7. Interpretation, Limitations, and Future Directions

GRKneg enables OC-SVM to exploit small amounts of negative-label information to engineer the kernel space, resulting in significant accuracy gains in data-scarce, imbalance-prone outlier detection scenarios. The kernel implicitly regularizes the model via the spectrum of the reference Gram matrix and may be viewed as an extension of the generalized reference kernel (GRK) framework with negative augmentation [2205.00534].

Limitations include:
- Computational overhead due to the eigen-decomposition of the $(N + P) \times (N + P)$ reference Gram matrix.
- Reliance on a Gaussian approximation for the negative distribution, which may not capture complex outlier structures.
- Introduction of hyperparameters such as the number of generated negatives and the base kernel scale.

A plausible implication is that further advances can be achieved by employing more sophisticated negative-sample generation techniques (e.g., mixture models, adversarial sampling), adapting reference selection for multi-view or deep-feature scenarios, and benchmarking against other semi-supervised or class-imbalance–aware SVM variants.

GRKneg unifies and extends prior kernel approximation and regularization paradigms—Nyström approximation, the Non-linear Projection Trick, and random mapping—into a kernel construction paradigm that directly incorporates side information, notably negative samples, to robustly enhance one-class classification performance in practical settings where negative data are limited [2506.14895, 2205.00534].

Source: https://www.emergentmind.com/topics/generalized-reference-kernel-grkneg