Skip to content

Commit 145bac2

Browse files
Don't coerce sparse data to non-sparse during predict() (#950)
* pass sparse data through prepare_data() * add news * move news bullet to devel --------- Co-authored-by: Max Kuhn <[email protected]>
1 parent fe721f6 commit 145bac2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# parsnip (development version)
22

3+
* Fixed bug where sparse data was being coerced to non-sparse format doing `predict()`.
4+
35
* `augment()` now works for censored regression models.
46

57
# parsnip 1.1.0

R/predict.R

+4
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ prepare_data <- function(object, new_data) {
426426
new_data <- new_data[, colnames(new_data) != "(Intercept)", drop = FALSE]
427427
}
428428

429+
if (allow_sparse(object) && inherits(new_data, "dgCMatrix")) {
430+
return(new_data)
431+
}
432+
429433
fit_interface <- object$spec$method$fit$interface
430434
switch(
431435
fit_interface,

0 commit comments

Comments
 (0)