-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add parameters for postprocessing with tailor (#358)
* add `buffer()` for `adjust_equivocal_zone()` * add `*_limit()`s for `adjust_numeric_range()` * add NEWS entry * correct `inheritParams` * update pkgdown index --------- Co-authored-by: Hannah Frick <[email protected]>
- Loading branch information
1 parent
caeee86
commit c7d68ce
Showing
8 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' Buffer size | ||
#' | ||
#' In equivocal zones, predictions are considered equivocal (i.e. "could | ||
#' go either way") if their probability falls within some distance on either | ||
#' side of the classification threshold. That distance is called the "buffer." | ||
#' | ||
#' A buffer of .5 is only possible if the classification threshold is .5. | ||
#' In that case, all probability predictions are considered equivocal, | ||
#' regardless of their value in \code{[0, 1]}. | ||
#' Otherwise, the maximum buffer is `min(threshold, 1 - threshold)`. | ||
#' | ||
#' @inheritParams Laplace | ||
#' @seealso [threshold()] | ||
#' @examples | ||
#' buffer() | ||
#' @export | ||
buffer <- function(range = c(0, .5), trans = NULL) { | ||
new_quant_param( | ||
type = "double", | ||
range = range, | ||
inclusive = c(TRUE, TRUE), | ||
trans = trans, | ||
label = c(buffer = "buffer"), | ||
finalize = NULL | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#' Limits for the range of predictions | ||
#' | ||
#' Range limits truncate model predictions to a specific range of values, | ||
#' typically to avoid extreme or unrealistic predictions. | ||
#' | ||
#' @inheritParams Laplace | ||
#' @examples | ||
#' lower_limit() | ||
#' upper_limit() | ||
#' @name range_limits | ||
#' @export | ||
|
||
#' @rdname range_limits | ||
#' @export | ||
lower_limit <- function(range = c(-Inf, Inf), trans = NULL) { | ||
new_quant_param( | ||
type = "double", | ||
range = range, | ||
inclusive = c(TRUE, FALSE), | ||
trans = trans, | ||
label = c(lower_limit = "Lower Limit"), | ||
finalize = NULL | ||
) | ||
} | ||
|
||
#' @rdname range_limits | ||
#' @export | ||
upper_limit <- function(range = c(-Inf, Inf), trans = NULL) { | ||
new_quant_param( | ||
type = "double", | ||
range = range, | ||
inclusive = c(FALSE, TRUE), | ||
trans = trans, | ||
label = c(upper_limit = "Upper Limit"), | ||
finalize = NULL | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters