twinlab.RecommendParams#

class twinlab.RecommendParams(weights=None, num_restarts=5, raw_samples=128, bounds=None, seed=None)[source]#

Parameter configuration for recommending new points to sample using the Bayesian-optimisation routine.

Variables:
  • weights (Union[list[float], None], optional) – A list of weighting values that are used to create a scalar objective function in the case of a multi-output model. The recommend functionality can only work on a single scalar function, so in the case of a multi-output model, the outputs must be combined into a single scalar value. The weights create a linear combinations of the outputs, where the weights are the coefficients of the linear combination. In the case of a single-output model, the weights are not used and have no impact. If the output dimensions are not equally important, the weights can be used to reflect this. If the output values have different units, the weights must be chosen to reflect this. For example, if two outputs have units of distance and time the weights implicitly have units such that these can be combined (i.e., per metre and per second). A list of values is used here, where the first value corresponds to the first output, the second value to the second output, and so on. For example, [1, 2, 3] would create a linear combination of the outputs where the first output is multiplied by 1, the second output by 2, and the third output by 3. In this case, the third output is considered to be three times as important as the first output. If the values [0, 1] are used, the first output is ignored and the second output is used as the scalar objective function. If the values [-1, 0] are used, the first output is used as the scalar objective function, and is minimized. The default value, None, applies equal weight to each output dimension. This is recommended for functional emulators.

  • num_restarts (int, optional) – The number of random restarts for optimisation. The default value is 5.

  • raw_samples (int, optional) – The number of samples for initialization. The default value is 128.

  • bounds (Union[dict, None], optional) – The bounds of the input space. If this is set to None then the bounds are inferred from the range of the training data. Otherwise, this must be a dictionary mapping column names to a tuple of lower and upper bounds. For example, {"x0": (0, 1), "x1": (0, 2)} to set boundaries on two input variables x0 and x1.

  • seed (Union[int, None], optional) – Specifies the seed used by the random number generator to start the optimiser to discover the recommendations. Setting this to an integer is good for reproducibility. The default value is None, which means the seed is randomly generated each time.

__init__(weights=None, num_restarts=5, raw_samples=128, bounds=None, seed=None)[source]#

Methods

__init__([weights, num_restarts, ...])

unpack_parameters()