Learn R Programming

dynparam (version 1.0.2)

parameter: Defining, serialising and printing parameters

Description

Multiple parameters can be combined in a parameter set. The sections below contain information on how to create, serialise and process a parameter.

Usage

parameter(id, default, ..., description = NULL, tuneable = TRUE)

# S3 method for parameter as.list(x, ...)

as_parameter(li)

is_parameter(x)

as_descriptive_tibble(x)

Arguments

id

The name of the parameter.

default

The default value of the parameter.

...

Extra fields to be saved in the parameter.

description

An optional (but recommended) description of the parameter.

tuneable

Whether or not a parameter is tuneable.

x

An object (parameter or distribution) to be converted.

li

A list to be converted into a parameter.

Creating a parameter

Serialisation

  • as.list(param): Converting a parameter to a list.

  • as_parameter(li): Converting a list back to a parameter.

  • is_parameter(x): Checking whether something is a parameter.

  • as_descriptive_tibble(param): Convert to a tibble containing meta information.

See Also

dynparam for an overview of all dynparam functionality.

Examples

Run this code
# NOT RUN {
int_param <- integer_parameter(
  id = "num_iter",
  default = 100L,
  distribution = expuniform_distribution(lower = 1L, upper = 10000L),
  description = "Number of iterations"
)

print(int_param)
li <- as.list(int_param)
print(as_parameter(li))

subset_param <- subset_parameter(
  id = "dimreds",
  default = c("pca", "mds"),
  values = c("pca", "mds", "tsne", "umap", "ica"),
  description = "Which dimensionality reduction methods to apply (can be multiple)"
)

int_range_param <- integer_range_parameter(
  id = "ks",
  default = c(3L, 15L),
  lower_distribution = uniform_distribution(1L, 5L),
  upper_distribution = uniform_distribution(10L, 20L),
  description = "The numbers of clusters to be evaluated"
)

parameter_set(
  int_param,
  subset_param,
  int_range_param
)
# }

Run the code above in your browser using DataLab