The functions documented here tests different characteristics of NMF objects.
is.nmf tests if an object is an NMF model or a
class that extends the class NMF.
is.empty.nmf tests whether an
describes an empty NMF model, i.e. it contains no data.
hasBasis tests whether an objects contains a basis
matrix -- returned by a suitable method
with at least one row.
hasBasis tests whether an objects contains a
coefficient matrix -- returned by a suitable method
coef -- with at least one column.
is.partial.nmf tests whether an NMF model object
contains either an empty basis or coefficient matrix. It
is a shorcut for
!hasCoef(x) || !hasBasis(x).
isNMFfit tells if an object results from an NMF
is.nmf(x) is.empty.nmf(x, ...) hasBasis(x) hasCoef(x) is.partial.nmf(x) isNMFfit(object, recursive = TRUE)
objectis a plain list then
isNMFfittests each element of the list. Note that the recursive test only applies in the case of lists that are not themselves NMFfit objects, like
NMFfitXnobjects for which the result of
isNMFfitwill always be
TRUE, although they are list objects (a single logical value).
isNMFfit returns a
logical vector (or a
object is a list of list) of the same
is.nmf tests if
object is the name of a
class (if a
character string), or inherits from a
class, that extends
TRUE if the basis and
coefficient matrices of
x have respectively zero
rows and zero columns. It returns
In particular, this means that an empty model can still
have a non-zero number of basis components, i.e. a
factorization rank that is not null. This happens, for
example, in the case of NMF models created calling the
nmfModel with a value only
for the factorization rank.
isNMFfit checks if
object inherits from
NMFfitX-class, which are the two types of
objects returned by the function
object is a plain
recursive=TRUE, then the test is performed on each
element of the list, and the return value is a logical
vector (or a list if
object is a list of list) of
the same length as
is.nmf does some extra work with the
namespace as this function needs to return correct
results even when called in
discussion on r-devel: