psm {salso} | R Documentation |
Compute an Adjacency or Pairwise Similarity Matrix
Description
If only one sample is provided, this function computes an adjacency matrix,
i.e., a binary matrix whose (i,j)
element is one if and only if
elements i
and j
in the partition have the same cluster label. If
multiple samples are provided (as rows of the x
matrix), this function
computes the n
-by-n
matrix whose (i,j)
element gives the
relative frequency (i.e., estimated probability) that items i
and
j
are in the same subset (i.e., cluster). This is the mean of the
adjacency matrices of the provided samples.
Usage
psm(x, nCores = 0)
Arguments
x |
A |
nCores |
The number of CPU cores to use, i.e., the number of simultaneous runs at any given time. A value of zero indicates to use all cores on the system. |
Value
A n
-by-n
symmetric matrix whose (i,j)
element gives
the relative frequency that that items i
and j
are in the same
subset (i.e., cluster).
Examples
# For examples, use 'nCores=1' per CRAN rules, but in practice omit this.
data(iris.clusterings)
partition <- iris.clusterings[1,]
# R_CARGO \dontrun{
# R_CARGO # Example disabled since Cargo was not found when installing from source package.
# R_CARGO # You can still run the example if you install Cargo. Hint: cargo::install().
psm(partition, nCores=1)
# R_CARGO }
dim(iris.clusterings)
# R_CARGO \dontrun{
# R_CARGO # Example disabled since Cargo was not found when installing from source package.
# R_CARGO # You can still run the example if you install Cargo. Hint: cargo::install().
probs <- psm(iris.clusterings, nCores=1)
dim(probs)
probs[1:6, 1:6]
# R_CARGO }