% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{calculate_resample_weights}
\alias{calculate_resample_weights}
\title{Calculate resample weights from resample sizes}
\usage{
calculate_resample_weights(rset)
}
\arguments{
\item{rset}{An rset object from \pkg{rsample}.}
}
\value{
A numeric vector of weights proportional to resample sizes, normalized
to sum to 1.
}
\description{
This convenience function calculates weights proportional to the number of
observations in each resample's analysis set. Larger resamples get higher weights.
This ensures that resamples with more data have proportionally more influence
on the final aggregated metrics.
}
\details{
This is particularly useful for time-based resamples (e.g., expanding window CV)
or stratified sampling  where resamples might have slightly different sizes, in
which resamples are imbalanced.
}
\examples{
library(rsample)
folds <- vfold_cv(mtcars, v = 3)
weights <- calculate_resample_weights(folds)
weighted_folds <- add_resample_weights(folds, weights)
}
\seealso{
\code{\link[=add_resample_weights]{add_resample_weights()}}, \code{\link[=extract_resample_weights]{extract_resample_weights()}}
}
