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
dbplyr for the final SQL translation of the algorithm. It currently supports
randomForest() models. Models from the
ranger() package are now supported in the development version of the
tidypredict from CRAN using:
Or install the development version using
devtools as follows:
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:
## <SQL> ((39.6862614802529) + ((`wt`) * (-3.19097213898374))) + ((`cyl`) * (-1.5077949682598))
The following R models are currently supported. For more info please review the corresponding vignette: