Title: | Non-Negative Matrix Factorization |
---|---|
Description: | Non-negative Matrix Factorization. |
Authors: | Suhai (Timothy) Liu |
Maintainer: | Suhai (Timothy) Liu <[email protected]> |
License: | GPL |
Version: | 2.0.1 |
Built: | 2025-02-22 04:24:14 UTC |
Source: | https://github.com/cran/NMFN |
Non-negative Matrix Factorization
Package: | NMFN |
Type: | Package |
Version: | 2.0 |
Date: | 2010-01-02 |
License: | GPL |
LazyLoad: | yes |
Suhai (Timothy) Liu <[email protected]> based on multiplicative updates (Lee and Seung 2001), alternating least squares and multinomial algorithms; Lars Kai Hansen's nnmf_als Matlab implementation; Torsten Hothorn's Moore-Penrose inverse function
Lee and Seung - Algorithms for non-negative matrix factorization. In Advances in Neural Information Processing Systems 13, 2001.
X <- matrix(1:12,3,4) z.mm <- nnmf(X,3) # 3 factors via multiplicative update z.als <- nnmf(X,3,'nnmf_als') # 3 factors via alternating least square z.prob <- nnmf(X,3,'nnmf_prob') # 3 factors via multinomial
X <- matrix(1:12,3,4) z.mm <- nnmf(X,3) # 3 factors via multiplicative update z.als <- nnmf(X,3,'nnmf_als') # 3 factors via alternating least square z.prob <- nnmf(X,3,'nnmf_prob') # 3 factors via multinomial
Euclidean Distance between two matrices
distance2(x1, x2)
distance2(x1, x2)
x1 |
Matrix 1 |
x2 |
Matrix 2 |
Suhai (Timothy) Liu
X<-matrix(1:12,3,4) Y<-matrix(5:16,3,4) distance2(X,Y)
X<-matrix(1:12,3,4) Y<-matrix(5:16,3,4) distance2(X,Y)
Moore-Penrose Inverse
mpinv(X)
mpinv(X)
X |
original matrix |
Torsten Hothorn
X<-matrix(1:12,3,4) m.inv = mpinv(X)
X<-matrix(1:12,3,4) m.inv = mpinv(X)
Non-negative Matrix Factorization
nnmf(x, k, method = "nnmf_mm", maxiter = 1000, eps = 2.2204e-16)
nnmf(x, k, method = "nnmf_mm", maxiter = 1000, eps = 2.2204e-16)
x |
original input matrix |
k |
number of factors / components |
method |
which method to use for matrix factorization (default - multiplicative update) |
maxiter |
max number of iterations |
eps |
small threshold value |
Suhai (TImothy) Liu
X <- matrix(1:12,3,4) z.mm <- nnmf(X,3) # 3 factors via multiplicative update z.als <- nnmf(X,3,'nnmf_als') # 3 factors via alternating least square z.prob <- nnmf(X,3,'nnmf_prob') # 3 factors via multinomial
X <- matrix(1:12,3,4) z.mm <- nnmf(X,3) # 3 factors via multiplicative update z.als <- nnmf(X,3,'nnmf_als') # 3 factors via alternating least square z.prob <- nnmf(X,3,'nnmf_prob') # 3 factors via multinomial
Non-negative Matrix Factorization - alternating least squares method
nnmf_als(x, k, maxiter, eps)
nnmf_als(x, k, maxiter, eps)
x |
original input matrix |
k |
number of factors / components |
maxiter |
max number of iterations |
eps |
small threshold value |
W, H - returned decomposed matrices
Suhai (Timothy) Liu
X <- matrix(1:12, 3, 4) results <- nnmf(X, 2, 'nnmf_als')
X <- matrix(1:12, 3, 4) results <- nnmf(X, 2, 'nnmf_als')
Non-negative Matrix Factorization - multiplicative update method
nnmf_mm(x, k, maxiter, eps)
nnmf_mm(x, k, maxiter, eps)
x |
original input matrix |
k |
number of factors / components |
maxiter |
max number of iterations |
eps |
small threshold value |
W, H - returned decomposed matrices
Suhai (Timothy) Liu
Lee and Sung 2001
X <- matrix(1:12, 3, 4) results <- nnmf(X, 2) #which is equivalent to results <- nnmf(X, 2, 'nnmf_mm')
X <- matrix(1:12, 3, 4) results <- nnmf(X, 2) #which is equivalent to results <- nnmf(X, 2, 'nnmf_mm')
Non-negative Matrix Factorization - multinomial method
nnmf_prob(x, k, maxiter, eps)
nnmf_prob(x, k, maxiter, eps)
x |
original input matrix |
k |
number of factors / components |
maxiter |
max number of iterations |
eps |
small threshold value |
W, H - returned decomposed matrices
Suhai (Timothy) Liu
X <- matrix(1:12, 3, 4) results <- nnmf(X, 5, 'nnmf_prob')
X <- matrix(1:12, 3, 4) results <- nnmf(X, 5, 'nnmf_prob')