clustCPS: CPS Analysis for cluster validation..

View source: R/clustCPS.R

clustCPSR Documentation

CPS Analysis for cluster validation..

Description

Covering Point Set Analysis for validating clustering results. It conducts alignment among different results and then calculates the covering point set. The return contains several statistics which can be directly used as input for mplot or cplot. If you want to design your own workflow, you can use function CPS instead.

Usage

clustCPS(
  data,
  k,
  l = TRUE,
  pre = TRUE,
  noi = "after",
  cmethod = "kmeans",
  dimr = "PCA",
  vis = "tsne",
  ref = NULL,
  nPCA = 50,
  nEXP = 100
)

Arguments

data

– data given in a matrix format, where rows are samples, and columns are variables.

k

– number of clusters.

l

– logical. If True, log-transformation will be carried out on the data.

pre

– logical. If True, pre-dimension reduction will be carried out based on the variance.

noi

– adding noise before or after the dimension reduction, choosing between "before" and "after", default "after".

cmethod

– clustering method, choosing from "kmeans" and "mclust", default "kmeans".

dimr

– dimension reduction technique, choose from "none" and "PCA", default "PCA".

vis

– the visualization method to be used, such as "tsne" and "umap", default "tsne". Also, you can provide your own visualization coordinates in a numeric matrix of two columns.

ref

– optional, clustering result in a vector format and the first cluster is labeled as 1. If provided it will be used as the reference, if not we will generate one.

nPCA

– number of principal components to use, default 50.

nEXP

– number of perturbed clustering results for CPS Analysis, default 100.

Value

a list used for mplot or cplot, in which tight_all is the overall tightness, member is the matrix used for the membership plot, set is the matrix for the covering point set plot, tight is the vector of cluster-wise tightness, vis is the visualization coordinates, ref is the reference labels and topo is the topological relationship between clusters for point-wise uncertainty assessment.

Examples

# CPS Analysis on validation of clustering result
data(YAN)
# Suppose you generate the visualization coordinates on your own
x1=matrix(seq(1,nrow(YAN),1),ncol=1)
x2=matrix(seq(1,nrow(YAN),1),ncol=1)
# Using nEXP=50 for illustration, usually use nEXP greater 100
y=clustCPS(YAN[,1:100], k=7, l=FALSE, pre=FALSE, noi="after",vis=cbind(x1,x2), nEXP = 50)
# visualization of the results
mplot(y,4)

OTclust documentation built on Oct. 6, 2023, 5:09 p.m.