advanced {NMF}R Documentation

Advanced usage of package NMF

Description

Allow the user to get/set/define package NMF specific options in the same way as with base functions options and getOption.

Usage


nmf.options(..., runtime = FALSE)
nmf.getOption(name)
nmf.options.reset()
nmf.options.runtime()

nmf.models(builtin.only=FALSE)

Arguments

... any options can be defined, using 'name = value' or by passing a list of such tagged values. However, only the ones below are used in package NMF. Further, 'nmf.options('name') == nmf.options()['name']', see the example.
builtin.only a single logical. If TRUE only built-in NMF models are returned.
name a character string holding an option name.
runtime a boolean used to specify if main interface function nmf should store the option into the initial NMF object before performing the computation.

Details

nmf.getOption
get the value of a single option.
nmf.models
returns the available NMF models. These are exactly the classes that inherits from class NMF. If argument builtin.only is TRUE then only the models that are defined within the package are returned.
nmf.options
gets/sets/defines options in the way of base function options. Invoking 'nmf.options()' with no arguments returns a list with the current values of the options. To access the value of a single option, one should use nmf.getOption("error.track"), e.g., rather than nmf.options("error.track") which is a list of length one.
nmf.options.reset
Reset all built-in options to their default values. Note that only built-in are reset. The options defined by the user during the current session will keep their values.

Value

For nmf.getOption, the current value set for option name, or NULL if the option is unset.
For nmf.options(), a list of all set options sorted by name. For options(name), a list of length one containing the set value, or NULL if it is unset. For uses setting one or more options, a list with the previous values of the options changed (returned invisibly).
For nmf.models, a character vector listing the available NMF models.

Options set in package NMF

debug
logical. Similar to option 'verbose' (see below), but reports more information.
error.track
logical. Should the estimation error be tracked during the computations? If set to TRUE then the error track can be plotted using method errorPlot. The step size of the error track is set via option track.interval (see below).
track.interval
numeric. The number of iterations performed between two consecutive error points. For performance reason, this value should be too small, as the computation of the estimation error can be time consuming (Default value is 30).
verbose
logical. Should R report extra information about the computations?

Author(s)

Renaud Gaujoux renaud@cbio.uct.ac.za

See Also

options

Examples


        # save all options value 
        op <- nmf.options(); 
        utils::str(op) # op may contain functions.

    nmf.getOption("track.interval") == nmf.options()$track.interval # the latter needs more memory
    
    x <- matrix(runif(50*10), 50, 10) # create a random target matrix
    # or define a synthetic data with a hidden pattern using function syntheticNMF (see ?syntheticNMF) 
    ## Not run: x <- syntheticNMF(50, 5, 10, noise=TRUE)
    
    # perform default NMF computation
    res <- nmf(x, 3)
    
    # Toogle on verbose mode
    nmf.options(verbose = TRUE)    
    res <- nmf(x, 3)    

        # Toogle on debug mode
    nmf.options(debug = TRUE)    
    res <- nmf(x, 3)

    # set the error track step size, and save previous value
    old.o <- nmf.options(track.interval = 5)
    old.o
    
    # check options
    utils::str(nmf.options())
    # reset to default values
    nmf.options.reset()
    utils::str(nmf.options())
        

[Package NMF version 0.2.4 Index]