Skip to content

Commit

Permalink
remove superfluous backticks across pkg documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
luisDVA committed Aug 20, 2024
1 parent aa788b8 commit bf6e212
Show file tree
Hide file tree
Showing 29 changed files with 560 additions and 66 deletions.
26 changes: 13 additions & 13 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

* `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).
* 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).

* New `extract_fit_time()` method has been added that returns the time it took to train the model (#853).

Expand Down Expand Up @@ -121,7 +121,7 @@ This release of parsnip contains a number of new features and bug fixes, accompa

# parsnip 1.0.3

* Adds documentation and tuning infrastructure for the new `flexsurvspline` engine for the `survival_reg()` model specification from the `censored` package (@mattwarkentin, #831).
* 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).

Expand Down Expand Up @@ -282,7 +282,7 @@ This release of parsnip contains a number of new features and bug fixes, accompa

* The `liquidSVM` engine for `svm_rbf()` was deprecated due to that package's removal from CRAN. (#425)

* The xgboost engine for boosted trees was translating `mtry` to xgboost's `colsample_bytree`. We now map `mtry` to `colsample_bynode` since that is more consistent with how random forest works. `colsample_bytree` can still be optimized by passing it in as an engine argument. `colsample_bynode` was added to xgboost after the `parsnip` package code was written. (#495)
* The xgboost engine for boosted trees was translating `mtry` to xgboost's `colsample_bytree`. We now map `mtry` to `colsample_bynode` since that is more consistent with how random forest works. `colsample_bytree` can still be optimized by passing it in as an engine argument. `colsample_bynode` was added to xgboost after the parsnip package code was written. (#495)

* For xgboost, `mtry` and `colsample_bytree` can be passed as integer counts or proportions, while `subsample` and `validation` should always be proportions. `xgb_train()` now has a new option `counts` (`TRUE` or `FALSE`) that states which scale for `mtry` and `colsample_bytree` is being used. (#461)

Expand All @@ -298,7 +298,7 @@ This release of parsnip contains a number of new features and bug fixes, accompa
* Each model/engine combination has its own help page.
* The model help page has a dynamic bulleted list of the engines with links to the individual help pages.

* `generics::required_pkgs()` was extended for `parsnip` objects.
* `generics::required_pkgs()` was extended for parsnip objects.

* Prediction functions now give a consistent error when a user uses an unavailable value of `type` (#489)

Expand Down Expand Up @@ -333,13 +333,13 @@ This release of parsnip contains a number of new features and bug fixes, accompa

* Some added protections were added for function arguments that are dependent on the data dimensions (e.g., `mtry`, `neighbors`, `min_n`, etc). (#184)

* Infrastructure was improved for running `parsnip` models in parallel using PSOCK clusters on Windows.
* Infrastructure was improved for running parsnip models in parallel using PSOCK clusters on Windows.

# parsnip 0.1.3

* A `glance()` method for `model_fit` objects was added (#325)

* Specific `tidy()` methods for `glmnet` models fit via `parsnip` were created so that the coefficients for the specific fitted `parsnip` model are returned.
* Specific `tidy()` methods for `glmnet` models fit via parsnip were created so that the coefficients for the specific fitted parsnip model are returned.

## Fixes

Expand All @@ -351,11 +351,11 @@ This release of parsnip contains a number of new features and bug fixes, accompa

## Breaking Changes

* `parsnip` now has options to set specific types of predictor encodings for different models. For example, `ranger` models run using `parsnip` and `workflows` do the same thing by _not_ creating indicator variables. These encodings can be overridden using the `blueprint` options in `workflows`. As a consequence, it is possible to get a different model fit that previous versions of `parsnip`. More details about specific encoding changes are below. (#326)
* parsnip now has options to set specific types of predictor encodings for different models. For example, `ranger` models run using parsnip and the workflows package do the same thing by _not_ creating indicator variables. These encodings can be overridden using the `blueprint` options in the workflows package. As a consequence, it is possible to get a different model fit that previous versions of parsnip. More details about specific encoding changes are below. (#326)

## Other Changes

* `tidyr` >= 1.0.0 is now required.
* tidyr >= 1.0.0 is now required.

* SVM models produced by `kernlab` now use the formula method (see breaking change notice above). This change was due to how `ksvm()` made indicator variables for factor predictors (with one-hot encodings). Since the ordinary formula method did not do this, the data are passed as-is to `ksvm()` so that the results are closer to what one would get if `ksmv()` were called directly.

Expand All @@ -371,7 +371,7 @@ This release of parsnip contains a number of new features and bug fixes, accompa

* If `fit()` is used and the underlying model uses a formula, the _actual_ formula is pass to the model (instead of a placeholder). This makes the model call better.

* A function named `repair_call()` was added. This can help change the underlying models `call` object to better reflect what they would have obtained if the model function had been used directly (instead of via `parsnip`). This is only useful when the user chooses a formula interface and the model uses a formula interface. It will also be of limited use when a recipes is used to construct the feature set in `workflows` or `tune`.
* A function named `repair_call()` was added. This can help change the underlying models `call` object to better reflect what they would have obtained if the model function had been used directly (instead of via parsnip). This is only useful when the user chooses a formula interface and the model uses a formula interface. It will also be of limited use when a recipes is used to construct the feature set in the workflows or tune packages.

* The `predict()` function now checks to see if required modeling packages are installed. The packages are loaded (but not attached). (#249) (#308) (tidymodels/workflows#45)

Expand Down Expand Up @@ -411,7 +411,7 @@ This release of parsnip contains a number of new features and bug fixes, accompa

## Breaking Changes

* There were some mis-mapped parameters (going between `parsnip` and the underlying model function) for `spark` boosted trees and some `keras` models. See [897c927](https://github.com/tidymodels/parsnip/commit/897c92719332caf7344e7c9c8895ac673517d2c8).
* There were some mis-mapped parameters (going between parsnip and the underlying model function) for `spark` boosted trees and some `keras` models. See [897c927](https://github.com/tidymodels/parsnip/commit/897c92719332caf7344e7c9c8895ac673517d2c8).


# parsnip 0.0.4
Expand Down Expand Up @@ -448,11 +448,11 @@ Unplanned release based on CRAN requirements for Solaris.

## Breaking Changes

* The method that `parsnip` stores the model information has changed. Any custom models from previous versions will need to use the new method for registering models. The methods are detailed in `?get_model_env` and the [package vignette for adding models](https://parsnip.tidymodels.org/articles/articles/Scratch.html).
* The method that parsnip stores the model information has changed. Any custom models from previous versions will need to use the new method for registering models. The methods are detailed in `?get_model_env` and the [package vignette for adding models](https://parsnip.tidymodels.org/articles/articles/Scratch.html).

* The mode needs to be declared for models that can be used for more than one mode prior to fitting and/or translation.

* For `surv_reg()`, the engine that uses the `survival` package is now called `survival` instead of `survreg`.
* For `surv_reg()`, the engine that uses the survival package is now called `survival` instead of `survreg`.

* For `glmnet` models, the full regularization path is always fit regardless of the value given to `penalty`. Previously, the model was fit with passing `penalty` to `glmnet`'s `lambda` argument and the model could only make predictions at those specific values. [(#195)](https://github.com/tidymodels/parsnip/issues/195)

Expand All @@ -466,7 +466,7 @@ Unplanned release based on CRAN requirements for Solaris.

* A suite of internal functions were added to help with upcoming model tuning features.

* A `parsnip` object always saved the name(s) of the outcome variable(s) for proper naming of the predicted values.
* A parsnip object always saved the name(s) of the outcome variable(s) for proper naming of the predicted values.


# parsnip 0.0.2
Expand Down
14 changes: 7 additions & 7 deletions R/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Some Notes on the Design of `parsnip`
# Some Notes on the Design of parsnip

`parsnip` is trying to solve the issues of unified interfaces for the myriad R modeling functions that have very heterogeneous interfaces and return values. It defines a set of modules, which are specific tasks, such as
The parsnip package is trying to solve the issues of unified interfaces for the myriad R modeling functions that have very heterogeneous interfaces and return values. It defines a set of modules, which are specific tasks, such as

* fitting the model
* obtaining numeric predictions for regression models
* computing different types of predictions for classification and censored regression models

and so on. The list of modules is likely to grow over time to include variable importance scores and so on,.

`caret` was written for the same purpose. The approach there was to encapsulate the modules as functions (see [this directory](https://github.com/topepo/caret/tree/master/models/files) for examples). The issue with having these modules as functions are:
The caret package was written for the same purpose. The approach there was to encapsulate the modules as functions (see [this directory](https://github.com/topepo/caret/tree/master/models/files) for examples). The issue with having these modules as functions are:

* A lot of code duplication.
* More difficult to maintain.
* Any functions in open code had to be a dependency of some sort. This led to a long ago version having about 200 package dependencies which was problematic.

To get around the last point, `caret` _compiles_ these modules into a large list and saves it in the package as an RData file. This avoids `R CMD check` from noticing that code and triggering warnings about dependencies.
To get around the last point, caret _compiles_ these modules into a large list and saves it in the package as an RData file. This avoids `R CMD check` from noticing that code and triggering warnings about dependencies.

## Model Fitting Modules

`parsnip` approaches the problem differently and relies more on using `call` objects for the modules. In the simple cases, the fit module is a list that contains information about the module including the package and function name for the call as well as any default options. For example, for logistic regression using `glm`, the module may look like:
parsnip approaches the problem differently and relies more on using `call` objects for the modules. In the simple cases, the fit module is a list that contains information about the module including the package and function name for the call as well as any default options. For example, for logistic regression using `glm`, the module may look like:

```r
list(
Expand Down Expand Up @@ -77,9 +77,9 @@ The same is true for quosures.

Making predictions is done in a manner similar to fitting models; a call is created in the same way. However, there are additional complexities.

First, the data or model fit object may require some preprocessing to make the predict function work. This does _not_ include executing a formula method on the data but may include coercing the new data into an appropriate format. It can also be used to check for specific fit object requirements. For example, an additional option is required for the `ranger` package to compute class probabilities. The `pre` element of a prediction module can be used to check that the relevant option is set correctly.
First, the data or model fit object may require some preprocessing to make the predict function work. This does _not_ include executing a formula method on the data but may include coercing the new data into an appropriate format. It can also be used to check for specific fit object requirements. For example, an additional option is required for the ranger package to compute class probabilities. The `pre` element of a prediction module can be used to check that the relevant option is set correctly.

Second, there is a high likelihood that the results of executing the prediction code will require post-processing to put the results into a usable format. `ranger`, for example, returns an object of specific class that contains the predicted values for the new data. The `post` element of the prediction module would extract this value and put it into a more consistent format.
Second, there is a high likelihood that the results of executing the prediction code will require post-processing to put the results into a usable format. ranger, for example, returns an object of specific class that contains the predicted values for the new data. The `post` element of the prediction module would extract this value and put it into a more consistent format.

The postprocessor can also be used to coerce the results into a [_tidy format_](https://tidymodels.github.io/model-implementation-principles/model-predictions.html#return-values).

4 changes: 2 additions & 2 deletions R/aaa_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ check_interface_val <- function(x) {
#' and `raw`.
#' @param pkg An options character string for a package name.
#' @param parsnip A single character string for the "harmonized" argument name
#' that `parsnip` exposes.
#' that parsnip exposes.
#' @param original A single character string for the argument name that
#' underlying model function uses.
#' @param value A list that conforms to the `fit_obj` or `pred_obj` description
Expand All @@ -525,7 +525,7 @@ check_interface_val <- function(x) {
#' @keywords internal
#' @details These functions are available for users to add their
#' own models or engines (in a package or otherwise) so that they can
#' be accessed using `parsnip`. This is more thoroughly documented
#' be accessed using parsnip. This is more thoroughly documented
#' on the package web site (see references below).
#'
#' In short, `parsnip` stores an environment object that contains
Expand Down
2 changes: 1 addition & 1 deletion R/add_in.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Start an RStudio Addin that can write model specifications
#'
#' `parsnip_addin()` starts a process in the RStudio IDE Viewer window
#' that allows users to write code for `parsnip` model specifications from
#' that allows users to write code for parsnip model specifications from
#' various R packages. The new code is written to the current document at the
#' location of the cursor.
#'
Expand Down
6 changes: 3 additions & 3 deletions R/engines.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ load_libs <- function(x, quiet, attach = FALSE) {
#'
#' - _Main arguments_ are more commonly used and tend to be available across
#' engines. These names are standardized to work with different engines in a
#' consistent way, so you can use the \pkg{parsnip} main argument `trees`,
#' consistent way, so you can use the parsnip main argument `trees`,
#' instead of the heterogeneous arguments for this parameter from \pkg{ranger}
#' and \pkg{randomForest} packages (`num.trees` and `ntree`, respectively). Set
#' these in your model type function, like `rand_forest(trees = 2000)`.
Expand Down Expand Up @@ -154,10 +154,10 @@ set_engine.default <- function(object, engine, ...) {
#' Display currently available engines for a model
#'
#' The possible engines for a model can depend on what packages are loaded.
#' Some \pkg{parsnip} extension add engines to existing models. For example,
#' Some parsnip extension add engines to existing models. For example,
#' the \pkg{poissonreg} package adds additional engines for the [poisson_reg()]
#' model and these are not available unless \pkg{poissonreg} is loaded.
#' @param x The name of a `parsnip` model (e.g., "linear_reg", "mars", etc.)
#' @param x The name of a parsnip model (e.g., "linear_reg", "mars", etc.)
#' @return A tibble.
#'
#' @examplesIf !parsnip:::is_cran_check()
Expand Down
2 changes: 1 addition & 1 deletion R/extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' importance/explainers.
#'
#' However, users should not invoke the `predict()` method on an extracted
#' model. There may be preprocessing operations that `parsnip` has executed on
#' model. There may be preprocessing operations that parsnip has executed on
#' the data prior to giving it to the model. Bypassing these can lead to errors
#' or silently generating incorrect predictions.
#'
Expand Down
4 changes: 2 additions & 2 deletions R/model_object_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' software will be used. It can be a package name or a technology
#' type.
#'
#' This class and structure is the basis for how \pkg{parsnip}
#' This class and structure is the basis for how parsnip
#' stores model objects prior to seeing the data.
#'
#' @section Argument Details:
Expand All @@ -53,7 +53,7 @@
#' arguments. For example, when calling `mean(dat_vec)`, the object
#' `dat_vec` is immediately evaluated inside of the function.
#'
#' `parsnip` model functions do not do this. For example, using
#' parsnip model functions do not do this. For example, using
#'
#'\preformatted{
#' rand_forest(mtry = ncol(mtcars) - 1)
Expand Down
6 changes: 3 additions & 3 deletions R/repair_call.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#'
#' `repair_call()` call can adjust the model objects call to be usable by other
#' functions and methods.
#' @param x A fitted `parsnip` model. An error will occur if the underlying model
#' @param x A fitted parsnip model. An error will occur if the underlying model
#' does not have a `call` element.
#' @param data A data object that is relevant to the call. In most cases, this
#' is the data frame that was given to `parsnip` for the model fit (i.e., the
#' is the data frame that was given to parsnip for the model fit (i.e., the
#' training set data). The name of this data object is inserted into the call.
#' @return A modified `parsnip` fitted model.
#' @examplesIf !parsnip:::is_cran_check()
Expand All @@ -21,7 +21,7 @@
#' fit(mpg ~ ., data = mtcars)
#'
#' # In this call, note that `data` is not `mtcars` and the `model = ~TRUE`
#' # indicates that the `model` argument is an `rlang` quosure.
#' # indicates that the `model` argument is an rlang quosure.
#' fitted_model$fit$call
#'
#' # All better:
Expand Down
4 changes: 2 additions & 2 deletions R/tidy_glmnet.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' tidy methods for glmnet models
#'
#' `tidy()` methods for the various `glmnet` models that return the coefficients
#' for the specific penalty value used by the `parsnip` model fit.
#' @param x A fitted `parsnip` model that used the `glmnet` engine.
#' for the specific penalty value used by the parsnip model fit.
#' @param x A fitted parsnip model that used the `glmnet` engine.
#' @param penalty A _single_ numeric value. If none is given, the value specified
#' in the model specification is used.
#' @param ... Not used
Expand Down
4 changes: 2 additions & 2 deletions R/tidy_liblinear.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' tidy methods for LiblineaR models
#'
#' `tidy()` methods for the various `LiblineaR` models that return the
#' coefficients from the `parsnip` model fit.
#' @param x A fitted `parsnip` model that used the `LiblineaR` engine.
#' coefficients from the parsnip model fit.
#' @param x A fitted parsnip model that used the `LiblineaR` engine.
#' @param ... Not used
#' @return A tibble with columns `term` and `estimate`.
#' @keywords internal
Expand Down
Loading

0 comments on commit bf6e212

Please sign in to comment.