Skip to content

Commit

Permalink
Merge pull request #110 from tidymodels/0-4-9-RC
Browse files Browse the repository at this point in the history
0.4.9 RC
  • Loading branch information
topepo authored May 31, 2022
2 parents de7dbe3 + f2dea97 commit 80d47aa
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 51 deletions.
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
Package: tidypredict
Title: Run Predictions Inside the Database
Version: 0.4.8.9000
Version: 0.4.9
Authors@R:
person("Max", "Kuhn", , "max@rstudio.com", role = c("aut", "cre"))
c(
person("Max", "Kuhn", , "max@rstudio.com", role = c("aut", "cre")),
person("Edgar", "Ruiz", email = "edgar@rstudio.com", role = c("aut"))
)
Description: It parses a fitted 'R' model object, and returns a formula in
'Tidy Eval' code that calculates the predictions. It works with
several databases back-ends because it leverages 'dplyr' and 'dbplyr'
Expand Down Expand Up @@ -48,5 +51,5 @@ VignetteBuilder:
Config/Needs/website:
tidyverse/tidytemplate
Encoding: UTF-8
RoxygenNote: 7.1.1.9000
RoxygenNote: 7.2.0.9000
Config/testthat/edition: 3
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tidypredict (development version)
# tidypredict 0.4.9

- Fixes issue handling GLM Binomial earth models (#97)

Expand Down
2 changes: 1 addition & 1 deletion R/predict-column.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tidypredict_to_column <- function(df, model, add_interval = FALSE,
interval = 0.95, vars = c("fit", "upper", "lower")) {
fit_model <- tidypredict_fit(model)

if (class(fit_model) == "list") stop("tidypredict_to_column does not support tree based models")
if (inherits(fit_model, "list")) stop("tidypredict_to_column does not support tree based models")

fit <- vars[1]
upper <- vars[2]
Expand Down
4 changes: 2 additions & 2 deletions R/to_sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @export
tidypredict_sql <- function(model, con) {
f <- tidypredict_fit(model)
if (class(f) == "call") {
if (inherits(f, "call")) {
dbplyr::translate_sql(!!f, con = con)
} else {
map(f, ~ dbplyr::translate_sql(!!.x, con = con))
Expand All @@ -37,7 +37,7 @@ tidypredict_sql <- function(model, con) {
#' @export
tidypredict_sql_interval <- function(model, con, interval = 0.95) {
f <- tidypredict_interval(model, interval)
if (class(f) == "call") {
if (inherits(f, "call")) {
dbplyr::translate_sql(!!f, con = con)
} else {
map(f, ~ dbplyr::translate_sql(!!.x, con = con))
Expand Down
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ output: github_document

[![R-CMD-check](https://github.com/tidymodels/tidypredict/workflows/R-CMD-check/badge.svg)](https://github.com/tidymodels/tidypredict/actions)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/tidypredict)](https://CRAN.r-project.org/package=tidypredict)
[![Codecov test coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://codecov.io/gh/tidymodels/tidypredict?branch=main)
[![Codecov test coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/tidypredict?branch=main)
[![Downloads](http://cranlogs.r-pkg.org/badges/tidypredict)](https://CRAN.R-project.org/package=tidypredict)

```{r pre, include = FALSE}
Expand Down Expand Up @@ -120,11 +120,11 @@ tidy(pm)

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 tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://rstd.io/tidymodels-community).
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).

- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/tidypredict/issues).

- Either way, learn how to create and share a [reprex](https://rstd.io/reprex) (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.

- Check out further details on [contributing guidelines for tidymodels packages](https://www.tidymodels.org/contribute/) and [how to get help](https://www.tidymodels.org/help/).

44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# tidypredict <img src="man/figures/logo.png" align="right" width = "120px"/>

[![R-CMD-check](https://github.com/tidymodels/tidypredict/workflows/R-CMD-check/badge.svg)](https://github.com/tidymodels/tidypredict/actions)
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/tidypredict)](https://CRAN.r-project.org/package=tidypredict)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/tidypredict)](https://CRAN.r-project.org/package=tidypredict)
[![Codecov test
coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://codecov.io/gh/tidymodels/tidypredict?branch=main)
coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/tidypredict?branch=main)
[![Downloads](http://cranlogs.r-pkg.org/badges/tidypredict)](https://CRAN.R-project.org/package=tidypredict)

The main goal of `tidypredict` is to enable running predictions inside
Expand Down Expand Up @@ -49,7 +49,7 @@ number to grow much. The main focus at this time is to add more models
to support.

| Function | Description |
| ---------------------------- | ------------------------------------------------------------------------------ |
|------------------------------|--------------------------------------------------------------------------------|
| `tidypredict_fit()` | Returns an R formula that calculates the prediction |
| `tidypredict_sql()` | Returns a SQL query based on the formula from `tidypredict_fit()` |
| `tidypredict_to_column()` | Adds a new column using the formula from `tidypredict_fit()` |
Expand Down Expand Up @@ -94,26 +94,26 @@ formula adds the following capabilities:

The following models are supported by `tidypredict`:

- Linear Regression - `lm()`
- Generalized Linear model - `glm()`
- Random Forest models - `randomForest::randomForest()`
- Random Forest models, via `ranger` - `ranger::ranger()`
- MARS models - `earth::earth()`
- XGBoost models - `xgboost::xgb.Booster.complete()`
- Cubist models - `Cubist::cubist()`
- Tree models, via `partykit` - `partykit::ctree()`
- Linear Regression - `lm()`
- Generalized Linear model - `glm()`
- Random Forest models - `randomForest::randomForest()`
- Random Forest models, via `ranger` - `ranger::ranger()`
- MARS models - `earth::earth()`
- XGBoost models - `xgboost::xgb.Booster.complete()`
- Cubist models - `Cubist::cubist()`
- Tree models, via `partykit` - `partykit::ctree()`

### `parsnip`

`tidypredict` supports models fitted via the `parsnip` interface. The
ones confirmed currently work in `tidypredict` are:

- `lm()` - `parsnip`: `linear_reg()` with *“lm”* as the engine.
- `randomForest::randomForest()` - `parsnip`: `rand_forest()` with
- `lm()` - `parsnip`: `linear_reg()` with *“lm”* as the engine.
- `randomForest::randomForest()` - `parsnip`: `rand_forest()` with
*“randomForest”* as the engine.
- `ranger::ranger()` - `parsnip`: `rand_forest()` with *“ranger”* as
- `ranger::ranger()` - `parsnip`: `rand_forest()` with *“ranger”* as
the engine.
- `earth::earth()` - `parsnip`: `mars()` with *“earth”* as the engine.
- `earth::earth()` - `parsnip`: `mars()` with *“earth”* as the engine.

### `broom`

Expand All @@ -125,7 +125,7 @@ pm <- parse_model(lm(wt ~ ., mtcars))
tidy(pm)
```

## # A tibble: 11 x 2
## # A tibble: 11 × 2
## term estimate
## <chr> <dbl>
## 1 (Intercept) -0.231
Expand All @@ -146,17 +146,17 @@ 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 tidymodels packages, modeling,
- For questions and discussions about tidymodels packages, modeling,
and machine learning, please [post on RStudio
Community](https://rstd.io/tidymodels-community).
Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).

- If you think you have encountered a bug, please [submit an
- If you think you have encountered a bug, please [submit an
issue](https://github.com/tidymodels/tidypredict/issues).

- Either way, learn how to create and share a
[reprex](https://rstd.io/reprex) (a minimal, reproducible example),
- 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.

- Check out further details on [contributing guidelines for tidymodels
- Check out further details on [contributing guidelines for tidymodels
packages](https://www.tidymodels.org/contribute/) and [how to get
help](https://www.tidymodels.org/help/).
9 changes: 2 additions & 7 deletions man/tidypredict-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tidypredict.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageCleanBeforeInstall: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette
2 changes: 1 addition & 1 deletion vignettes/cubist.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Cubist models"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{cubist}
%\VignetteIndexEntry{Cubist models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/glm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Generalized Linear Regression"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{glm}
%\VignetteIndexEntry{Generalized Linear Regression}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/lm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Linear Regression"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{lm}
%\VignetteIndexEntry{Linear Regression}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/mars.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "MARS models via the `earth` package"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{mars}
%\VignetteIndexEntry{MARS models via the `earth` package}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/non-r.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Non-R Models"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{non-r}
%\VignetteIndexEntry{Non-R Models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/ranger.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Random Forest, using Ranger"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{ranger}
%\VignetteIndexEntry{Random Forest, using Ranger}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/regression.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Create a regression spec - version 2"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{regression}
%\VignetteIndexEntry{Create a regression spec - version 2}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/rf.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Random Forest"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{rf}
%\VignetteIndexEntry{Random Forest}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/save.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Save and re-load models"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{save}
%\VignetteIndexEntry{Save and re-load models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/sql.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Database write-back"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{randomForest}
%\VignetteIndexEntry{Database write-back}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/tree.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Create a tree spec - version 2"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{tree}
%\VignetteIndexEntry{Create a tree spec - version 2}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
2 changes: 1 addition & 1 deletion vignettes/xgboost.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "XGBoost models"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{xgboost}
%\VignetteIndexEntry{XGBoost models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down

0 comments on commit 80d47aa

Please sign in to comment.