Skip to content

Commit 83c744b

Browse files
committed
re-enable quantiles prediction for tidymodels#1203
1 parent b575c34 commit 83c744b

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

R/predict_quantile.R

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
#' @method predict_quantile model_fit
77
#' @export predict_quantile.model_fit
88
#' @export
9-
predict_quantile.model_fit <- function(object, new_data, ...) {
9+
predict_quantile.model_fit <- function(object,
10+
new_data,
11+
quantile = (1:9)/10,
12+
interval = "none",
13+
level = 0.95,
14+
...) {
1015

1116
check_spec_pred_type(object, "quantile")
1217

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

2025
# preprocess data
21-
if (!is.null(object$spec$method$pred$quantile$pre)) {
26+
if (!is.null(object$spec$method$pred$quantile$pre))
2227
new_data <- object$spec$method$pred$quantile$pre(new_data, object)
23-
}
2428

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

2933
res <- eval_tidy(pred_call)
@@ -40,5 +44,6 @@ predict_quantile.model_fit <- function(object, new_data, ...) {
4044
# @keywords internal
4145
# @rdname other_predict
4246
# @inheritParams predict.model_fit
43-
predict_quantile <- function (object, ...)
47+
predict_quantile <- function (object, ...) {
4448
UseMethod("predict_quantile")
49+
}

man/other_predict.Rd

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)