Skip to content
Permalink
Browse files

several new functions added and some default range updates

  • Loading branch information...
topepo committed Aug 5, 2019
1 parent 66be91e commit 41332902714984fb1ffabdefe6aa100675fd0477
Showing with 114 additions and 5 deletions.
  1. +1 −1 DESCRIPTION
  2. +6 −0 NEWS.md
  3. +107 −4 R/parameters.R
@@ -3,7 +3,7 @@ Version: 0.0.2.9000
Title: Tools for Creating Tuning Parameter Values
Description: Many models contain tuning parameters (i.e. parameters that cannot be directly estimated from the data). These tools can be used to define objects for creating, simulating, or validating values for such parameters.
Authors@R: c(
person("Max", "Kuhn", , "max@rstudio.com", c("aut", "cre")),
person(given = "Max", family = "Kuhn", email = "max@rstudio.com", role = c("aut", "cre")),
person("RStudio", role = "cph"))
License: GPL-2
URL: https://tidymodels.github.io/dials
@@ -7,10 +7,16 @@ pre-configured object `mtry` is now a function, `mtry()`, with arguments for the
`range` and the `trans`form. This provides greater flexibility in parameter
creation, and should feel more natural.

* `deg_free()` erroneously produced real values; integers are now returned.

* Default ranges were changed for `learn_rate()` and `neighbors()` were changed.

## Other changes

* Two functions for space-filling designs were added: `grid_max_entropy()` and `grid_latin_hypercube()`.

* Parameters `spline_degree()`, `over_ratio()`, `under_ratio()`, `freq_cut()`, `unique_cut()`, `num_breaks()` and `min_unique()` were added.

# dials 0.0.2

* Parameter objects now contain code to finalize their values and a number of helper functions for certain data-specific parameters. A `force` option can be used to avoid updating the values.
@@ -114,7 +114,7 @@ trees <- function(range = c(1L, 2000L), trans = NULL) {

#' @rdname tree_parameters
#' @export
min_n <- function(range = c(2L, unknown()), trans = NULL) {
min_n <- function(range = c(2L, 40L), trans = NULL) {
new_quant_param(
type = "integer",
range = range,
@@ -140,7 +140,7 @@ sample_size <- function(range = c(unknown(), unknown()), trans = NULL) {

#' @rdname tree_parameters
#' @export
learn_rate <- function(range = c(unknown(), unknown()), trans = NULL) {
learn_rate <- function(range = c(-10, -1), trans = log10_trans()) {
new_quant_param(
type = "double",
range = range,
@@ -434,12 +434,25 @@ degree <- function(range = c(1, 3), trans = NULL) {

#' @export
#' @rdname para_parameters
deg_free <- function(range = c(1, 5), trans = NULL) {
spline_degree <- function(range = c(3, 10), trans = NULL) {
new_quant_param(
type = "double",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
label = c(spline_degree = "Piecewise Polynomial Degree"),
finalize = NULL
)
}

#' @export
#' @rdname para_parameters
deg_free <- function(range = c(1, 5), trans = NULL) {
new_quant_param(
type = "integer",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
label = c(deg_free = "Degrees of Freedom"),
finalize = NULL
)
@@ -574,7 +587,7 @@ Laplace <- function(range = c(0, 3), trans = NULL) {

#' @export
#' @rdname misc_parameters
neighbors <- function(range = c(1L, unknown()), trans = NULL) {
neighbors <- function(range = c(1L, 10L), trans = NULL) {
new_quant_param(
type = "integer",
range = range,
@@ -613,6 +626,96 @@ threshold <- function(range = c(0, 1), trans = NULL) {
}



#' @export
#' @rdname misc_parameters
over_ratio <- function(range = c(0.8, 1.2), trans = NULL) {
new_quant_param(
type = "double",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
default = 1,
label = c(over_ratio = "Over-Sampling Ratio"),
finalize = NULL
)
}

#' @export
#' @rdname misc_parameters
under_ratio <- function(range = c(0.8, 1.2), trans = NULL) {
new_quant_param(
type = "double",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
default = 1,
label = c(under_ratio = "Under-Sampling Ratio"),
finalize = NULL
)
}


#' @export
#' @rdname misc_parameters
freq_cut <- function(range = c(5, 25), trans = NULL) {
new_quant_param(
type = "double",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
default = 95/5,
label = c(freq_cut = "Frequency Distribution Ratio"),
finalize = NULL
)
}


#' @export
#' @rdname misc_parameters
unique_cut <- function(range = c(0, 100), trans = NULL) {
new_quant_param(
type = "double",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
default = 10,
label = c(unique_cut = "% Unique Values"),
finalize = NULL
)
}



#' @export
#' @rdname misc_parameters
num_breaks <- function(range = c(2L, 10L), trans = NULL) {
new_quant_param(
type = "integer",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
default = 4,
label = c(num_breaks = "Number of Cut Points"),
finalize = NULL
)
}


#' @export
#' @rdname misc_parameters
min_unique <- function(range = c(5L, 15L), trans = NULL) {
new_quant_param(
type = "integer",
range = range,
inclusive = c(TRUE, TRUE),
trans = trans,
default = 10,
label = c(min_unique = "Unique Value Threshold"),
finalize = NULL
)
}

###################################################################

#' Parameter functions related to text analysis.

0 comments on commit 4133290

Please sign in to comment.
You can’t perform that action at this time.