-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
117 lines (78 loc) · 3.38 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# orbital <a href="https://orbital.tidymodels.org"><img src="man/figures/logo.png" align="right" height="138" alt="orbital website" /></a>
<!-- badges: start -->
[![R-CMD-check](https://github.com/tidymodels/orbital/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidymodels/orbital/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/orbital)](https://CRAN.R-project.org/package=orbital)
[![Codecov test coverage](https://codecov.io/gh/tidymodels/orbital/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/orbital?branch=main)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
The goal of orbital is to enable running predictions of tidymodels [workflows](https://workflows.tidymodels.org/) inside databases.
## Installation
To install it, use:
``` r
install.packages("orbital")
```
You can install the development version of orbital from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("tidymodels/orbital")
```
## Example
Given a fitted workflow
```{r}
#| message: false
library(tidymodels)
rec_spec <- recipe(mpg ~ ., data = mtcars) |>
step_normalize(all_numeric_predictors())
lm_spec <- linear_reg()
wf_spec <- workflow(rec_spec, lm_spec)
wf_fit <- fit(wf_spec, mtcars)
```
You can predict with it like normal.
```{r}
predict(wf_fit, mtcars)
```
We can get the same results by first creating an orbital object
```{r}
library(orbital)
orbital_obj <- orbital(wf_fit)
orbital_obj
```
and then "predicting" with it using `predict()` to get the same results
```{r}
predict(orbital_obj, as_tibble(mtcars))
```
you can also predict in most SQL databases
```{r}
library(DBI)
library(RSQLite)
con <- dbConnect(SQLite(), path = ":memory:")
db_mtcars <- copy_to(con, mtcars)
predict(orbital_obj, db_mtcars)
```
and spark databases
```{r}
library(sparklyr)
sc <- spark_connect(master = "local")
sc_mtcars <- copy_to(sc, mtcars, overwrite = TRUE)
predict(orbital_obj, sc_mtcars)
```
# Supported models and recipes steps
Full list of supported models and recipes steps can be found here: `vignette("supported-models")`.
## contributing
This project is released with a [Contributor Code of Conduct](https://github.com/tidymodels/orbital/blob/main/.github/CODE_OF_CONDUCT.md). 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 Posit Community](https://forum.posit.co/new-topic?category_id=15&tags=tidymodels,question).
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/orbital/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.
- 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/).