dot-use_case_weights_with_yardstick: Determine if case weights should be passed on to yardstick

.use_case_weights_with_yardstickR Documentation

Determine if case weights should be passed on to yardstick

Description

This S3 method defines the logic for deciding when a case weight vector should be passed to yardstick metric functions and used to measure model performance. The current logic is that frequency weights (i.e. hardhat::frequency_weights()) are the only situation where this should occur.

Usage

.use_case_weights_with_yardstick(x)

## S3 method for class 'hardhat_importance_weights'
.use_case_weights_with_yardstick(x)

## S3 method for class 'hardhat_frequency_weights'
.use_case_weights_with_yardstick(x)

Arguments

x

A vector

Value

A single TRUE or FALSE.

Examples

library(parsnip)
library(dplyr)

frequency_weights(1:10) %>%
  .use_case_weights_with_yardstick()

importance_weights(seq(1, 10, by = .1))%>%
  .use_case_weights_with_yardstick()

tidymodels/tune documentation built on April 21, 2024, 5:44 a.m.