% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cluster_diagnostics.R
\name{cluster_diagnostics}
\alias{cluster_diagnostics}
\alias{as.data.frame.net_cluster_diagnostics}
\title{Cluster Diagnostics}
\usage{
cluster_diagnostics(x, ...)

\method{as.data.frame}{net_cluster_diagnostics}(x, row.names = NULL, optional = FALSE, ...)
}
\arguments{
\item{x}{A \code{net_clustering}, \code{net_mmm}, \code{netobject_group}
(with \code{attr(, "clustering")} attached by \code{cluster_network()}
or \code{cluster_mmm()}), or \code{net_mmm_clustering}.}

\item{...}{Unsupported. Supplying unused arguments raises an error.}

\item{row.names, optional}{Standard \code{as.data.frame} arguments
(ignored).}
}
\value{
A \code{net_cluster_diagnostics} object.
}
\description{
Unified entry point for clustering quality information. Returns a
\code{net_cluster_diagnostics} object that normalises the diagnostic
surface across distance-based and model-based clusterings -- you no
longer have to know which fields live on \code{net_clustering} vs.
\code{net_mmm} vs. the slim \code{net_mmm_clustering} attribute of a
\code{netobject_group}.
}
\details{
The returned object carries:
\describe{
\item{family}{Either \code{"distance"} or \code{"mmm"}.}
\item{k, n, sizes}{Number of clusters, number of sequences, sizes
vector.}
\item{per_cluster}{A \code{data.frame} -- one row per cluster, columns
differ by family. Distance: \code{cluster}, \code{size},
\code{pct}, \code{mean_within_dist}, \code{sil_mean}. MMM:
\code{cluster}, \code{size}, \code{pct}, \code{mix_pct},
\code{avepp}, \code{class_err_pct}.}
\item{overall}{A named list of family-specific summary metrics
(\code{silhouette} for distance; \code{avepp_overall},
\code{entropy}, \code{classification_error} for MMM).}
\item{ics}{For MMM: a list with \code{BIC}, \code{AIC}, \code{ICL}.
\code{NULL} for distance.}
\item{metadata}{Method / dissimilarity / weighted / lambda etc.}
\item{source}{The original clustering object, kept by reference so
\code{plot()} can delegate without recomputing anything.}
}
}
\examples{
seqs <- data.frame(V1 = sample(c("A","B","C"), 30, TRUE),
                   V2 = sample(c("A","B","C"), 30, TRUE))
cl <- build_clusters(seqs, k = 2, method = "ward.D2")
cluster_diagnostics(cl)
\donttest{
grp <- cluster_mmm(seqs, k = 2, n_starts = 1, max_iter = 20, seed = 1)
cluster_diagnostics(grp)
as.data.frame(cluster_diagnostics(grp))
}
}
\seealso{
\code{\link{print.net_cluster_diagnostics}},
\code{\link{plot.net_cluster_diagnostics}},
\code{\link{compare_mmm}} for k-sweep model selection (MMM only).
}
