twinlab.optimise_campaign#

twinlab.optimise_campaign(campaign_id, num_points, processor='cpu', verbose=False, debug=False, **kwargs)[source]#

Optimise campaign

Draw new candidate data points by optimizing for “qEI” (Monte Carlo Expected Improvement)

acquisition function from a pre-trained campaign that exists on the twinLab cloud.

Parameters:
  • campaign_id (str) – Name of pre-trained campaign to use for predictions.

  • num_points (int) – Number of samples to draw for each row of the evaluation data.

  • verbose (bool, optional) – Optional. Determining level of information returned to the user.

  • acq_kwargs (dict, optional) – Optional. Specifies the keyword arguments to modify the behavior of

  • weights (list[float]) – Specifies the weightage for different objectives to be

Returns:

containing the recommended sample locations

Return type:

pandas.DataFrame

Examples

import pandas as pd
import twinlab as tl

df = pd.DataFrame({'X': [0.0, 0.25, 0.75, 1.0], 'y': [-1.60856306, -0.27526546, -0.34670215, -1.65062947]})
tl.upload_dataset(df, "my_dataset")
params = {
    "dataset_id": "my_dataset",
    "inputs": ["X"],
    "outputs": ["y"],
}
tl.train_campaign(params, "my_campaign")
n = 1
df = tl.optimise_campaign("my_campaign", n)
print(df)

Deprecated since version 2.5.0: The twinLab Python client version v1 will be deprecated imminently. Please upgrade to the latest version of the twinLab Python client. Avaible at https://pypi.org/project/twinlab/.