| NMFStrategy {NMF} | R Documentation |
Factory Method for NMFStrategy Objects
Description
Creates NMFStrategy objects that wraps implementation of NMF algorithms into a unified interface.
Usage
NMFStrategy(name, method, ...)
## S4 method for signature 'NMFStrategy,matrix,NMFfit'
run(object, y, x,
...)
## S4 method for signature 'NMFStrategy,matrix,NMF'
run(object, y, x, ...)
## S4 method for signature 'NMFStrategyFunction,matrix,NMFfit'
run(object,
y, x, ...)
## S4 method for signature 'NMFStrategyIterative,matrix,NMFfit'
run(object,
y, x, .stop = NULL,
maxIter = nmf.getOption("maxIter") %||% 2000, ...)
## S4 method for signature 'NMFStrategyIterativeX,matrix,NMFfit'
run(object,
y, x, maxIter, ...)
## S4 method for signature 'NMFStrategyOctave,matrix,NMFfit'
run(object,
y, x, ...)
Arguments
name |
name/key of an NMF algorithm. |
method |
definition of the algorithm |
... |
extra arguments passed to |
.stop |
specification of a stopping criterion, that is used instead of the one associated to the NMF algorithm. It may be specified as:
|
maxIter |
maximum number of iterations to perform. |
object |
an object computed using some algorithm, or that describes an algorithm itself. |
y |
data object, e.g. a target matrix |
x |
a model object used as a starting point by the algorithm, e.g. a non-empty NMF model. |
Methods
- NMFStrategy
signature(name = "character", method = "function"): Creates anNMFStrategyFunctionobject that wraps the functionmethodinto a unified interface.methodmust be a function with signature(y="matrix", x="NMFfit", ...), and return an object of classNMFfit.- NMFStrategy
signature(name = "character", method = "NMFStrategy"): Creates anNMFStrategyobject based on a template object (Constructor-Copy).- NMFStrategy
signature(name = "NMFStrategy", method = "missing"): Creates anNMFStrategybased on a template object (Constructor-Copy), in particular it uses the same name.- NMFStrategy
signature(name = "missing", method = "character"): Creates anNMFStrategybased on a registered NMF algorithm that is used as a template (Constructor-Copy), in particular it uses the same name.It is a shortcut for
NMFStrategy(nmfAlgorithm(method, exact=TRUE), ...).- NMFStrategy
signature(name = "NULL", method = "NMFStrategy"): Creates anNMFStrategybased on a template object (Constructor-Copy) but using a randomly generated name.- NMFStrategy
signature(name = "character", method = "character"): Creates anNMFStrategybased on a registered NMF algorithm that is used as a template.- NMFStrategy
signature(name = "NULL", method = "character"): Creates anNMFStrategybased on a registered NMF algorithm (Constructor-Copy) using a randomly generated name.It is a shortcut for
NMFStrategy(NULL, nmfAlgorithm(method), ...).- NMFStrategy
signature(name = "character", method = "missing"): Creates an NMFStrategy, determining its type from the extra arguments passed in...: if there is an argument namedUpdatethen anNMFStrategyIterativeis created, or if there is an argument namedalgorithmthen anNMFStrategyFunctionis created. Calls other than these generates an error.- run
signature(object = "NMFStrategy", y = "matrix", x = "NMFfit"): Pure virtual method defined for all NMF algorithms to ensure that a methodrunis defined by sub-classes ofNMFStrategy.It throws an error if called directly.
- run
signature(object = "NMFStrategy", y = "matrix", x = "NMF"): Method to run an NMF algorithm directly starting from a given NMF model.- run
signature(object = "NMFStrategyFunction", y = "matrix", x = "NMFfit"): Runs the NMF algorithms implemented by the single R function – and stored in slot'algorithm'ofobject, on the data objecty, usingxas starting point. It is equivalent to callingobject@algorithm(y, x, ...).This method is usually not called directly, but only via the function
nmf, which takes care of many other details such as seeding the computation, handling RNG settings, or setting up parallelisation.- run
signature(object = "NMFStrategyIterative", y = "matrix", x = "NMFfit"): Runs an NMF iterative algorithm on a target matrixy.- run
signature(object = "NMFStrategyOctave", y = "matrix", x = "NMFfit"): Runs the NMF algorithms implemented by the Octave/Matlab function associated with the strategy – and stored in slot'algorithm'ofobject.This method is usually not called directly, but only via the function
nmf, which takes care of many other details such as seeding the computation, handling RNG settings, or setting up parallel computations.