|
| 1 | +--- |
| 2 | +title: "Dev checklists" |
| 3 | +--- |
| 4 | + |
| 5 | +```{r, include = FALSE} |
| 6 | +knitr::opts_chunk$set( |
| 7 | + collapse = TRUE, |
| 8 | + comment = "#>" |
| 9 | +) |
| 10 | +``` |
| 11 | + |
| 12 | +These are checklists used by the tidymodels team. If you want to use them to add models and/or engines in your own package, you will have to adapt them somewhat. |
| 13 | + |
| 14 | +Copy these checklists into the corresponding GitHub issue. |
| 15 | + |
| 16 | + |
| 17 | +## Checklist for adding a new model |
| 18 | + |
| 19 | +All these items should be added to *parsnip*, unless otherwise specified. |
| 20 | + |
| 21 | +``` |
| 22 | +* [ ] Create the main modeling function (e.g. `nearest_neighbors()`). When choosing argument names, check for existing ones across other model types which could be reused, e.g., `trees` for the number of trees is used across different tree-based models like `rand_forest()` and `boost_tree()`. |
| 23 | +
|
| 24 | +* [ ] Register the model and a mode in the parsnip model “database” with `parsnip::set_new_model()` and `parsnip::set_model_mode()`. [[example]](https://github.com/tidymodels/parsnip/blob/c54f07b7e1f7ce164aab8f95bc7b1356b68558c8/R/proportional_hazards_data.R) |
| 25 | +
|
| 26 | +* [ ] Create an `update()` method. |
| 27 | +
|
| 28 | +* [ ] Add parameter objects for main parameters to *dials*, if needed. See [How to create a tuning parameter function](https://www.tidymodels.org/learn/develop/parameters/) for more details. |
| 29 | +
|
| 30 | +* [ ] Write unit tests for the basic modeling function (independent of the engines). |
| 31 | +
|
| 32 | +* [ ] Add a pkgdown entry. |
| 33 | +
|
| 34 | +* [ ] Add model description to the internal `model_descs` tibble. |
| 35 | +
|
| 36 | +* [ ] Run `purrr::map(parsnip:::extensions(), ~ library(.x, character.only = TRUE))`. |
| 37 | +
|
| 38 | +* [ ] Run `parsnip:::update_model_info_file()`. |
| 39 | +
|
| 40 | +* [ ] Make sure that no entries are removed from `inst/models.tsv`. |
| 41 | +
|
| 42 | +* [ ] Add a documentation entry in `NEWS.md`. |
| 43 | +``` |
| 44 | + |
| 45 | + |
| 46 | +## Checklist for adding a new engine |
| 47 | + |
| 48 | +Engines may live in parsnip or an extension package. |
| 49 | + |
| 50 | +``` |
| 51 | +* [ ] Write the initial functions that will populate the parsnip model “database”. For example, `parsnip::set_fit()` and so on. Suggested file name: `{model_name}-data.R`. [[example]](https://github.com/tidymodels/censored/blob/efbb1cf3b2ba8bca5de65acc3c8b665dec35631c/R/decision_tree-data.R#L13-L83) |
| 52 | +
|
| 53 | +* [ ] _[extension pkg]_ Make sure that `parsnip::set_dependency()` has an entry for the package that contains the engine definition as well as the actual dependencies. [[example]](https://github.com/tidymodels/censored/blob/efbb1cf3b2ba8bca5de65acc3c8b665dec35631c/R/decision_tree-data.R#L14-L21) |
| 54 | +
|
| 55 | +* [ ] _[extension pkg]_ Put the `set_*()` calls in a wrapper function that will register the model with parsnip. Suggested name: `make_{model name}_{engine name}()`. [[example]](https://github.com/tidymodels/censored/blob/efbb1cf3b2ba8bca5de65acc3c8b665dec35631c/R/decision_tree-data.R#L12) |
| 56 | +
|
| 57 | +* [ ] _[extension pkg]_ Add the registration functions to `.onLoad()` in the `zzz.R` file. [(example)](https://github.com/tidymodels/censored/blob/efbb1cf3b2ba8bca5de65acc3c8b665dec35631c/R/zzz.R#L13) |
| 58 | +
|
| 59 | +* [ ] Engine-specific tuning parameters: Necessary parameter objects [[example]](https://github.com/tidymodels/dials/blob/d47dc47f42ad9c190d7f4a1ec85db0e385345ec0/R/param_num_knots.R) should go into *dials* and the `tunable()` method [[example]](https://github.com/tidymodels/parsnip/blob/bdc28548fd46493b52b408b6c1e04e1f80d0abdf/R/tunable.R#L338-L345) should go into parsnip. This needs a tibble which links engine arguments to dials parameter objects [[example]](https://github.com/tidymodels/parsnip/blob/bdc28548fd46493b52b408b6c1e04e1f80d0abdf/R/tunable.R#L206-L215). |
| 60 | +
|
| 61 | +* [ ] Optionally create methods for `translate()` and `check_args()` to handle engine-specific cases. These `.{model name}` methods should go into parsnip, even if the engine is defined in an extension package, as they may contain code for various engines distributed across multiple extension packages. [(example)](https://github.com/tidymodels/parsnip/blob/c54f07b7e1f7ce164aab8f95bc7b1356b68558c8/R/proportional_hazards.R#L85:L98') |
| 62 | +
|
| 63 | +* [ ] Write unit tests for the engine-specific features. |
| 64 | +
|
| 65 | +* [ ] Write unit tests for model-specific features which require an engine. If parsnip does not contain _any_ engines for the model, put these in the extension package. |
| 66 | +
|
| 67 | +* [ ] Write the engine-specific documentation. This documentation always goes into parsnip, regardless of where the engine is defined. See the [README](https://github.com/tidymodels/parsnip/blob/main/inst/README-DOCS.md) for the parsnip documentation system. |
| 68 | +
|
| 69 | +* [ ] If the engine is added in parsnip, update `vignettes/articles/Examples.Rmd`. If the engine is added in an extension package: does it have a corresponding article that needs updating? Does the README list available models/engines and needs updating? |
| 70 | +
|
| 71 | +* [ ] Add a documentation entry in `NEWS.md`. |
| 72 | +``` |
| 73 | + |
| 74 | + |
| 75 | +## Checklist for documenting a new engine |
| 76 | + |
| 77 | +Engine documentation always goes into parsnip, regardless of where the engine lives. |
| 78 | + |
| 79 | +``` |
| 80 | +* [ ] Make sure that you have the most recent release versions of devtools and roxygen2 installed. |
| 81 | +
|
| 82 | +* [ ] Add a new Rmd file to `parsnip/man/rmd` called `{model}_{engine}.Rmd`. [[example]](https://github.com/tidymodels/parsnip/blob/c54f07b7e1f7ce164aab8f95bc7b1356b68558c8/man/rmd/decision_tree_rpart.Rmd) |
| 83 | +
|
| 84 | +* [ ] Write the actual documentation in `{model}_{engine}.Rmd`. |
| 85 | +
|
| 86 | +* [ ] Make use of existing templates for topics like preprocessing requirements and case weights. Add templates if appropriate. |
| 87 | +
|
| 88 | +* [ ] Add a new R file to `parsnip/R` called `{model}_{engine}.R`. [[example]](https://github.com/tidymodels/parsnip/blob/c54f07b7e1f7ce164aab8f95bc7b1356b68558c8/R/decision_tree_rpart.R) |
| 89 | +
|
| 90 | +* [ ] Make sure to have `@includeRmd man/rmd/{model}_{engine}.md details` |
| 91 | +
|
| 92 | +* [ ] Make sure to have `@name details_{model}_{engine}`. |
| 93 | +
|
| 94 | +* [ ] Use `@keywords internal`. |
| 95 | +
|
| 96 | +* [ ] Make sure that the packages in `parsnip:::extensions()` are installed. |
| 97 | +
|
| 98 | +* [ ] Make sure that the `rmd_pkgs` listed in `parsnip/man/rmd/aaa.Rmd` are also installed. [[example]](https://github.com/tidymodels/parsnip/blob/main/man/rmd/aaa.Rmd#L20:L21) |
| 99 | +
|
| 100 | +* [ ] Run `purrr::map(parsnip:::extensions(), ~ library(.x, character.only = TRUE))`. |
| 101 | +
|
| 102 | +* [ ] Run `parsnip:::update_model_info_file()`. |
| 103 | +
|
| 104 | +* [ ] Make sure that no entries are removed from `inst/models.tsv`. |
| 105 | +
|
| 106 | +* [ ] Restart your R session (with `Shift + Cmd + 0` on MacOS). |
| 107 | +
|
| 108 | +* [ ] Run `parsnip:::knit_engine_docs()`. There is an optional `pattern` argument to filter which documentation files are being processed. Note that this needs to execute `knit_engine_docs()` from an installed version of parsnip as opposed to parsnip being loaded via `devtools::load_all()`. |
| 109 | +
|
| 110 | +* [ ] Check output for errors. |
| 111 | +
|
| 112 | +* [ ] Run `devtools::document()`. |
| 113 | +
|
| 114 | +* [ ] Reinstall parsnip and check that the main modeling function has an entry for your engine. If it does not, was the model added to the parsnip model database? |
| 115 | +``` |
0 commit comments