Skip to content

metrics with a target value of zero #243

Description

@topepo

show_best() and others have code that looks like:

  if (maximize) {
    summary_res <- summary_res %>% dplyr::arrange(dplyr::desc(mean))
  } else {
    summary_res <- summary_res %>% dplyr::arrange(mean)
  }

This should be adjusted for cases when there is a target value.

Perhaps we can use maximize = FALSE and arrange by (abs(mean - target)).

@DavisVaughan

Activity

  1. DavisVaughan commented on Jul 6, 2020

    @DavisVaughan
    Member

    Currently all yardstick metrics optimize with one of maximize/minimize/zero. I havent run across any that have an arbitrary target, but I guess it is possible.

    It might be worth leaving the direction variable as a character string, rather than converting it to a logical maximize variable. Then you'd just handle the 3 cases by expanding the if statement you have above.

    if (direction == "maximize") {
    
    } else if (direction == "minimize") {
    
    } else if (direction == "zero") {
    
    } else {
      abort("Internal error: Unknown direction")
    }

    If we run into metrics later on that have some arbitrary target value, then we'd have to reconsider how this works in both yardstick and tune (currently in yardstick direction is a character string, but it would probably have to become a numeric value for arbitrary targets)

  2. github-actions commented on Nov 30, 2022

    @github-actions
    Contributor

    This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

  3. locked and limited conversation to collaborators on Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions