# create a completely empty NMF object
new('NMFOffset')
# create a NMF object based on random (compatible) matrices
n <- 50; r <- 3; p <- 20
w <- matrix(runif(n*r), n, r)
h <- matrix(runif(r*p), r, p)
nmfModel(model='NMFOffset', W=w, H=h, offset=rep(0.5, nrow(w)))
# apply Nonsmooth NMF algorithm to a random target matrix
V <- matrix(runif(n*p), n, p)
nmf(V, r, 'offset')
Run the code above in your browser using DataLab