
Computes samples silhouette score from method output
Source:R/methods_evaluation.R
compute_samples_silhouette.RdCalculates the samples silhouette width from the results of a dimension
reduction method, according to some samples grouping from the samples
metadata of a MultiDataSet object.
Usage
compute_samples_silhouette(
method_output,
mo_data,
group_col,
latent_dimensions = NULL,
distance_metric = c("euclidean", "maximum", "manhattan", "canberra", "binary",
"minkowski")
)Arguments
- method_output
method_output Integration method output generated via the
get_output()function.- mo_data
A
MultiDataSet-classobject.- group_col
Character, name of the column in one of the samples metadata table from
mo_datacontaining the samples grouping to be used.- latent_dimensions
Character vector, the latent dimensions to use for computing distance between samples. If
NULL(default value), all latent dimensions will be used.- distance_metric
Character, name of the metric to use when computing the distance between samples from their coordinates in the latent dimensions. This will be passed to the
stats::dist()function. Options include:"euclidean"(default value),"maximum","manhattan","canberra","binary"or"minkowski".
Value
A list with two elements:
samples_silhouette: a tibble giving for each sample (sample_idcolumn) the group to which it belongs (groupcolumn), its closest (other) group in the space spanned by the latent dimensions (neighbour_group), and its silhouette width (silhouette_widthcolumn).groups_average_silhouette: a tibble giving for each samples group (groupcolumn) its average silhouette width (group_average_widthcolumn).
Details
The samples silhouette width and groups average width are calculated using
the cluster::silhouette() function.