Skip to content

Commit

Permalink
re-enable quantiles prediction for tidymodels#1203
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Sep 12, 2024
1 parent b575c34 commit 83c744b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
15 changes: 10 additions & 5 deletions R/predict_quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
#' @method predict_quantile model_fit
#' @export predict_quantile.model_fit
#' @export
predict_quantile.model_fit <- function(object, new_data, ...) {
predict_quantile.model_fit <- function(object,
new_data,
quantile = (1:9)/10,
interval = "none",
level = 0.95,
...) {

check_spec_pred_type(object, "quantile")

Expand All @@ -18,12 +23,11 @@ predict_quantile.model_fit <- function(object, new_data, ...) {
new_data <- prepare_data(object, new_data)

# preprocess data
if (!is.null(object$spec$method$pred$quantile$pre)) {
if (!is.null(object$spec$method$pred$quantile$pre))
new_data <- object$spec$method$pred$quantile$pre(new_data, object)
}

# Pass some extra arguments to be used in post-processor
object$spec$method$pred$quantile$args$quantile_level <- object$quantile_level
object$spec$method$pred$quantile$args$p <- quantile
pred_call <- make_pred_call(object$spec$method$pred$quantile)

res <- eval_tidy(pred_call)
Expand All @@ -40,5 +44,6 @@ predict_quantile.model_fit <- function(object, new_data, ...) {
# @keywords internal
# @rdname other_predict
# @inheritParams predict.model_fit
predict_quantile <- function (object, ...)
predict_quantile <- function (object, ...) {
UseMethod("predict_quantile")
}
9 changes: 8 additions & 1 deletion man/other_predict.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 83c744b

Please sign in to comment.