Skip to content

Commit 8f8aa01

Browse files
Merge pull request #121 from Wander03/create-find-table-clustering
2 parents 79f37f1 + 3fe62e0 commit 8f8aa01

File tree

7 files changed

+164
-0
lines changed

7 files changed

+164
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"hash": "0e8f13f1432971d2a7e8cd1950864393",
3+
"result": {
4+
"engine": "knitr",
5+
"markdown": "---\ntitle: Search tidyclust models\nweight: 2\ndescription: | \n Find model types and engines to fit and predict clustering methods in the tidymodels framework.\ntoc: true\ntoc-depth: 0\ninclude-after-body: ../../resources.html\ncss: ../styles-find.css\n---\n\n\n\n\nTo learn about the tidyclust package, click on the link in the topic column. Use the tables below to find [model types and engines](#models).\n\n\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n\n```{=html}\n<div class=\"datatables html-widget html-fill-item\" id=\"htmlwidget-1b4ff99564eb6e8884a5\" style=\"width:100%;height:auto;\"></div>\n<script type=\"application/json\" data-for=\"htmlwidget-1b4ff99564eb6e8884a5\">{\"x\":{\"filter\":\"top\",\"vertical\":false,\"filterHTML\":\"<tr>\\n <td data-type=\\\"character\\\" style=\\\"vertical-align: top;\\\">\\n <div class=\\\"form-group has-feedback\\\" style=\\\"margin-bottom: auto;\\\">\\n <input type=\\\"search\\\" placeholder=\\\"All\\\" class=\\\"form-control\\\" style=\\\"width: 100%;\\\"/>\\n <span class=\\\"glyphicon glyphicon-remove-circle form-control-feedback\\\"><\\/span>\\n <\\/div>\\n <\\/td>\\n <td data-type=\\\"character\\\" style=\\\"vertical-align: top;\\\">\\n <div class=\\\"form-group has-feedback\\\" style=\\\"margin-bottom: auto;\\\">\\n <input type=\\\"search\\\" placeholder=\\\"All\\\" class=\\\"form-control\\\" style=\\\"width: 100%;\\\"/>\\n <span class=\\\"glyphicon glyphicon-remove-circle form-control-feedback\\\"><\\/span>\\n <\\/div>\\n <\\/td>\\n <td data-type=\\\"character\\\" style=\\\"vertical-align: top;\\\">\\n <div class=\\\"form-group has-feedback\\\" style=\\\"margin-bottom: auto;\\\">\\n <input type=\\\"search\\\" placeholder=\\\"All\\\" class=\\\"form-control\\\" style=\\\"width: 100%;\\\"/>\\n <span class=\\\"glyphicon glyphicon-remove-circle form-control-feedback\\\"><\\/span>\\n <\\/div>\\n <\\/td>\\n <td data-type=\\\"character\\\" style=\\\"vertical-align: top;\\\">\\n <div class=\\\"form-group has-feedback\\\" style=\\\"margin-bottom: auto;\\\">\\n <input type=\\\"search\\\" placeholder=\\\"All\\\" class=\\\"form-control\\\" style=\\\"width: 100%;\\\"/>\\n <span class=\\\"glyphicon glyphicon-remove-circle form-control-feedback\\\"><\\/span>\\n <\\/div>\\n <\\/td>\\n <td data-type=\\\"factor\\\" style=\\\"vertical-align: top;\\\">\\n <div class=\\\"form-group has-feedback\\\" style=\\\"margin-bottom: auto;\\\">\\n <input type=\\\"search\\\" placeholder=\\\"All\\\" class=\\\"form-control\\\" style=\\\"width: 100%;\\\" disabled=\\\"\\\"/>\\n <span class=\\\"glyphicon glyphicon-remove-circle form-control-feedback\\\"><\\/span>\\n <\\/div>\\n <div style=\\\"width: 100%; display: none;\\\">\\n <select multiple=\\\"multiple\\\" style=\\\"width: 100%;\\\" data-options=\\\"[&quot;partition&quot;]\\\"><\\/select>\\n <\\/div>\\n <\\/td>\\n <td data-type=\\\"factor\\\" style=\\\"vertical-align: top;\\\">\\n <div class=\\\"form-group has-feedback\\\" style=\\\"margin-bottom: auto;\\\">\\n <input type=\\\"search\\\" placeholder=\\\"All\\\" class=\\\"form-control\\\" style=\\\"width: 100%;\\\" disabled=\\\"\\\"/>\\n <span class=\\\"glyphicon glyphicon-remove-circle form-control-feedback\\\"><\\/span>\\n <\\/div>\\n <div style=\\\"width: 100%; display: none;\\\">\\n <select multiple=\\\"multiple\\\" style=\\\"width: 100%;\\\" data-options=\\\"[&quot;tidyclust&quot;]\\\"><\\/select>\\n <\\/div>\\n <\\/td>\\n<\\/tr>\",\"data\":[[\"Hierarchical (Agglomerative) Clustering via stats\",\"K-means via ClusterR\",\"K-means via clustMixType\",\"K-means via klaR\",\"K-means via stats\"],[\"<code>hier_clust<\\/code>\",\"<code>k_means<\\/code>\",\"<code>k_means<\\/code>\",\"<code>k_means<\\/code>\",\"<code>k_means<\\/code>\"],[\"<code>stats<\\/code>\",\"<code>ClusterR<\\/code>\",\"<code>clustMixType<\\/code>\",\"<code>klaR<\\/code>\",\"<code>stats<\\/code>\"],[\"<a href='https://tidyclust.tidymodels.org//reference/details_hier_clust_stats.html' target='_blank'><tt>details_hier_clust_stats<\\/tt><\\/a>\",\"<a href='https://tidyclust.tidymodels.org//reference/details_k_means_ClusterR.html' target='_blank'><tt>details_k_means_ClusterR<\\/tt><\\/a>\",\"<a href='https://tidyclust.tidymodels.org//reference/details_k_means_clustMixType.html' target='_blank'><tt>details_k_means_clustMixType<\\/tt><\\/a>\",\"<a href='https://tidyclust.tidymodels.org//reference/details_k_means_klaR.html' target='_blank'><tt>details_k_means_klaR<\\/tt><\\/a>\",\"<a href='https://tidyclust.tidymodels.org//reference/details_k_means_stats.html' target='_blank'><tt>details_k_means_stats<\\/tt><\\/a>\"],[\"partition\",\"partition\",\"partition\",\"partition\",\"partition\"],[\"tidyclust\",\"tidyclust\",\"tidyclust\",\"tidyclust\",\"tidyclust\"]],\"container\":\"<table class=\\\"cell-border stripe\\\">\\n <thead>\\n <tr>\\n <th>title<\\/th>\\n <th>model<\\/th>\\n <th>engine<\\/th>\\n <th>topic<\\/th>\\n <th>mode<\\/th>\\n <th>package<\\/th>\\n <\\/tr>\\n <\\/thead>\\n<\\/table>\",\"options\":{\"pageLength\":25,\"columnDefs\":[{\"name\":\"title\",\"targets\":0},{\"name\":\"model\",\"targets\":1},{\"name\":\"engine\",\"targets\":2},{\"name\":\"topic\",\"targets\":3},{\"name\":\"mode\",\"targets\":4},{\"name\":\"package\",\"targets\":5}],\"order\":[],\"autoWidth\":false,\"orderClasses\":false,\"orderCellsTop\":true}},\"evals\":[],\"jsHooks\":[]}</script>\n```\n\n:::\n:::\n",
6+
"supporting": [],
7+
"filters": [
8+
"rmarkdown/pagebreak.lua"
9+
],
10+
"includes": {
11+
"include-in-header": [
12+
"<link href=\"../../site_libs/htmltools-fill-0.5.8.1/fill.css\" rel=\"stylesheet\" />\n<script src=\"../../site_libs/htmlwidgets-1.6.4/htmlwidgets.js\"></script>\n<link href=\"../../site_libs/datatables-css-0.0.0/datatables-crosstalk.css\" rel=\"stylesheet\" />\n<script src=\"../../site_libs/datatables-binding-0.33/datatables.js\"></script>\n<script src=\"../../site_libs/jquery-3.6.0/jquery-3.6.0.min.js\"></script>\n<link href=\"../../site_libs/dt-core-1.13.6/css/jquery.dataTables.min.css\" rel=\"stylesheet\" />\n<link href=\"../../site_libs/dt-core-1.13.6/css/jquery.dataTables.extra.css\" rel=\"stylesheet\" />\n<script src=\"../../site_libs/dt-core-1.13.6/js/jquery.dataTables.min.js\"></script>\n<link href=\"../../site_libs/nouislider-7.0.10/jquery.nouislider.min.css\" rel=\"stylesheet\" />\n<script src=\"../../site_libs/nouislider-7.0.10/jquery.nouislider.min.js\"></script>\n<link href=\"../../site_libs/selectize-0.12.0/selectize.bootstrap3.css\" rel=\"stylesheet\" />\n<script src=\"../../site_libs/selectize-0.12.0/selectize.min.js\"></script>\n<link href=\"../../site_libs/crosstalk-1.2.1/css/crosstalk.min.css\" rel=\"stylesheet\" />\n<script src=\"../../site_libs/crosstalk-1.2.1/js/crosstalk.min.js\"></script>\n"
13+
]
14+
},
15+
"engineDependencies": {},
16+
"preserve": {},
17+
"postProcess": true
18+
}
19+
}

find/index.html.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Below you'll find searchable tables to help you explore the tidymodels packages
2020

2121
* [Search sparse data compatible methods](sparse/index.qmd)
2222

23+
* [Search tidyclust models](tidyclust/index.qmd)
24+
2325
# Books
2426

2527
If you want to read more long form there are a number of books written about and using tidymodels

find/index.qmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Below you'll find searchable tables to help you explore the tidymodels packages
2020

2121
* [Search sparse data compatible methods](sparse/index.qmd)
2222

23+
* [Search tidyclust models](tidyclust/index.qmd)
24+
2325
# Books
2426

2527
If you want to read more long form there are a number of books written about and using tidymodels

find/tidyclust/index.html.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Search tidyclust models
3+
weight: 2
4+
description: |
5+
Find model types and engines to fit and predict clustering methods in the tidymodels framework.
6+
toc: true
7+
toc-depth: 0
8+
include-after-body: ../../resources.html
9+
css: ../styles-find.css
10+
---
11+
12+
To learn about the tidyclust package, click on the link in the topic column. Use the tables below to find [model types and engines](#models).
13+
14+
::: {.cell}
15+
::: {.cell-output-display}
16+
17+
```{=html}
18+
<div class="datatables html-widget html-fill-item" id="htmlwidget-1b4ff99564eb6e8884a5" style="width:100%;height:auto;"></div>
19+
<script type="application/json" data-for="htmlwidget-1b4ff99564eb6e8884a5">{"x":{"filter":"top","vertical":false,"filterHTML":"<tr>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"factor\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\" disabled=\"\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <div style=\"width: 100%; display: none;\">\n <select multiple=\"multiple\" style=\"width: 100%;\" data-options=\"[&quot;partition&quot;]\"><\/select>\n <\/div>\n <\/td>\n <td data-type=\"factor\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\" disabled=\"\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <div style=\"width: 100%; display: none;\">\n <select multiple=\"multiple\" style=\"width: 100%;\" data-options=\"[&quot;tidyclust&quot;]\"><\/select>\n <\/div>\n <\/td>\n<\/tr>","data":[["Hierarchical (Agglomerative) Clustering via stats","K-means via ClusterR","K-means via clustMixType","K-means via klaR","K-means via stats"],["<code>hier_clust<\/code>","<code>k_means<\/code>","<code>k_means<\/code>","<code>k_means<\/code>","<code>k_means<\/code>"],["<code>stats<\/code>","<code>ClusterR<\/code>","<code>clustMixType<\/code>","<code>klaR<\/code>","<code>stats<\/code>"],["<a href='https://tidyclust.tidymodels.org//reference/details_hier_clust_stats.html' target='_blank'><tt>details_hier_clust_stats<\/tt><\/a>","<a href='https://tidyclust.tidymodels.org//reference/details_k_means_ClusterR.html' target='_blank'><tt>details_k_means_ClusterR<\/tt><\/a>","<a href='https://tidyclust.tidymodels.org//reference/details_k_means_clustMixType.html' target='_blank'><tt>details_k_means_clustMixType<\/tt><\/a>","<a href='https://tidyclust.tidymodels.org//reference/details_k_means_klaR.html' target='_blank'><tt>details_k_means_klaR<\/tt><\/a>","<a href='https://tidyclust.tidymodels.org//reference/details_k_means_stats.html' target='_blank'><tt>details_k_means_stats<\/tt><\/a>"],["partition","partition","partition","partition","partition"],["tidyclust","tidyclust","tidyclust","tidyclust","tidyclust"]],"container":"<table class=\"cell-border stripe\">\n <thead>\n <tr>\n <th>title<\/th>\n <th>model<\/th>\n <th>engine<\/th>\n <th>topic<\/th>\n <th>mode<\/th>\n <th>package<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"pageLength":25,"columnDefs":[{"name":"title","targets":0},{"name":"model","targets":1},{"name":"engine","targets":2},{"name":"topic","targets":3},{"name":"mode","targets":4},{"name":"package","targets":5}],"order":[],"autoWidth":false,"orderClasses":false,"orderCellsTop":true}},"evals":[],"jsHooks":[]}</script>
20+
```
21+
22+
:::
23+
:::

find/tidyclust/index.qmd

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Search tidyclust models
3+
weight: 2
4+
description: |
5+
Find model types and engines to fit and predict clustering methods in the tidymodels framework.
6+
toc: true
7+
toc-depth: 0
8+
include-after-body: ../../resources.html
9+
css: ../styles-find.css
10+
---
11+
12+
To learn about the tidyclust package, click on the link in the topic column. Use the tables below to find [model types and engines](#models).
13+
14+
```{r}
15+
#| include: false
16+
17+
library(tidymodels)
18+
library(readr)
19+
library(DT)
20+
library(htmlwidgets)
21+
setWidgetIdSeed(1234)
22+
tidymodels_prefer()
23+
tidyclust_models <- read_csv("tidyclust_models.csv")
24+
```
25+
26+
```{r}
27+
#| label: table-display
28+
#| echo: false
29+
tidyclust_models %>%
30+
mutate(package = factor(package)) %>%
31+
mutate(mode = factor(mode)) %>%
32+
datatable(rownames = FALSE,
33+
class = 'cell-border stripe',
34+
filter = 'top',
35+
escape = FALSE,
36+
options = list(pageLength = 25))
37+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title,model,engine,topic,mode,package
2+
Hierarchical (Agglomerative) Clustering via stats,<code>hier_clust</code>,<code>stats</code>,<a href='https://tidyclust.tidymodels.org//reference/details_hier_clust_stats.html' target='_blank'><tt>details_hier_clust_stats</tt></a>,partition,tidyclust
3+
K-means via ClusterR,<code>k_means</code>,<code>ClusterR</code>,<a href='https://tidyclust.tidymodels.org//reference/details_k_means_ClusterR.html' target='_blank'><tt>details_k_means_ClusterR</tt></a>,partition,tidyclust
4+
K-means via clustMixType,<code>k_means</code>,<code>clustMixType</code>,<a href='https://tidyclust.tidymodels.org//reference/details_k_means_clustMixType.html' target='_blank'><tt>details_k_means_clustMixType</tt></a>,partition,tidyclust
5+
K-means via klaR,<code>k_means</code>,<code>klaR</code>,<a href='https://tidyclust.tidymodels.org//reference/details_k_means_klaR.html' target='_blank'><tt>details_k_means_klaR</tt></a>,partition,tidyclust
6+
K-means via stats,<code>k_means</code>,<code>stats</code>,<a href='https://tidyclust.tidymodels.org//reference/details_k_means_stats.html' target='_blank'><tt>details_k_means_stats</tt></a>,partition,tidyclust

make_function_lists.R

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,78 @@ write_csv(
368368
sparse_steps_preserve,
369369
file = "find/sparse/steps_preserve.csv"
370370
)
371+
372+
# ------------------------------------------------------------------------------
373+
374+
# currently does not rely on any packages, leaving in if added in future
375+
tidyclust_pkgs <- revdepcheck::cran_revdeps(
376+
"tidyclust",
377+
dependencies = c("Depends", "Imports")
378+
)
379+
380+
tidyclust_pkgs <- c(tidyclust_pkgs, "tidyclust")
381+
382+
# Load them then get the model data base
383+
loaded <- purrr::map_lgl(
384+
tidyclust_pkgs,
385+
~ suppressPackageStartupMessages(require(.x, character.only = TRUE))
386+
)
387+
table(loaded)
388+
389+
# h2o overwrites soooo many functions; this may take a few minutes
390+
conflicted::conflict_prefer_all("base", loser = "h2o", quiet = TRUE)
391+
392+
origin_pkg <- rlang::env_get_list(
393+
env = modelenv::get_model_env(),
394+
nms = ls(modelenv::get_model_env(), pattern = "_pkg")
395+
) %>%
396+
purrr::list_rbind(names_to = "model") %>%
397+
dplyr::mutate(
398+
pkg = purrr::map_chr(
399+
pkg,
400+
~ {
401+
pkg <- intersect(.x, tidyclust_pkgs)
402+
if (length(pkg) == 0) {
403+
pkg <- "tidyclust"
404+
}
405+
pkg
406+
}
407+
)
408+
) %>%
409+
dplyr::mutate(
410+
model = stringr::str_remove(model, "_pkgs$"),
411+
functions = paste("details", model, engine, sep = "_")
412+
)
413+
414+
# Add more clustering methods as they become available
415+
cluster_types <- c(
416+
"Hierarchical \\(Agglomerative\\) Clustering",
417+
"K-[M|m]eans"
418+
)
419+
420+
tidyclust_model_info <-
421+
purrr::map_dfr(
422+
tidyclust_pkgs,
423+
get_pkg_info,
424+
keep_internal = TRUE,
425+
.progress = TRUE
426+
) %>%
427+
sort_out_urls() %>%
428+
filter(str_detect(title, paste(cluster_types, collapse = "|")))
429+
430+
tidyclust_models <-
431+
tidyclust_model_info %>%
432+
dplyr::filter(grepl("^details_", functions)) %>%
433+
dplyr::inner_join(origin_pkg, by = "functions") %>%
434+
dplyr::mutate(
435+
model = paste0("<code>", model, "</code>"),
436+
engine = paste0("<code>", engine, "</code>"),
437+
title = gsub("General Interface for ", "", title)
438+
) %>%
439+
dplyr::arrange(model, engine) %>%
440+
dplyr::select(title, model, engine, topic, mode, package)
441+
442+
write_csv(
443+
tidyclust_models,
444+
file = "find/tidyclust/tidyclust_models.csv"
445+
)

0 commit comments

Comments
 (0)