nmfkc.kernel: Create a kernel matrix from covariates

View source: R/nmfkc.R

nmfkc.kernelR Documentation

Create a kernel matrix from covariates

Description

nmfkc.kernel constructs a kernel matrix from covariate matrices. It supports Gaussian, Exponential, Periodic, Linear, Normalized Linear, and Polynomial kernels.

Usage

nmfkc.kernel(
  U,
  V = NULL,
  kernel = c("Gaussian", "Exponential", "Periodic", "Linear", "NormalizedLinear",
    "Polynomial"),
  ...
)

Arguments

U

Covariate matrix U(K,N) = (u_1, \dots, u_N). Each row may be normalized in advance.

V

Covariate matrix V(K,M) = (v_1, \dots, v_M), typically used for prediction. If NULL, the default is U.

kernel

Kernel function to use. Default is "Gaussian". Options are "Gaussian", "Exponential", "Periodic", "Linear", "NormalizedLinear", and "Polynomial".

...

Additional arguments passed to the specific kernel function (e.g., beta, degree).

Value

Kernel matrix A(N,M).

Source

Satoh, K. (2024). Applying Non-negative Matrix Factorization with Covariates to the Longitudinal Data as Growth Curve Model. arXiv preprint arXiv:2403.05359. https://arxiv.org/abs/2403.05359

See Also

nmfkc.kernel.gaussian, nmfkc.cv

Examples

# Example.
Y <- matrix(cars$dist,nrow=1)
U <- matrix(c(5,10,15,20,25),nrow=1)
V <- matrix(cars$speed,nrow=1)
A <- nmfkc.kernel(U,V,beta=28/1000)
dim(A)
result <- nmfkc(Y,A,rank=1)
plot(as.vector(V),as.vector(Y))
lines(as.vector(V),as.vector(result$XB),col=2,lwd=2)

nmfkc documentation built on July 14, 2026, 1:07 a.m.