| nmfkc.signed | R Documentation |
Solves
Y \approx X\,\Theta\,A,\qquad X \ge 0,\;\Theta\in\R^{Q\times D},
\;A\in\R^{D\times N},
where the covariate matrix A and the coefficient matrix
\Theta may be signed. Internally A = A_{+} - A_{-}
and \Theta = C_{+} - C_{-} with A_{\pm}, C_{\pm} \ge 0
(sign-splitting trick, Ding et al. 2010), and the problem is solved
by a Direct Multiplicative Update algorithm whose iteration cost is
O(Q D^2), independent of N.
Only X is structurally constrained to be non-negative (Semi-NMF
sense of Ding, Li, & Jordan 2010). In particular, Y may
contain negative entries, in which case the response is fit in the
least-squares sense without any non-negativity requirement on Y.
When A \ge 0 (so A_{-} = 0), the result reduces to
nmfkc(Y, A, rank) with Euclidean loss, up to reordering.
nmfkc.signed(
Y,
A,
rank = NULL,
epsilon = 1e-04,
maxit = 5000,
verbose = TRUE,
...
)
Y |
Real-valued |
A |
Real-valued |
rank |
Integer. Number of latent components |
epsilon |
Relative convergence tolerance on the objective
(default |
maxit |
Maximum number of iterations (default |
verbose |
Logical. Print dimensions at start (default |
... |
Additional arguments:
|
An object of class c("nmfkc.signed", "nmfkc") with
X: Q_{\mathrm{obs}} \times Q basis matrix (non-negative,
column-normalized according to X.restriction).
Cp, Cn: Q \times D non-negative parts of
\Theta, so that \Theta = C_{+} - C_{-}.
C: C_{+} - C_{-} (= \Theta), signed.
B: C \, A, Q \times N (signed).
objfunc.iter: objective values per iteration.
objfunc: final objective.
r.squared: \mathrm{cor}(Y, \widehat Y)^2 (Pearson; in [0,1]).
r.squared.uncentered: uncentered R^2 = 1 - \|Y - \widehat Y\|_F^2 / \|Y\|_F^2 (baseline = zero matrix).
r.squared.centered: row-mean centered 1 - \|Y - \widehat Y\|_F^2 / \|Y - \bar Y_{p\cdot}\|_F^2.
mae: mean absolute error.
iter: number of iterations performed.
runtime: elapsed seconds.
Y.signed: logical; whether Y contained negative
entries during fitting.
pars: RFF generating parameters, if supplied.
call: the matched call.
This function is experimental. The interface may change in future versions.
Ding, C. H. Q., Li, T., & Jordan, M. I. (2010). Convex and semi-nonnegative matrix factorizations. IEEE TPAMI, 32(1), 45–55.
Rahimi, A., & Recht, B. (2007). Random features for large-scale kernel machines. Advances in NIPS, 20.
nmfkc, predict.nmfkc.signed
set.seed(1)
## Example 1: signed A (e.g., hand-built RFF features), non-negative Y
## Build simple signed features Z = sqrt(2/D) * cos(omega^T U + b):
U <- matrix(stats::rnorm(5 * 40), 5, 40) # raw input
D <- 20 # feature dim
omega <- matrix(stats::rnorm(5 * D), 5, D) # random freqs
b <- stats::runif(D, 0, 2 * pi) # phase
Z <- sqrt(2 / D) *
cos(t(omega) %*% U + matrix(b, D, 40)) # D x 40, signed
Y <- matrix(abs(stats::rnorm(8 * 40)), 8, 40)
res1 <- nmfkc.signed(Y, A = Z, rank = 3, maxit = 200)
## Example 2: signed Y (regression)
Y2 <- matrix(stats::rnorm(8 * 40), 8, 40) # signed response
res2 <- nmfkc.signed(Y2, A = Z, rank = 3, maxit = 200,
warm.start = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.