% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nmfkc.R
\name{nmfkc.criterion}
\alias{nmfkc.criterion}
\title{Compute model selection criteria for a fitted nmfkc model}
\usage{
nmfkc.criterion(object, Y, detail = c("full", "fast", "minimal"), ...)
}
\arguments{
\item{object}{An object of class \code{"nmfkc"} returned by
\code{\link{nmfkc}}.}

\item{Y}{The original observation matrix (P x N) used for fitting.}

\item{detail}{Character string controlling the level of computation:
\code{"full"} (default) computes all criteria including silhouette,
CPCC and dist.cor;
\code{"fast"} skips the expensive distance-based criteria;
\code{"minimal"} skips the fit and clustering statistics.}

\item{...}{Additional arguments: \code{Y.weights} (non-negative
weight matrix; \code{lm()}-style loss \eqn{\sum W \, r^2}; default:
all ones).  See \code{\link{nmfkc}} for full details.}
}
\value{
A list with components:
\describe{
\item{r.squared}{R-squared between Y and XB.}
\item{sigma}{Residual standard deviation.}
\item{mae}{Mean absolute error.}
\item{B.prob}{Column-normalized coefficient matrix (soft-clustering probabilities).}
\item{B.cluster}{Hard clustering labels (argmax of B.prob per column).}
\item{X.prob}{Row-normalized basis matrix.}
\item{X.cluster}{Hard clustering labels per row of X.}
\item{criterion}{Named list: B.prob.max.mean, effective.rank,
silhouette, CPCC, dist.cor.}
}
}
\description{
\code{nmfkc.criterion} computes the effective rank, clustering-quality
measures (silhouette, CPCC, dist.cor), and the clustering-crispness
statistic (\code{B.prob.max.mean}) from a fitted \code{nmfkc} model.

This function can be called on a model that was fitted with
\code{detail = "fast"} or \code{detail = "minimal"} to compute the
full set of criteria afterwards.
}
\examples{
Y <- t(iris[, -5])
res <- nmfkc(Y, rank = 3, detail = "fast")
crit <- nmfkc.criterion(res, Y)
crit$criterion$silhouette

}
\seealso{
\code{\link{nmfkc}}, \code{\link{nmfkc.rank}}
}
