nmfkc.kernel.beta.cv: Optimize beta of the Gaussian kernel function by...

View source: R/nmfkc.R

nmfkc.kernel.beta.cvR Documentation

Optimize beta of the Gaussian kernel function by cross-validation

Description

nmfkc.kernel.beta.cv selects the optimal beta parameter of the kernel function by applying cross-validation over a set of candidate values.

Usage

nmfkc.kernel.beta.cv(Y, rank = 2, U, V = NULL, beta = NULL, plot = TRUE, ...)

Arguments

Y

Observation matrix Y(P,N).

rank

Rank of the basis matrix.

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.

beta

A numeric vector of candidate kernel parameters to evaluate via cross-validation.

plot

Logical. If TRUE (default), plots the objective function values for each candidate beta.

...

Additional arguments passed to nmfkc.cv.

Value

A list with components:

beta

The beta value that minimizes the cross-validation objective function.

objfunc

Objective function values for each candidate beta.

See Also

nmfkc.kernel.gaussian, nmfkc.kernel.beta.nearest.med, nmfkc.kernel

Examples

# Example.
Y <- matrix(cars$dist,nrow=1)
U <- matrix(c(5,10,15,20,25),nrow=1)
V <- matrix(cars$speed,nrow=1)
nmfkc.kernel.beta.cv(Y,rank=1,U,V,beta=25:30/1000)
A <- nmfkc.kernel(U,V,beta=28/1000)
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.