Repository navigation
Breaking Change
-
Two
translate()helper functions for glmnet are generalized and used to de-duplicate code for ordinalNet and glmnetcr. The latter two no longer silently modify penalty path-governing engine arguments (@corybrunson, #1412 & #1424), which will impact code that relied on these modifications. -
logistic_reg()now errors when the outcome has more than two levels, instead of warning. Most engines cannot fit this:glmcollapses every level after the first into the event andkeras3returns a column per level, but in both cases the probability columns parsnip labels do not mean what their names say, andglmnet,stan, andbruleeerror inside the engine. TheLiblineaRengine is exempt, since it genuinely fits a multiclass model andmultinom_reg()has no LiblineaR engine. The warning was added in 1.1.0 (#545); erroring reflects that for most engines the result was not usable (#1444).
New Features
-
New model specifications
tabular_auto_int(),tabular_chronos(),tabular_icl(),tabular_pfn(),tabular_resnet(),tabular_rln(), andtabular_saint()were added for tabular deep-learning and foundation models, with engines provided by the tabby extension package (#1386). -
fit()andfit_xy()have less per-fit overhead, making small or repeated fits (such as during tuning) faster (#1071). -
null_model()now supports quantile regression mode, where fitting computes the requested empirical quantiles of the outcome. -
For censored regression models, the censoring weights can now be added to the predictions of survival probability by setting
add_censoring_weights = TRUEinpredict(type = "survival")(#1371). -
ordinal_reg()gains argumentsthreshold_structureandparallel_regto control threshold constraints and the parallel regression assumption. TheordinalNetengine can useparallel_regwhile theclmandvglmengines can use both new arguments (#1393, @corybrunson).
Bug Fixes
-
The deprecated
quantileargument now reaches its deprecation warning when passed viapredict(type = "quantile")instead of being rejected as an unknown argument. The error for unknown arguments passed topredict()now lists the offending argument names. (@bjornkallerud, #1258) -
Several internal list accesses that resolved only through
$partial matching were corrected: the outcome levels recorded when fitting from a formula, the"ranger"prediction post-processor, and themulti_predict()generic's check for a failed fit. Results are unchanged, but each would have silently started reading a different element had one with a shorter name been added. -
Model and engine arguments are now evaluated while the model call is assembled, so the call an engine records no longer contains quosures. This fixes
mars()fits with the earth engine whenprune_method = "cv"is combined withprod_degree(#432), andset_engine("glmnet", relax = TRUE)for every glmnet engine, which also covers the poissonreg and censored wrappers (#1069). Both engines re-evaluate their own recorded call with baseeval(), which cannot handle quosures. A fitted object's$fit$callnow shows values such asdegree = 2rather thandegree = ~2. -
bart()classification fits with the"dbarts"engine now return each observation's own confidence and prediction interval bounds. The bounds were sorted across observations, so each row received some other row's rank-matched limits. Regression intervals were unaffected (#1407). -
bart()classification with the"dbarts"engine now errors when the outcome does not have exactly two levels. dbarts models a binary outcome, but parsnip passed it the factor codes without checking, so a third level became ayvalue of2and the returned "probabilities" were not on[0, 1]. This also affected a two-level outcome that retained an unused level: class and probability predictions were silently mislabelled, and interval predictions errored insiderlang::set_names(). The new error names the unused levels and suggestsdroplevels()when that is the problem (#1444). -
boost_tree()with the"xgboost"engine now warns once per session whenmonotone_constraintsis supplied for binary classification. The signs of the constraints are relative to the event level, which is the first factor level unlessevent_level = "second"is set, somonotone_constraints = 1constrains the probability of that level rather than of the second one. The engine documentation now describes the convention. Fitted models are unchanged (#796). -
boost_tree()models fit with the"xgboost"engine and a function-valuedobjectivenow error informatively forpredict(type = "class")andpredict(type = "prob")instead of returning raw margins labelled as probabilities. xgboost cannot report whether a custom objective produces margins or probabilities, so parsnip cannot convert them; usepredict(type = "raw")and apply the matching inverse link yourself, or register a custom engine that post-processes the predictions. Fitting,type = "raw", and regression are unaffected (#999). -
fit()andfit_xy()now error when extra arguments are passed through.... The documentation always said these were ignored, but depending on the combination of user and engine interface they were silently dropped, silently applied (asubsetargument really did subset the training data on the formula-to-xy path), or raised an internal "unused argument" error. Pass engine arguments toset_engine()and case weights to thecase_weightsargument. Passingoffsetgets specific advice, since the general suggestion does not work for it: useoffset()in the formula, or pass the offset vector toset_engine()when usingfit_xy()(#492, #1439). -
mars()classification fits with the"earth"engine now return correctpredict(type = "class")results for outcomes with three or more levels. A binary threshold rule was applied regardless of the number of levels, so every multiclass prediction was wrong and the last level could never be predicted. Binary outcomes are unaffected (#472, #1409). -
multi_predict()for glmnet engine fits now passestype = "raw"through to glmnet with no post-processing. It was silently ignored forlinear_reg(), which returned the usual nested.predtibble, and errored unhelpfully forlogistic_reg()andmultinom_reg(). The result is glmnet's own prediction object — a matrix with one column per penalty, or a three-dimensional array formultinom_reg()— rather than a tibble (#857). -
The per-type glmnet prediction methods (
predict_numeric._elnet(),predict_class._lognet()and the six others like them) were removed. Each only evaluated the model specification before handing off to the correspondingmodel_fit()method, which thepredict()path already does beforehand. Predictions from glmnet models are unchanged. A custom model that carries one of glmnet's fitted classes, such as_elnet, now reaches parsnip'smodel_fit()methods for these prediction types rather than the glmnet ones (#878). -
multi_predict_args()andhas_multi_predict()work again for fitted workflows, returning the submodel argument names andTRUEinstead ofNULLandFALSE. They read from an outdated internal workflows structure. Both now error informatively on an untrained workflow rather than silently reporting that it has no submodel arguments (#1410). -
predict_raw()no longer errors whenoptscontains an argument name that collides with a protected prediction argument such asnewdataorobject. The colliding entry is now dropped with a warning; previously every path through that branch failed with "attempt to select less than one element". This also coverspredict(type = "raw", opts = ...)(#1408). -
set_model_arg()now storesfuncas a list when given the named character vector form shown in its documentation, such asc(pkg = "dials", fun = "mixture"). That form registered without complaint but made tuning fail much later with$ operator is invalid for atomic vectors(#1251). -
svm_linear()with the"LiblineaR"engine now passescosttoLiblineaR::LiblineaR(). It was previously mapped to a nonexistentCargument, which the engine silently absorbed into its dots, so every fit used the engine default ofcost = 1and tuning overcosthad no effect. Fitted results will change for any model with a non-defaultcost(#1405). -
Fitting with sparse data now respects the model mode, so loading an extension package that registers an engine for a different mode can no longer alter sparse data support for the original mode (#1382).
-
Corrected documentation that referred to
fit()andfit_xy()as arguments rather than functions in the case weights template (#1394).