diff --git a/NAMESPACE b/NAMESPACE index eab05813..ae8dd1cf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -105,6 +105,7 @@ export(max_times) export(max_tokens) export(min_dist) export(min_n) +export(min_support) export(min_times) export(min_unique) export(mixture) diff --git a/R/param_min_support.R b/R/param_min_support.R new file mode 100644 index 00000000..3e8162e6 --- /dev/null +++ b/R/param_min_support.R @@ -0,0 +1,18 @@ +#' Parameter to control the minimum support value for frequent itemsets +#' +#' Used in all `tidyclust::freq_itemsets()` models. +#' +#' @inheritParams Laplace +#' @examples +#' min_support() +#' @export +min_support <- function(range = c(0.1, 0.5), trans = NULL) { + dials::new_quant_param( + type = "double", + range = range, + inclusive = c(TRUE, TRUE), + trans = trans, + label = c(min_support = "Minimum Support Value"), + finalize = NULL # Add to look at data and create a CI-like range around some min support value + ) +} diff --git a/man/dials-package.Rd b/man/dials-package.Rd index 64667afe..e55736d9 100644 --- a/man/dials-package.Rd +++ b/man/dials-package.Rd @@ -53,7 +53,7 @@ Authors: Other contributors: \itemize{ - \item Posit Software, PBC (\href{https://ror.org/03wc8by49}{ROR}) [copyright holder, funder] + \item Posit Software, PBC (03wc8by49) [copyright holder, funder] } } diff --git a/man/min_support.Rd b/man/min_support.Rd new file mode 100644 index 00000000..c42c0e71 --- /dev/null +++ b/man/min_support.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/param_min_support.R +\name{min_support} +\alias{min_support} +\title{Parameter to control the minimum support value for frequent itemsets} +\usage{ +min_support(range = c(0.1, 0.5), trans = NULL) +} +\arguments{ +\item{range}{A two-element vector holding the \emph{defaults} for the smallest and +largest possible values, respectively. If a transformation is specified, +these values should be in the \emph{transformed units}.} + +\item{trans}{A \code{trans} object from the \code{scales} package, such as +\code{scales::transform_log10()} or \code{scales::transform_reciprocal()}. If not provided, +the default is used which matches the units used in \code{range}. If no +transformation, \code{NULL}.} +} +\description{ +Used in all \code{tidyclust::freq_itemsets()} models. +} +\examples{ +min_support() +} diff --git a/tests/testthat/test-params.R b/tests/testthat/test-params.R index b71f5c41..bc29d672 100644 --- a/tests/testthat/test-params.R +++ b/tests/testthat/test-params.R @@ -142,6 +142,7 @@ test_that("param ranges", { 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(min_support(c(.05, .5))$range, list(lower = .05, upper = .5)) })