% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{add_resample_weights}
\alias{add_resample_weights}
\title{Add resample weights to an rset object}
\usage{
add_resample_weights(rset, weights)
}
\arguments{
\item{rset}{An rset object from \pkg{rsample}.}

\item{weights}{A numeric vector of weights, one per resample. Weights will be
normalized.}
}
\value{
The rset object with weights added as an attribute.
}
\description{
This function allows you to specify custom weights for resamples. Weights
are automatically normalized to sum to 1.
}
\details{
Resampling weights are useful when assessment sets (i.e., held out data) have
different sizes or when you want to upweight certain resamples in the evaluation.
The weights are stored as an attribute and used automatically during
metric aggregation.
}
\examples{
library(rsample)
folds <- vfold_cv(mtcars, v = 3)
# Give equal weight to all folds
weighted_folds <- add_resample_weights(folds, c(1, 1, 1))
# Emphasize the first fold
weighted_folds <- add_resample_weights(folds, c(0.5, 0.25, 0.25))
}
\seealso{
\code{\link[=calculate_resample_weights]{calculate_resample_weights()}}, \code{\link[=extract_resample_weights]{extract_resample_weights()}}
}
