Skip to content

Releases: tidymodels/parsnip

parsnip 1.3.0

14 Feb 12:14
Compare
Choose a tag to compare

New Features

  • A new model mode ("quantile regression") was added. Including:

    • A linear_reg() engine for "quantreg".
    • Predictions are encoded via a custom vector type. See [hardhat::quantile_pred()].
    • Predicted quantile levels are designated when the new mode is specified. See ?set_mode.
  • Updates for sparse data formats:

    • fit_xy() can now take dgCMatrix input for x argument (#1121).
    • fit_xy() can now take sparse tibbles as data values (#1165).
    • predict() can now take dgCMatrix and sparse tibble input for new_data argument, and error informatively when model doesn't support it (#1167).
  • New extract_fit_time() method has been added that returns the time it took to train the model (#853).

  • mlp() with keras engine now work for all activation functions currently supported by keras (#1127).

  • mlp() now has a brulee_two_layer engine.

Other Changes

  • Transitioned package errors and warnings to use cli (#1147 and #1148 by @shum461, #1153 by @RobLBaker and @wright13, #1154 by @JamesHWade, #1160, #1161, #1081).

  • fit_xy() currently raises an error for gen_additive_mod() model specifications as the default engine ("mgcv") specifies smoothing terms in model formulas. However, some engines specify smooths via additional arguments, in which case the restriction on fit_xy() is excessive. parsnip will now only raise an error when fitting a gen_additive_mod() with fit_xy() when using the "mgcv" engine (#775).

  • Aligned null_model() with other model types; the model type now has an engine argument that defaults to "parsnip" and is checked with the same machinery that checks other model types in the package (#1083).

  • If linear regression is requested with a Poisson family, an error will occur and refer the user to poisson_reg() (#1219).

  • The deprecated function rpart_train() was removed after its deprecation period (#1044).

Bug Fixes

  • Make sure that parsnip does not convert ordered factor predictions to be unordered.

  • Ensure that knit_engine_docs() has the required packages installed (#1156).

  • Fixed bug where some models fit using fit_xy() couldn't predict (#1166).

  • Fixed bug related to using local (non-package) models (#1229)

  • tunable() now references a dials object for the mixture parameter (#1236)

Breaking Change

  • For quantile prediction, the quantile argument to predict() has been deprecate in facor of quantile_levels. This does not affect models with mode "quantile regression".

  • The quantile regression prediction type was disabled for the deprecated surv_reg() model.

  • NULL is no longer accepted as an engine (#1242).

parsnip 1.2.1

23 Mar 01:50
322a43b
Compare
Choose a tag to compare
  • Added a missing tidy() method for survival analysis glmnet models (#1086).

  • A few changes were made to achive more speed-ups (#1075) (#1073) (#1072)

parsnip 1.2.0

16 Feb 18:09
a30a15e
Compare
Choose a tag to compare

Bug Fixes

  • Tightened logic for outcome checking. This resolves issues—some errors and some silent failures—when atomic outcome variables have an attribute (#1060, #1061).

  • Fixed bug in fitting some model types with the "spark" engine (#1045).

  • Fixed issues in metadata for the "brulee" engine where several arguments were mistakenly protected. (#1050, #1054)

  • Fixed documentation for mlp(engine = "brulee"): the default values for learn_rate and epochs were swapped (#1018).

  • Fixed a bug in the integration with workflows where using a model formula with a formula preprocessor could result in a double intercept (#1033).

Other Changes

  • We no longer add eval_time arguments to the prediction specification for the engine (#1039).

  • parsnip now lets the engines for [mlp()] check for acceptable values of the activation function (#1019)

  • rpart_train() has been deprecated in favor of using decision_tree() with the "rpart" engine or rpart::rpart() directly (#1044).

  • .filter_eval_time() was moved to the survival standalone file.

  • Improved errors and documentation related to special terms in formulas. See ?model_formula to learn more. (#770, #1014)

  • Improved errors in cases where the outcome column is mis-specified. (#1003)

  • The new_data argument for the predict() method for censoring_model_reverse_km objects has been deprecated (#965).

  • When computing censoring weights, the resulting vectors are no longer named (#1023).

  • The predict() method for censoring_model_reverse_km objects now checks that ... are empty (#1029).

parsnip 1.1.1

17 Aug 23:44
fc953dd
Compare
Choose a tag to compare
  • Fixed bug where prediction on rank deficient lm() models produced .pred_res instead of .pred. (#985)

  • Fixed bug where sparse data was being coerced to non-sparse format doing predict().

  • For BART models with the dbarts engine, predict() can now also return the standard error for confidence and prediction intervals (#976).

  • augment() now works for censored regression models.

  • A few censored regression helper functions were exported: .extract_surv_status() and .extract_surv_time() (#973, #980).

  • Fixed bug where boost_tree() models couldn't be fit with 1 predictor if validation argument was used. (#994)

parsnip 1.1.0

12 Apr 17:12
c5a1811
Compare
Choose a tag to compare

This release of parsnip contains a number of new features and bug fixes, accompanied by several optimizations that substantially decrease the time to fit() and predict() with the package.

Improvements to "glmnet" engine interfaces

  • glmnet models fitted with base-R family objects are now supported for linear_reg(), logistic_reg(), and multinomial_reg() (#890).

  • multi_predict() methods for linear_reg(), logistic_reg(), and multinom_reg() models fitted with the "glmnet" engine now check the type better and error accordingly (#900).

  • .organize_glmnet_pred() now expects predictions for a single penalty value (#876).

Survival analysis

  • The time argument to predict_survival() and predict_hazard() is deprecated in favor of the new eval_time argument (#936).

  • Added several internal functions (to help work with Surv objects) as a standalone file that can be used in other packages via usethis::use_standalone("tidymodels/parsnip"). These changes provide tooling for downstream packages to handle inverse probability censoring weights (#893, #897, #937).

  • An internal method for generating inverse probability of censoring weights (IPCW) of Graf et al (1999) is available via .censoring_weights_graf().

Bug fixes

  • Made fit() behave consistently with respect to missingness in the classification setting. Previously, fit() erroneously raised an error about the class of the outcome when there were no complete cases, and now always passes along complete cases to be handled by the modeling function (#888).

  • Fixed bug where model fits with engine = "earth" would fail when the package's namespace hadn't been attached (#251).

  • Fixed bug where model fits with factor predictors and engine = "kknn" would fail when the package's namespace hadn't been attached (#264).

  • Fixed bug with prediction from a boosted tree model fitted with "xgboost" using a custom objective function (#875).

Other changes

  • Implemented a number of optimizations in parsnip's backend that substantially decrease evaluation time to fit() and predict() (#901, #902, #910, #921, #929, #923, #931, #932, #933).

  • logistic_reg() will now warn at fit() when the outcome has more than two levels (#545).

  • Rather than being implemented in each method, the check for the new_data argument being mistakenly passed as newdata to multi_predict() now happens in the generic. Packages re-exporting the multi_predict() generic and implementing now-duplicate checks may see new failures and can remove their own analogous checks. This check already existed in all predict() methods (via predict.model_fit()) and all parsnip multi_predict() methods (#525).

  • Functions now indicate what class the outcome was if the outcome is the wrong class (#887).

  • The minimum version for R is now 3.5 (#926).

  • Moved forward with the deprecation of req_pkgs() in favor of required_pkgs(). The function will now error (#871).

  • Transitioned all soft-deprecations that were at least a year old to warn-deprecations. These changes apply to fit_control(), surv_reg(), varying(), varying_args(), and the "liquidSVM" engine.

  • Various bug fixes and improvements to documentation.

parsnip 1.0.4

23 Feb 13:28
dda22fe
Compare
Choose a tag to compare
  • For censored regression models, a "reverse Kaplan-Meier" curve is computed for the censoring distribution. This can be used when evaluating this type of model (#855).

  • The model specification methods for generics::tune_args() and
    generics::tunable() are now registered unconditionally (tidymodels/workflows#192).

parsnip 1.0.3

17 Nov 17:27
10a71d3
Compare
Choose a tag to compare
  • Adds documentation and tuning infrastructure for the new flexsurvspline engine for the survival_reg() model specification from the censored package (@mattwarkentin, #831).

  • The matrix interface for fitting fit_xy() now works for the "censored regression" mode (#829).

  • The num_leaves argument of boost_tree()s lightgbm engine (via the bonsai package) is now tunable.

  • A change in our data checking code resulted in about a 3-fold speed-up in parsnip (#835)

parsnip 1.0.2

01 Oct 19:31
78ce496
Compare
Choose a tag to compare
  • A bagged neural network model was added (bag_mlp()). Engine implementations will live in the baguette package.

  • Fixed installation failures due to undocumented knitr installation dependency (#785).

  • fit_xy() now fails when the model mode is unknown.

  • brulee engine-specific tuning parameters were updated. These changes can be used with dials version > 1.0.0.

  • fit() and fit_xy() doesn't error anymore if control argument isn't a control_parsnip() object. Will work as long as the object passed to control includes the same elements as control_parsnip().

  • Improved prompts related to missing (or not loaded) extension packages as well as better handling of model mode conflicts.

parsnip 1.0.1

18 Aug 15:04
1449b34
Compare
Choose a tag to compare
  • Enabled passing additional engine arguments with the xgboost boost_tree() engine. To supply engine-specific arguments that are documented in xgboost::xgb.train() as arguments to be passed via params, supply the list elements directly as named arguments to set_engine(). Read more in ?details_boost_tree_xgboost (#787).

parsnip 1.0.0

16 Jun 11:45
5a601f2
Compare
Choose a tag to compare

Model Specification Changes

  • Enable the use of case weights for models that support them.

  • show_model_info() now indicates which models can utilize case weights.

  • Model type functions will now message informatively if a needed parsnip extension package is not loaded (#731).

  • Refactored internals of model specification printing functions. These changes are non-breaking for extension packages, but the new print_model_spec() helper is exported for use in extensions if desired (#739).

Bug fixes

  • Fixed bug where previously set engine arguments would propagate through update() methods despite fresh = TRUE (#704).

  • Fixed a bug where an error would be thrown if arguments to model functions were namespaced (#745).

  • predict(type = "prob") will now provide an error if the outcome variable has a level called "class" (#720).

  • An inconsistency for probability type predictions for two-class GAM models was fixed (#708)

  • Fixed translated printing for null_model() (#752)

Other changes

  • Added a glm_grouped() function to convert long data to the grouped format required by glm() for logistic regression.

  • xgb_train() now allows for case weights

  • Added ctree_train() and cforest_train() wrappers for the functions in the partykit package. Engines for these will be added to other parsnip extension packages.

  • Exported xgb_predict() which wraps xgboost's predict() method for use with parsnip extension packages (#688).

  • Added a developer function, .model_param_name_key that translates names of tuning parameters.