Custom classes

The class STNMF serves as an interface exposing relevant subunit properties and easing the use of the underlying factorization. By default, it encapsulates the matrix factorization class stnmf.mf.SparseSemiNMF which inherits from the abstract base class stnmf.mf.MF.

The decoupling of classes allows to use custom or modified algorithms to implement the matrix factorization, including different factorization updates and constraints.

When creating a new class it should inherit any of the existing classes stnmf.mf but at least the base class stnmf.mf.MF. At minimum, the class should provide an implementation of the function stnmf.mf.MF.update_w() but may also override any other attributes and methods.

A custom class my_class can be specified when using STNMF as the argument method like so:

>>> from stnmf import STNMF
>>> STNMF(ste, method=my_class)

Note, however, that this interface of custom implementations only serves for advanced usage. Instead, we encourage active discussion on Github or in direct correspondence should limitations or bugs arise.