-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dev checklists for new models/engines/engine docs #1225
Open
hfrick
wants to merge
1
commit into
main
Choose a base branch
from
checklists
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ derby.log | |
^codecov\.yml$ | ||
^LICENSE\.md$ | ||
^man-roxygen$ | ||
^vignettes/articles$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.html | ||
*.R | ||
|
||
/.quarto/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
title: "Dev checklists" | ||
--- | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>" | ||
) | ||
``` | ||
|
||
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. | ||
|
||
Copy these checklists into the corresponding GitHub issue. | ||
|
||
|
||
## Checklist for adding a new model | ||
|
||
All these items should be added to *parsnip*, unless otherwise specified. | ||
|
||
``` | ||
* [ ] 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()`. | ||
|
||
* [ ] 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) | ||
|
||
* [ ] Create an `update()` method. | ||
|
||
* [ ] 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. | ||
|
||
* [ ] Write unit tests for the basic modeling function (independent of the engines). | ||
|
||
* [ ] Add a pkgdown entry. | ||
|
||
* [ ] Add model description to the internal `model_descs` tibble. | ||
|
||
* [ ] Run `purrr::map(parsnip:::extensions(), ~ library(.x, character.only = TRUE))`. | ||
|
||
* [ ] Run `parsnip:::update_model_info_file()`. | ||
|
||
* [ ] Make sure that no entries are removed from `inst/models.tsv`. | ||
|
||
* [ ] Add a documentation entry in `NEWS.md`. | ||
``` | ||
|
||
|
||
## Checklist for adding a new engine | ||
|
||
Engines may live in parsnip or an extension package. | ||
|
||
``` | ||
* [ ] 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) | ||
|
||
* [ ] _[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) | ||
|
||
* [ ] _[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) | ||
|
||
* [ ] _[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) | ||
|
||
* [ ] 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). | ||
|
||
* [ ] 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') | ||
|
||
* [ ] Write unit tests for the engine-specific features. | ||
|
||
* [ ] 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. | ||
|
||
* [ ] 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. | ||
|
||
* [ ] 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? | ||
|
||
* [ ] Add a documentation entry in `NEWS.md`. | ||
``` | ||
|
||
|
||
## Checklist for documenting a new engine | ||
|
||
Engine documentation always goes into parsnip, regardless of where the engine lives. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was considering moving this sentence into the code block so that it gets copied over but I landed on "we all remember this one". Happy to move it though if you think that'd be beneficial. |
||
|
||
``` | ||
* [ ] Make sure that you have the most recent release versions of devtools and roxygen2 installed. | ||
|
||
* [ ] 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) | ||
|
||
* [ ] Write the actual documentation in `{model}_{engine}.Rmd`. | ||
|
||
* [ ] Make use of existing templates for topics like preprocessing requirements and case weights. Add templates if appropriate. | ||
|
||
* [ ] 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) | ||
|
||
* [ ] Make sure to have `@includeRmd man/rmd/{model}_{engine}.md details` | ||
|
||
* [ ] Make sure to have `@name details_{model}_{engine}`. | ||
|
||
* [ ] Use `@keywords internal`. | ||
|
||
* [ ] Make sure that the packages in `parsnip:::extensions()` are installed. | ||
|
||
* [ ] 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) | ||
|
||
* [ ] Run `purrr::map(parsnip:::extensions(), ~ library(.x, character.only = TRUE))`. | ||
|
||
* [ ] Run `parsnip:::update_model_info_file()`. | ||
|
||
* [ ] Make sure that no entries are removed from `inst/models.tsv`. | ||
|
||
* [ ] Restart your R session (with `Shift + Cmd + 0` on MacOS). | ||
|
||
* [ ] 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()`. | ||
|
||
* [ ] Check output for errors. | ||
|
||
* [ ] Run `devtools::document()`. | ||
|
||
* [ ] 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? | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a code block around the actual checklist, so that we hopefully get a copy button on the rendered pkgdown site. The intend is to c+p into a github issue. Plus, we'll see the rendered version of the checklists with the links to examples etc in the github issue.