Package src :: Package stats306b :: Package lecture9 :: Module nnmf :: Class EM
[hide private]
[frames] | no frames]

Class EM

source code

object --+    
         |    
      NNMF --+
             |
            EM

An EM algorithm for non-negative matrix factorization (NNMF).

This is EXACTLY the same as using the KL divergence from Lee & Seung.

The model is:

X[i,j] ~ Poisson(mu[i,j])

with X[i,j]'s independent with

mu[i,j] = sum(W[i,l] * H[l,j], l=1...k)

where the entries of W and H are non-negative.

The complete data for this EM is

(X,X1,...,Xk)

where

X = X1 + ... + Xk

Xl[i,j] ~ Poisson(W[i,l] * H[l,j])

Instance Methods [hide private]
 
E(self, W, H)
E-step:
source code
 
M(self, pX)
Fits rank one independence models to each pseudo X.
source code
 
logL(self, mu)
log Likelihood for the Poisson model, ignoring the factorial term.
source code
 
deviance(self, mu)
Deviance for the given estimate of mu.
source code
 
fit(self, normalize=False, initial=None, iter=500)
EM algorithm fit for NMF.
source code

Inherited from NNMF: __init__, cost, initialize, normalize, update

Inherited from NNMF (private): _getdf

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]

Inherited from NNMF: maxit

Properties [hide private]

Inherited from NNMF: df

Inherited from object: __class__

Method Details [hide private]

E(self, W, H)

source code 

E-step:

Conditional on X, the unobserved matrices X=X1+...+Xk have entries that are independent multinomials.

Since logL is linear in the Xl[i,j]'s, we just have to compute the conditional expecation of Xl[i,j]|X[i,j], l=1,...,k given our current estimates of the means of the Xl[i,j]'s.

This results in l 'pseudo' X matrices.

fit(self, normalize=False, initial=None, iter=500)

source code 
EM algorithm fit for NMF.
Overrides: NNMF.fit