algorithmic: Generic Interface for Algorithms

Description Usage Arguments Details Interface fo NMF algorithms Methods (by generic) Examples

Description

The functions documented here are S4 generics that define an general interface for – optimisation – algorithms.

This interface builds upon the broad definition of an algorithm as a workhorse function to which is associated auxiliary objects such as an underlying model or an objective function that measures the adequation of the model with observed data. It aims at complementing the interface provided by the stats package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
algorithm(object, ...)

algorithm(object, ...) <- value

seeding(object, ...)

seeding(object, ...) <- value

niter(object, ...)

niter(object, ...) <- value

nrun(object, ...)

## S4 method for signature 'ANY'
nrun(object)

objective(object, ...)

objective(object, ...) <- value

runtime(object, ...)

runtime.all(object, ...)

seqtime(object, ...)

modelname(object, ...)

## S4 method for signature 'ANY'
modelname(object)

run(object, y, x, ...)

logs(object, ...)

## S4 method for signature 'ANY'
logs(object)

compare(object, ...)

Arguments

object

an object computed using some algorithm, or that describes an algorithm itself.

...

extra arguments to allow extension

value

replacement value

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.

Details

algorithm and algorithm<- get/set an object that describes the algorithm used to compute another object, or with which it is associated. It may be a simple character string that gives the algorithm's names, or an object that includes the algorithm's definition itself (e.g. an NMFStrategy object).

seeding get/set the seeding method used to initialise the computation of an object, i.e. usually the function that sets the starting point of an algorithm.

niter and niter<- get/set the number of iterations performed to compute an object. The function niter<- would usually be called just before returning the result of an algorithm, when putting together data about the fit.

nrun returns the number of times the algorithm has been run to compute an object. Usually this will be 1, but may be be more if the algorithm involves multiple starting points.

objective and objective<- get/set the objective function associated with an object. Some methods for objective may also compute the objective value with respect to some target/observed data.

runtime returns the CPU time required to compute an object. This would generally be an object of class proc_time.

runtime.all returns the CPU time required to compute a collection of objects, e.g. a sequence of independent fits.

seqtime returns the sequential CPU time – that would be – required to compute a collection of objects. It would differ from runtime.all if the computations were performed in parallel.

modelname returns a the type of model associated with an object.

run calls the workhorse function that actually implements a strategy/algorithm, and run it on some data object.

logs returns the log messages output during the computation of an object.

compare compares objects obtained from running separate algorithms.

Interface fo NMF algorithms

This interface is implemented for NMF algorithms by the classes NMFfit, NMFfitX and NMFStrategy, and their respective sub-classes. The examples given in this documentation page are mainly based on this implementation.

Methods (by generic)

algorithm:

algorithm<-:

compare:

logs:

modelname:

niter:

niter<-:

nrun:

objective:

objective<-:

run:

runtime:

runtime.all:

seeding:

seqtime:

Examples

1
2
3
4
# get the type of an NMF model
modelname(nmfModel(3))
modelname(nmfModel(3, model='NMFns'))
modelname(nmfModel(3, model='NMFOffset'))

renozao/NMF documentation built on June 14, 2020, 9:35 p.m.