You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.Rmd
+22-7Lines changed: 22 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ library(modeldb)
14
14
[](https://codecov.io/gh/tidymodels/modeldb?branch=master)
Fit models inside the database.**`modeldb` works with most databases back-ends** because it leverages `dplyr` and `dbplyr` for the final SQL translation of the algorithm. It currently supports:
17
+
Fit models inside the database!**modeldb works with most database back-ends** because it leverages [dplyr](https://dplyr.tidyverse.org/) and [dbplyr](https://dbplyr.tidyverse.org/) for the final SQL translation of the algorithm. It currently supports:
18
18
19
19
- K-means clustering
20
20
@@ -23,19 +23,21 @@ Fit models inside the database. **`modeldb` works with most databases back-ends*
23
23
## Installation
24
24
25
25
Install the CRAN version with:
26
+
26
27
```{r, eval = FALSE}
27
-
# install.packages("modeldb")
28
+
install.packages("modeldb")
28
29
```
29
30
30
-
The development version is available using `devtools` as follows:
31
+
The development version is available from GitHub using remotes:
32
+
31
33
```{r, eval = FALSE}
32
34
# install.packages("remotes")
33
-
# remotes::install_github("tidymodels/modeldb")
35
+
remotes::install_github("tidymodels/modeldb")
34
36
```
35
37
36
38
## Linear regression
37
39
38
-
An easy way to try out the package is by creating a temporary SQLite database, and loading `mtcars` to it
40
+
An easy way to try out the package is by creating a temporary SQLite database, and loading `mtcars` to it.
39
41
40
42
```{r}
41
43
con <- DBI::dbConnect(RSQLite::SQLite(), path = ":memory:")
@@ -51,7 +53,7 @@ tbl(con, "mtcars") %>%
51
53
linear_regression_db(wt)
52
54
```
53
55
54
-
The model output can be parsed by `tidypredict` to run the predictions in the database. Please see the `Linear Regression` article to learn more about how to use `linear_regression_db()`
56
+
The model output can be parsed by [tidypredict](https://tidypredict.tidymodels.org/) to run the predictions in the database. Please see the "Linear Regression" article to learn more about how to use `linear_regression_db()`
55
57
56
58
## K Means clustering
57
59
@@ -67,8 +69,21 @@ km <- tbl(con, "mtcars") %>%
67
69
colnames(km)
68
70
```
69
71
70
-
The SQL statement from `tbl` can be extracted using `dbplyr`'s `remote_query()`
72
+
The SQL statement from `tbl` can be extracted using dbplyr's `remote_query()`
71
73
72
74
```{r}
73
75
dbplyr::remote_query(km)
74
76
```
77
+
78
+
## Contributing
79
+
80
+
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.
81
+
82
+
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://rstd.io/tidymodels-community).
83
+
84
+
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/modeldb/issues).
85
+
86
+
- Either way, learn how to create and share a [reprex](https://rstd.io/reprex) (a minimal, reproducible example), to clearly communicate about your code. Check out [this helpful article on how to create reprexes](https://dbplyr.tidyverse.org/articles/reprex.html) for problems involving a database.
87
+
88
+
- 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/).
The model output can be parsed by `tidypredict` to run the predictions
59
-
in the database. Please see the `Linear Regression` article to learn
60
-
more about how to use `linear_regression_db()`
59
+
The model output can be parsed by
60
+
[tidypredict](https://tidypredict.tidymodels.org/) to run the
61
+
predictions in the database. Please see the “Linear Regression” article
62
+
to learn more about how to use `linear_regression_db()`
61
63
62
64
## K Means clustering
63
65
@@ -81,34 +83,60 @@ colnames(km)
81
83
## [7] "hp" "drat" "wt" "qsec" "vs" "am"
82
84
## [13] "gear" "carb"
83
85
84
-
The SQL statement from `tbl` can be extracted using `dbplyr`’s
86
+
The SQL statement from `tbl` can be extracted using dbplyr’s
85
87
`remote_query()`
86
88
87
89
```r
88
90
dbplyr::remote_query(km)
89
91
```
90
92
91
-
## <SQL> SELECT `RHS`.`center` AS `k_center`, `LHS`.`k_mpg` AS `k_mpg`, `LHS`.`k_wt` AS `k_wt`, `RHS`.`mpg` AS `mpg`, `RHS`.`cyl` AS `cyl`, `RHS`.`disp` AS `disp`, `RHS`.`hp` AS `hp`, `RHS`.`drat` AS `drat`, `RHS`.`wt` AS `wt`, `RHS`.`qsec` AS `qsec`, `RHS`.`vs` AS `vs`, `RHS`.`am` AS `am`, `RHS`.`gear` AS `gear`, `RHS`.`carb` AS `carb`
92
-
## FROM (SELECT `center` AS `k_center`, `mpg` AS `k_mpg`, `wt` AS `k_wt`
93
-
## FROM (SELECT `center`, AVG(`mpg`) AS `mpg`, AVG(`wt`) AS `wt`
## FROM (SELECT `LHS`.`mpg` AS `mpg`, `LHS`.`cyl` AS `cyl`, `LHS`.`disp` AS `disp`, `LHS`.`hp` AS `hp`, `LHS`.`drat` AS `drat`, `LHS`.`wt` AS `wt`, `LHS`.`qsec` AS `qsec`, `LHS`.`vs` AS `vs`, `LHS`.`am` AS `am`, `LHS`.`gear` AS `gear`, `LHS`.`carb` AS `carb`, `LHS`.`k_center` AS `k_center`, `RHS`.`k_mpg` AS `k_mpg`, `RHS`.`k_wt` AS `k_wt`
95
+
## FROM (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, `center` AS `k_center`
96
96
## FROM (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, `center_1`, `center_2`, `center_3`, CASE
97
97
## WHEN (`center_1` >= `center_1` AND `center_1` < `center_2` AND `center_1` < `center_3`) THEN ('center_1')
98
98
## WHEN (`center_2` < `center_1` AND `center_2` >= `center_2` AND `center_2` < `center_3`) THEN ('center_2')
99
99
## WHEN (`center_3` < `center_1` AND `center_3` < `center_2` AND `center_3` >= `center_3`) THEN ('center_3')
0 commit comments