Description Extends Warning Fields Methods Author(s) References See Also Examples
Provides a reference class that implements the self-organising-deltoids
(SOD) multi-dimensional-scaling algorithm (MDS) using openMP to
provide parallel execution on multiple CPU cores.
New objects are made by calling the initializer using either
DimSqueezer$new(m)
or new("DimSqueezer", m)
.
The initializer returns an object from which the methods and fields
can be accessed using the $
operator. See the examples section for usage.
All reference classes extend and inherit methods from "envRefClass"
.
This is a reference class that does not follow normal R semantic
rules. Copying objects does not make new copies, but additional
references. See ?setRefClass
for more details.
This class keeps an external pointer to a C++ object. This object
will be destroyed at the end of a session. If you wish to use it
after reloading a session you will need to recreate the
object. This can be done using the data.matrix field of the
object (for a DimSqueezer object called ds)
ds <- DimSqueezer$new( ds$data.matrix )
pointer
:Object of class externalptr
that refers to the C++ DimSqueezer object (read only).
data.matrix
:Object of class matrix
a numeric matrix used to create the DimSqueezer.
initialize(m)
:Initializes the object. m should be a numeric matrix (use by calling new as in examples).
squeeze(target_dim, iter_no)
: Squeezes points into
target_dim
dimensions in iter_no
iterations. By
default the function will continue iterating until no more stress
is removed. This can be changed by residual(FALSE)
.
Returns a
named list of class sod_sq3
containing the new coordinates in $pos
, the
stress evolution in $stress
, the mapping dimensionality in
$mapDims
and the stress (sum error) at each node in
$node_stress
.
squeezeDF(dimFactors)
: Squeezes points using a
reduction in dimensions as specifed by the numeric matrix
dimFactors
, which can be obtained from the
*DimFactors
functions. Returns a named list as for squeeze
.
useOpenMP(useOMP)
: Specify whether to use openMP
based parallelisation. useOMP
should be either TRUE
or
FALSE
.
setThreadNo(threadNo)
: Specify the number of threads
that will be used with openMP. If threadNo
is smaller than
1 or larger than the reported number of processor cores it will
default to the number of cores available.
residual(remResidual)
: Specify whether residual
stress should be removed by further iterations after the specified
number of iterations (the default state). remResidual
should be TRUE
or FALSE
.
Martin Jakt
http://martin.jakt.org.uk/r-sod/
DimSqueezer_CL
serialDimFactors
parallelDimFactors
parallelExpDimFactors
sod_sq3
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 | showClass("DimSqueezer")
## get the attached data f186
data(f186)
## columns 7:12 contain data of the same type
## see the documentation for f186
m <- as.matrix(f186[,7:12])
## reduce the number of objects to speed up automated
## checks.
r <- 1:100
ds <- new("DimSqueezer", m[r,])
## equivalent to
## ds <- DimSqueezer$new( m[r,] )
## to inspect the data matrix
summary(ds$data.matrix)
## For CRAN automated checks set the number of threads to use to
## two
ds$setThreadNo(2)
## squeeze our the superfluous dimensions using 200 iterations
sq <- ds$squeeze(2, 200)
plotPoints(sq)
## with more informative colours
plotPoints(sq, col=hsvScale(f186[,"Etv2"]), pch=19, cex=1.5)
## or for a fancy plot
plotConcentric(sq, cex.data=f186[r,7:12], leg.pos="topleft")
## to see the stress evolution
plotStress(sq)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.