View source: R/clustering_algorithms.R
HierarchicalClustering | R Documentation |
Runs hierarchical clustering using implementation from
hclust
. If Lambda
is provided, clustering is
applied on the weighted distance matrix calculated using the
cosa2
algorithm. Otherwise, distances are calculated
using dist
. This function is not using stability.
HierarchicalClustering(
xdata,
nc = NULL,
Lambda = NULL,
distance = "euclidean",
linkage = "complete",
...
)
xdata |
data matrix with observations as rows and variables as columns. |
nc |
matrix of parameters controlling the number of clusters in the
underlying algorithm specified in |
Lambda |
vector of penalty parameters (see argument |
distance |
character string indicating the type of distance to use. If
|
linkage |
character string indicating the type of linkage used in
hierarchical clustering to define the stable clusters. Possible values
include |
... |
additional parameters passed to |
A list with:
comembership |
an array of binary and symmetric co-membership matrices. |
weights |
a matrix of median weights by feature. |
rCOSAsharp
\insertRefCOSAsharp
Other clustering algorithms:
DBSCANClustering()
,
GMMClustering()
,
KMeansClustering()
,
PAMClustering()
# Data simulation
set.seed(1)
simul <- SimulateClustering(n = c(10, 10), pk = 50)
# Hierarchical clustering
myhclust <- HierarchicalClustering(
xdata = simul$data,
nc = seq_len(20)
)
# Weighted Hierarchical clustering (using COSA)
if (requireNamespace("rCOSA", quietly = TRUE)) {
myhclust <- HierarchicalClustering(
xdata = simul$data,
weighted = TRUE,
nc = seq_len(20),
Lambda = c(0.2, 0.5)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.