Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export(batch_size)
export(buffer)
export(cal_method_class)
export(cal_method_reg)
export(circular)
export(class_weights)
export(conditional_min_criterion)
export(conditional_test_statistic)
Expand Down Expand Up @@ -105,6 +106,7 @@ export(max_times)
export(max_tokens)
export(min_dist)
export(min_n)
export(min_points)
export(min_times)
export(min_unique)
export(mixture)
Expand Down Expand Up @@ -142,6 +144,7 @@ export(prior_terminal_node_expo)
export(prod_degree)
export(prune)
export(prune_method)
export(radius)
export(range_get)
export(range_set)
export(range_validate)
Expand All @@ -165,6 +168,9 @@ export(sample_size)
export(scale_factor)
export(scale_pos_weight)
export(select_features)
export(shared_orientation)
export(shared_shape)
export(shared_size)
export(shrinkage_correlation)
export(shrinkage_frequencies)
export(shrinkage_variance)
Expand Down Expand Up @@ -216,6 +222,7 @@ export(weight)
export(weight_func)
export(weight_scheme)
export(window_size)
export(zero_covariance)
import(rlang)
importFrom(DiceDesign,dmaxDesign)
importFrom(DiceDesign,lhsDesign)
Expand Down
40 changes: 40 additions & 0 deletions R/param_engine_dbscan.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#' Parameters for possible engine parameters for dbscan
#'
#' These parameters are used for density-based clustering methods that use the
#' dbscan engine. They correspond to tuning parameters that would be specified using
#' `set_engine("dbscan", ...)`.
#'
#' @inheritParams Laplace
#' @details
#' To use these, check `?tidyclust::db_clust` to see how they are used.
#' - `radius()` controls the radius used to determine core-points and cluster assignments
#' - `min_points()` controls the minimum number of nearby points to be considered a core-point (including the point itself)
#'
#' @examples
#' radius()
#' min_points()
#' @rdname dbscan_parameters
#' @export
radius <- function(range = c(-2, 2), trans = transform_log10()) {
new_quant_param(
type = "double",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
label = c(radius = "Radius"),
finalize = NULL
)
}

#' @export
#' @rdname dbscan_parameters
min_points <- function(range = c(3L, 50L), trans = NULL) {
new_quant_param(
type = "integer",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
label = c(min_points = "Minimum Points Threshold"),
finalize = NULL
)
}
73 changes: 73 additions & 0 deletions R/param_engine_mclust.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#' Parameters for possible engine parameters for mclust
#'
#' These parameters are used for fitting Gaussian mixture models that use the
#' mclust engine. They correspond to tuning parameters that would be specified using
#' `set_engine("mclust", ...)`.
#'
#' @param values For `circular()`, `zero_covariance()`,
#' `shared_orientation()`, `shared_shape()`, and `shared_size()` either `TRUE` or `FALSE`.
#' @details
#' To use these, check `?tidyclust::gm_clust` to see how they are used.
#' @examples
#' circular()
#' zero_covariance()
#' shared_orientation()
#' shared_shape()
#' shared_size()
#' @rdname mclust_parameters
#' @export
circular <- function(values = c(TRUE, FALSE)) {
new_qual_param(
type = "logical",
values = values,
label = c(circular = "Circular cluster shapes?"),
finalize = NULL
)
}


#' @export
#' @rdname mclust_parameters
zero_covariance <- function(values = c(TRUE, FALSE)) {
new_qual_param(
type = "logical",
values = values,
label = c(zero_covariance = "Zero covariance between predictors?"),
finalize = NULL
)
}

#' @export
#' @rdname mclust_parameters
shared_orientation <- function(values = c(TRUE, FALSE)) {
new_qual_param(
type = "logical",
values = values,
label = c(shared_orientation = "Shared orientation between clusters?"),
finalize = NULL
)
}

#' @export
#' @rdname mclust_parameters
shared_shape <- function(values = c(TRUE, FALSE)) {
new_qual_param(
type = "logical",
values = values,
label = c(shared_shape = "Same shape for all clusters?"),
finalize = NULL
)
}


#' @export
#' @rdname mclust_parameters
shared_size <- function(values = c(TRUE, FALSE)) {
new_qual_param(
type = "logical",
values = values,
label = c(shared_size = "Same size for all clusters?"),
finalize = NULL
)
}

7 changes: 7 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,23 @@ reference:
- title: Parameter objects for specific model engines
contents:
- bart-param
- circular
- conditional_min_criterion
- confidence_factor
- extrapolation
- max_nodes
- max_num_terms
- min_points
- num_leaves
- radius
- regularization_factor
- rule_bands
- scale_pos_weight
- shared_orientation
- shared_shape
- shared_size
- shrinkage_correlation
- zero_covariance

- title: Parameter objects for post-processing
contents:
Expand Down
37 changes: 37 additions & 0 deletions man/dbscan_parameters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/dials-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions man/mclust_parameters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions tests/testthat/test-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ test_that("param ranges", {
expect_equal(target_weight(c(0.1, 0.4))$range, list(lower = 0.1, upper = 0.4))
expect_equal(lower_limit(c(Inf, 0))$range, list(lower = Inf, upper = 0))
expect_equal(upper_limit(c(0, Inf))$range, list(lower = 0, upper = Inf))
expect_equal(max_num_terms(c(31, 100))$range, list(lower = 31, upper = 100))
expect_equal(max_nodes(c(31, 100))$range, list(lower = 31, upper = 100))
expect_equal(num_tokens(c(31, 100))$range, list(lower = 31, upper = 100))
expect_equal(mtry_prop(c(.1, .2))$range, list(lower = .1, upper = .2))
expect_equal(dropout(c(.1, .2))$range, list(lower = .1, upper = .2))
expect_equal(max_num_terms(c(31,100))$range, list(lower = 31, upper = 100))
expect_equal(max_nodes(c(31,100))$range, list(lower = 31, upper = 100))
expect_equal(num_tokens(c(31,100))$range, list(lower = 31, upper = 100))
expect_equal(mtry_prop(c(.1,.2))$range, list(lower = .1, upper = .2))
expect_equal(dropout(c(.1,.2))$range, list(lower = .1, upper = .2))
expect_equal(radius(c(0.01, 100))$range, list(lower = 0.01, upper = 100))
expect_equal(min_points(c(3, 50))$range, list(lower = 3, upper = 50))
})


Expand Down Expand Up @@ -178,4 +180,9 @@ test_that("param values", {
expect_equal(all_neighbors(TRUE)$values, TRUE)
expect_equal(cal_method_class()$values, values_cal_cls)
expect_equal(cal_method_reg()$values, values_cal_reg)
expect_equal(circular(TRUE)$values, TRUE)
expect_equal(zero_covariance(TRUE)$values, TRUE)
expect_equal(shared_orientation(TRUE)$values, TRUE)
expect_equal(shared_shape(TRUE)$values, TRUE)
expect_equal(shared_size(TRUE)$values, TRUE)
})
Loading