t
transpose an NMF model, by transposing and swapping its basis and
coefficient matrices: t([W,H]) = [t(H), t(W)]
.
S3 (NMF)
`t`(x)
The function t
is a generic defined in the base package.
The method t.NMF
defines the trasnformation for the general NMF interface.
This method may need to be overloaded for NMF models, whose structure requires
specific handling.
x <- rnmf(3, 100, 20)
x
## <Object of class:NMFstd>
## features: 100
## basis/rank: 3
## samples: 20
# transpose
y <- t(x)
y
## <Object of class:NMFstd>
## features: 20
## basis/rank: 3
## samples: 100
# factors are swapped-transposed
stopifnot( identical(basis(y), t(coef(x))) )
stopifnot( identical(coef(y), t(basis(x))) )