Nothing
DPmeansClustering = function(Data, Lambda, PlotIt = FALSE, ...) {
# Cls = DPmeansClustering(Data, Lambda)$Cls
# DP-means creates clusters using a scale-dependent threshold
# [Kulis/Jordan, 2012].
#
# INPUT
# Data Numeric data matrix with observations in rows.
# Lambda Positive finite cluster-creation threshold passed unchanged to
# T4cluster::dpmeans. Choose it for the scale of Data.
# OPTIONAL
# PlotIt Boolean. Plot the clustering with ClusterPlotMDS.
# ... Arguments to T4cluster::dpmeans: maxiter (default 10, minimum 5),
# eps (default 1e-5), and permute (default FALSE).
# OUTPUT
# Cls Named cluster-label vector; the cluster count is estimated.
# Object Complete result of T4cluster::dpmeans.
#
# Reference: Kulis, B., and Jordan, M. I. (2012), Revisiting k-means:
# New Algorithms via Bayesian Nonparametrics, ICML, pp. 1131-1138.
if (inherits(Data, "dist")) stop("Data must contain observations, not distances.")
Data = as.matrix(Data)
if (!is.numeric(Data) || nrow(Data) < 2L || ncol(Data) < 1L || any(!is.finite(Data))) {
stop("Data must contain finite numeric values and at least two observations.")
}
if (!is.numeric(Lambda) || length(Lambda) != 1L || !is.finite(Lambda) || Lambda <= 0) {
stop("Lambda must be a positive finite number.")
}
if (!requireNamespace('T4cluster', quietly = TRUE)) {
message("Subordinate clustering package (T4cluster) is missing. No computations are performed.")
return(list(Cls = rep(1, nrow(Data)),
Object = "Subordinate clustering package (T4cluster) is missing. Please install it from 'Suggests'."))
}
res = T4cluster::dpmeans(data = Data, lambda = Lambda, ...)
Cls = ClusterRename(as.numeric(as.character(res$cluster)), Data)
if (PlotIt) ClusterPlotMDS(Data, Cls)
return(list(Cls = Cls, Object = res))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.