% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nuggets.R
\name{nugget_feature_weights}
\alias{nugget_feature_weights}
\title{Feature weights derived from data nuggets}
\usage{
nugget_feature_weights(nuggets, type = c("between", "ratio", "inv_scale"))
}
\arguments{
\item{nuggets}{A \code{"data_nugget"} object from
\code{\link{create_data_nuggets}} (built with samples in the rows).}

\item{type}{One of:
\describe{
\item{\code{"between"}}{(default) size-weighted between-nugget variance of
each feature: \eqn{\sum_i w_i (c_{ij} - \bar c_j)^2 / \sum_i w_i}.}
\item{\code{"ratio"}}{a separability / pseudo-\eqn{F} score,
\eqn{\mathrm{between}_j / (\mathrm{between}_j + \overline{\mathrm{within}}_j)}.}
\item{\code{"inv_scale"}}{inverse mean within-nugget variance, which
down-weights noisy features.}
}}
}
\value{
A named numeric vector of length \code{ncol(centers)} of
non-negative feature scores.
}
\description{
Computes a per-feature importance score from a data-nugget
(\code{\link{create_data_nuggets}}) object built over the \emph{observations}
(samples). This score is the
data-nugget analogue of the feature variance used by the ABC / M-ABC family:
it rewards features that separate the representative groups while discounting
within-nugget noise, giving a robust, Big-Data-friendly weighting.
}
\examples{
set.seed(1)
x <- cbind(signal = c(rnorm(50, 0), rnorm(50, 5)),  # separates groups
           noise  = rnorm(100))                      # pure noise
dn <- create_data_nuggets(x, max_nuggets = 20)
nugget_feature_weights(dn, type = "between")
}
\references{
\insertRef{Cherasia2023}{MosaiClusteR}
}
\seealso{
\code{\link{create_data_nuggets}}, \code{\link{M_ABCpp}}
}
