Description Usage Arguments Details Value Methods Automatically choosing a fast SVD algorithm Setting a session-wide default Author(s) See Also Examples
Classes for specifying the type of singular value decomposition (SVD) algorithm and associated parameters.
1 2 3 4 5 6 7 8 9 | ExactParam(deferred=FALSE, fold=Inf)
IrlbaParam(deferred=FALSE, fold=Inf, extra.work=7, ...)
RandomParam(deferred=FALSE, fold=Inf, ...)
FastAutoParam(deferred=FALSE, fold=Inf)
bsparam()
|
deferred |
Logical scalar indicating whether centering/scaling should be deferred, see |
fold |
Numeric scalar specifying the minimum fold-difference for cross-product calculation, see |
extra.work |
Integer scalar, additional dimensionality of the workspace in |
... |
Additional arguments to pass to |
The BiocSingularParam class controls dispatch of the runSVD
generic to specific algorithms for SVD.
The BiocSingularParam class itself is virtual, with several concrete subclasses available in this package:
ExactParam
: exact SVD with runExactSVD
.
IrlbaParam
: approximate SVD with irlba via runIrlbaSVD
.
RandomParam
: approximate SVD with rsvd via runRandomSVD
.
FastAutoParam
: fast approximate SVD, chosen based on the matrix representation.
These objects also hold parameters specifying how each algorithm should be run on an arbitrary data set. See the associated documentation pages for each specific SVD method for more details.
Each constructor returns a BiocSingularParam subclass of the same type, containing the specified parameters.
In the following code snippets, x
is a BiocSingularParam object.
show(object)
:Display the class of object
and a summary of the set parameters.
bsfold(object)
:Return a numeric scalar specifying the fold-difference for cross-product calculation,
see “Computing the cross-product” in ?"BiocSingular-options"
.
bsdeferred(object)
:Return a logical scalar indicating whether centering and scaling should be deferred.
see “Deferred centering and scaling” in ?"BiocSingular-options"
.
Running runSVD
with a FastAutoParam object will dispatch to runIrlbaSVD
for most matrices.
This is the default choice as IRLBA is fast and the approximation is highly similar to the exact SVD result.
The exception is that of instances of the DelayedMatrix class, or any subclass that lacks its own specialized %*%
method.
In such cases, runSVD
with a FastAutoParam will dispatch to runRandomSVD
, which minimizes the number of matrix multiplication steps and the associated costly block processing.
However, if a DelayedMatrix subclass has its own %*%
method, it is assumed to be efficient enough to afford repeated multiplications in runIrlbaSVD
.
bsparam()
will return a session-wide value for the BiocSingularParam object, analogous to bpparam()
.
This defaults to a FastAutoParam object but can be modified by setting the "BiocSingularParam.default"
global option to any BiocSingularParam object.
Any code that uses bsparam()
will automatically use this new default without needing to explicitly pass the BiocSingularParam object to those functions.
Aaron Lun
runSVD
for generic dispatch.
runExactSVD
, runIrlbaSVD
and runRandomSVD
for specific methods.
1 2 3 4 5 6 7 8 9 10 | ExactParam()
IrlbaParam(tol=1e-8)
RandomParam(q=20)
# Modifying the default.
bsparam()
options(BiocSingularParam.default=IrlbaParam())
bsparam()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.