From 1498c8822c2d07bce6ee534b3fef8b9bbd78e22a Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Tue, 7 Mar 2023 11:35:10 -0700 Subject: [PATCH] =?UTF-8?q?Spring=20cleaning=20=F0=9F=A7=BC=20=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update DESCRIPTION, CoC * Update README, vignette * Update GH actions --- .github/CODE_OF_CONDUCT.md | 2 +- .github/workflows/R-CMD-check-hard.yaml | 2 +- .github/workflows/R-CMD-check.yaml | 12 +-- .github/workflows/pkgdown.yaml | 2 +- .github/workflows/pr-commands.yaml | 4 +- .github/workflows/test-coverage.yaml | 2 +- CODE_OF_CONDUCT.md | 126 ------------------------ DESCRIPTION | 17 ++-- README.Rmd | 6 +- README.md | 58 +++++------ vignettes/bundle.Rmd | 2 +- 11 files changed, 54 insertions(+), 179 deletions(-) delete mode 100644 CODE_OF_CONDUCT.md diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index df4ca2e..3ac34c8 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -59,7 +59,7 @@ representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at codeofconduct@rstudio.com. +reported to the community leaders responsible for enforcement at codeofconduct@posit.co. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index 8799579..33a34ec 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -31,7 +31,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9350b71..5a14911 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -22,21 +22,21 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-18.04, r: 'release'} - - {os: ubuntu-18.04, r: 'oldrel-1'} - - {os: ubuntu-18.04, r: 'oldrel-2'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + - {os: ubuntu-latest, r: 'oldrel-2'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 041c2ec..d6e899d 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -20,7 +20,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index 97271eb..71f335b 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -14,7 +14,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/pr-fetch@v2 with: @@ -51,7 +51,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/pr-fetch@v2 with: diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index baa7a9b..9a868e2 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -15,7 +15,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-r@v2 with: diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index df4ca2e..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,126 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, caste, color, religion, or sexual -identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall - community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or advances of - any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, - without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at codeofconduct@rstudio.com. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series of -actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or permanent -ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within the -community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.1, available at -. - -Community Impact Guidelines were inspired by -[Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion]. - -For answers to common questions about this code of conduct, see the FAQ at -. Translations are available at . - -[homepage]: https://www.contributor-covenant.org diff --git a/DESCRIPTION b/DESCRIPTION index 5251fa5..2786969 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,18 +2,19 @@ Package: bundle Title: Serialize Model Objects with a Consistent Interface Version: 0.1.0.9000 Authors@R: c( - person("Julia", "Silge", , "julia.silge@rstudio.com", role = c("aut", "cre"), + person("Julia", "Silge", , "julia.silge@posit.co", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3671-836X")), person("Simon", "Couch", , "simonpatrickcouch@gmail.com", role = "aut"), person("Qiushi", "Yan", , "qiushi.yann@gmail.com", role = "aut"), - person("Max", "Kuhn", , "max@rstudio.com", role = "aut"), - person("RStudio", role = c("cph", "fnd")) + person("Max", "Kuhn", , "max@posit.co", role = "aut"), + person(given = "Posit Software, PBC", role = c("cph", "fnd")) ) Description: Typically, models in 'R' exist in memory and can be saved via - regular 'R' serialization. However, some models store information in - locations that cannot be saved using 'R' serialization alone. The goal of - 'bundle' is to provide a common interface to capture this information, - situate it within a portable object, and restore it for use in new settings. + regular 'R' serialization. However, some models store information in + locations that cannot be saved using 'R' serialization alone. The goal + of 'bundle' is to provide a common interface to capture this + information, situate it within a portable object, and restore it for + use in new settings. License: MIT + file LICENSE URL: https://github.com/rstudio/bundle, https://rstudio.github.io/bundle/ BugReports: https://github.com/rstudio/bundle/issues @@ -42,8 +43,8 @@ Suggests: renv, rmarkdown, stacks, - testthat (>= 3.0.0), tensorflow, + testthat (>= 3.0.0), torch, torchvision, uwot, diff --git a/README.Rmd b/README.Rmd index 3bf518c..9e2b287 100644 --- a/README.Rmd +++ b/README.Rmd @@ -41,8 +41,8 @@ install.packages("bundle") And the development version from [GitHub](https://github.com/) with: ``` r -# install.packages("devtools") -devtools::install_github("rstudio/bundle") +# install.packages("pak") +pak::pak("rstudio/bundle") ``` ## Overview @@ -51,7 +51,7 @@ We often imagine a trained model as a somewhat "standalone" R object---given som We need some way to preserve access to those references. The bundle package provides a consistent interface for _bundling_ model objects with their references so that they can be safely saved and re-loaded in production: -```{r diagram-04, echo = FALSE, fig.alt = "A replica of the previous diagram, where the arrow previously connecting the model object in R session one and the standalone model object in R session two is connected by a verb called bundle. The bundle function outputs an object called a bundle.", out.width = '100%'} +```{r diagram-04, echo = FALSE, fig.alt = "A diagram showing a rectangle, labeled model object, and another rectangle, labeled predictions. The two are connected by an arrow from model object to predictions, with the label 'predict'. There are two boxes labeled reference, connected to the arrow labeled predict with dotted arrows, to show that, most of the time, we don't need to think about including them in our workflow. There are two boxes, labeled R Session number one, and R session number two. In focus is the arrow from the model object, in R Session number one, to a model object in R session number two. This arrow connecting the model object in R session one and the model object in R session two is connected by a verb called bundle. The bundle function outputs an object called a bundle.", out.width = '100%'} knitr::include_graphics("man/figures/diagram_04.png") ``` diff --git a/README.md b/README.md index da85e6d..284bc94 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ install.packages("bundle") And the development version from [GitHub](https://github.com/) with: ``` r -# install.packages("devtools") -devtools::install_github("rstudio/bundle") +# install.packages("pak") +pak::pak("rstudio/bundle") ``` ## Overview @@ -57,7 +57,7 @@ package provides a consistent interface for *bundling* model objects with their references so that they can be safely saved and re-loaded in production: -A replica of the previous diagram, where the arrow previously connecting the model object in R session one and the standalone model object in R session two is connected by a verb called bundle. The bundle function outputs an object called a bundle. +A diagram showing a rectangle, labeled model object, and another rectangle, labeled predictions. The two are connected by an arrow from model object to predictions, with the label 'predict'. There are two boxes labeled reference, connected to the arrow labeled predict with dotted arrows, to show that, most of the time, we don't need to think about including them in our workflow. There are two boxes, labeled R Session number one, and R session number two. In focus is the arrow from the model object, in R Session number one, to a model object in R session number two. This arrow connecting the model object in R session one and the model object in R session two is connected by a verb called bundle. The bundle function outputs an object called a bundle. For more on this diagram, see the [main bundle vignette](https://rstudio.github.io/bundle/articles/bundle.html). @@ -96,14 +96,14 @@ mod #> parsnip model object #> #> ##### xgb.Booster -#> raw: 8 Kb +#> raw: 8.1 Kb #> call: #> xgboost::xgb.train(params = list(eta = 0.3, max_depth = 6, gamma = 0, #> colsample_bytree = 1, colsample_bynode = 0.3, min_child_weight = 1, -#> subsample = 1, objective = "reg:squarederror"), data = x$data, -#> nrounds = 5, watchlist = x$watchlist, verbose = 0, nthread = 1) +#> subsample = 1), data = x$data, nrounds = 5, watchlist = x$watchlist, +#> verbose = 0, nthread = 1, objective = "reg:squarederror") #> params (as set within xgb.train): -#> eta = "0.3", max_depth = "6", gamma = "0", colsample_bytree = "1", colsample_bynode = "0.3", min_child_weight = "1", subsample = "1", objective = "reg:squarederror", nthread = "1", validate_parameters = "TRUE" +#> eta = "0.3", max_depth = "6", gamma = "0", colsample_bytree = "1", colsample_bynode = "0.3", min_child_weight = "1", subsample = "1", nthread = "1", objective = "reg:squarederror", validate_parameters = "TRUE" #> xgb.attributes: #> niter #> callbacks: @@ -113,11 +113,11 @@ mod #> nfeatures : 10 #> evaluation_log: #> iter training_rmse -#> 1 14.640496 -#> 2 10.911261 -#> 3 8.226121 -#> 4 6.231544 -#> 5 4.761105 +#> 1 14.631798 +#> 2 10.865171 +#> 3 8.130434 +#> 4 6.150935 +#> 5 4.681918 ``` Note that simply saving and loading the model results in changes to the @@ -129,7 +129,7 @@ saveRDS(mod, temp_file) mod2 <- readRDS(temp_file) compare(mod, mod2, ignore_formula_env = TRUE) -#> `old$fit$handle` is +#> `old$fit$handle` is #> `new$fit$handle` is #> #> `old$fit$handle` is attr(,"class") @@ -176,13 +176,13 @@ r( #> # A tibble: 7 × 1 #> .pred #> -#> 1 22.1 -#> 2 20.6 -#> 3 16.5 -#> 4 14.1 -#> 5 16.5 -#> 6 11.8 -#> 7 18.8 +#> 1 22.4 +#> 2 22.4 +#> 3 19.0 +#> 4 19.4 +#> 5 16.6 +#> 6 11.2 +#> 7 22.4 ``` For a more in-depth demonstration of the package, see the [main @@ -195,14 +195,14 @@ This project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms. -- For questions and discussions about our packages, modeling, and - machine learning, please [post on RStudio - Community](https://community.rstudio.com/new-topic?category_id=15&tags=question). +- For questions and discussions about our packages, modeling, and + machine learning, please [post on RStudio + Community](https://community.rstudio.com/new-topic?category_id=15&tags=question). -- If you think you have encountered a bug, please [submit an - issue](https://github.com/rstudio/bundle/issues). +- If you think you have encountered a bug, please [submit an + issue](https://github.com/rstudio/bundle/issues). -- Either way, learn how to create and share a - [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) - (a minimal, reproducible example), to clearly communicate about your - code. +- Either way, learn how to create and share a + [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) + (a minimal, reproducible example), to clearly communicate about your + code. diff --git a/vignettes/bundle.Rmd b/vignettes/bundle.Rmd index d2baf8e..bb7fd15 100644 --- a/vignettes/bundle.Rmd +++ b/vignettes/bundle.Rmd @@ -200,7 +200,7 @@ We've done the work of figuring that out, and it turns out the interface is a li What if we could just use the same function for any R object, and it would _just work_? -```{r diagram-03, echo = FALSE, fig.alt = "A diagram showing the same set of rectangles, representing a prediction problem, as before. This version of the diagram adds two boxes, labeled R Session numbe r one, and R session number two. In R session number two, we have a new rectangle labeled standalone model object. In focus is the arrow from the model object, in R Session number one, to the standalone model object in R session number two.", out.width = '100%'} +```{r diagram-03, echo = FALSE, fig.alt = "A diagram showing the same set of rectangles, representing a prediction problem, as before. This version of the diagram adds two boxes, labeled R Session number one, and R session number two. In R session number two, we have a new rectangle labeled standalone model object. In focus is the arrow from the model object, in R Session number one, to the standalone model object in R session number two.", out.width = '100%'} knitr::include_graphics("figures/diagram_03.png") ```