Skip to content

Commit d11a762

Browse files
committed
add dials methods for hier_clust
1 parent 14a66b4 commit d11a762

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export(.k_means_fit_stats)
7171
export(augment)
7272
export(cluster_metric_set)
7373
export(control_cluster)
74+
export(cut_height)
7475
export(extract_centroids)
7576
export(extract_cluster_assignment)
7677
export(extract_fit_engine)
@@ -90,6 +91,7 @@ export(glance)
9091
export(hier_clust)
9192
export(k_means)
9293
export(knit_engine_docs)
94+
export(linkage_method)
9395
export(list_md_problems)
9496
export(load_pkgs)
9597
export(make_classes_tidyclust)
@@ -121,6 +123,7 @@ export(translate_tidyclust)
121123
export(translate_tidyclust.default)
122124
export(tune)
123125
export(tune_cluster)
126+
export(values_linkage_method)
124127
importFrom(dplyr,"%>%")
125128
importFrom(dplyr,bind_cols)
126129
importFrom(generics,augment)

R/dials-params.R

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#' Cut Height
2+
#'
3+
#' Used in most `tidyclust::hier_clust()` models.
4+
#'
5+
#' @inheritParams dials::Laplace
6+
#' @examples
7+
#' cut_height()
8+
#' @export
9+
cut_height <- function(range = c(0, dials::unknown()), trans = NULL) {
10+
dials::new_quant_param(
11+
type = "integer",
12+
range = range,
13+
inclusive = c(TRUE, TRUE),
14+
trans = trans,
15+
label = c(cut_height = "Cut Height"),
16+
finalize = NULL
17+
)
18+
}
19+
20+
#' The agglomeration Linkage method
21+
#'
22+
#' @param values A character string of possible values. See `linkage_methods`
23+
#' in examples below.
24+
#'
25+
#' @details
26+
#' This parameter is used in `tidyclust` models for `hier_clust()`.
27+
#' @examples
28+
#' values_linkage_method
29+
#' linkage_method()
30+
#' @export
31+
linkage_method <- function(values = values_linkage_method) {
32+
dials::new_qual_param(
33+
type = "character",
34+
values = values,
35+
label = c(activation = "Linkage Method"),
36+
finalize = NULL
37+
)
38+
}
39+
40+
#' @rdname linkage_method
41+
#' @export
42+
values_linkage_method <- c(
43+
"ward.D", "ward.D2", "single", "complete", "average", "mcquitty", "median",
44+
"centroid"
45+
)

man/cut_height.Rd

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/linkage_method.Rd

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)