Hello,

I try reproduce custom algorithm from NMF package tutorial on simple
simulation data from the package:

n <- 50; r <- 3; p <- 20

V <-syntheticNMF(n, r, p, noise=TRUE)

nmf(V, 3, my.algorithm, scale.factor=10)
But I get the following error:

Error in metagenes(fit(seed)) <- abs(pca$rotation[, 1:factorization.rank]) :

  could not find function "metagenes<-"

What is wrong here?

This is the algorithm:

my.algorithm <- function(x, seed, scale.factor=1){

# do something with starting point

# for example:

# 1. compute principal components

pca <- prcomp(t(x), retx=TRUE)

# 2. use the absolute values of the first PCs for the metagenes

# Note: the factorization rank is stored in object 'start'

factorization.rank <- nbasis(seed)

metagenes(fit(seed)) <- abs(pca$rotation[,1:factorization.rank])

# use the rotated matrix to get the mixture coefficient

# use a scaling factor (just to illustrate the use of extra parameters)

metaprofiles(fit(seed)) <- t(abs(pca$x[,1:factorization.rank])) /
scale.factor

# return updated data

return(seed)

}





Thanks!

Pavel

	[[alternative HTML version deleted]]

