tidypredict

Run predictions inside the database. tidypredict 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 for the final SQL translation of the algorithm. It currently supports lm(), glm(), randomForest() and ranger() models.

Installation

Install tidypredict from CRAN using:

install.packages("tidypredict")

Or install the development version using devtools as follows:

devtools::install_github("edgararuiz/tidypredict")

Intro

tidypredict is able to parse an R model object, such as:

model <- lm(mpg ~ wt + cyl, data = mtcars)

And then creates the SQL statement needed to calculate the fitted prediction:

tidypredict_sql(model, dbplyr::simulate_mssql())
## <SQL> ((39.6862614802529) + ((`wt`) * (-3.19097213898374))) + ((`cyl`) * (-1.5077949682598))

Supported models

The following R models are currently supported. For more info please review the corresponding vignette:

Skip to content This repository Search Pull requests Issues Marketplace Explore @edgararuiz Sign out Unwatch 9 Star 5 Fork 5 rstudio/db.rstudio.com Code Issues 6 Pull requests 0 Projects 0 Wiki Insights Settings Tree: 7a7548589f Find file Copy pathdb.rstudio.com/themes/hugo-material-docs/layouts/partials/footer_js.html 7a75485 on Apr 22, 2017 @edgararuiz edgararuiz Fix to theme's scrollspy 1 contributor RawBlameHistory 84 lines (73 sloc) 2.83 KB © 2018 GitHub, Inc. Terms Privacy Security Status Help Contact GitHub API Training Shop Blog About