Fork me on GitHub

bolero.behavior_search.JustContextualOptimizer

class bolero.behavior_search.JustContextualOptimizer(optimizer)[source]

Wrap only the contextual optimizer.

Internally, we use a behavior that only returns the parameter vector that has been generated by the optimizer.

Parameters:
optimizer : dict or ContextualOptimizer

A contextual optimizer that is given directly or fully specified by a configuration dictionary.

n_params : int, optional (default: len(optimizer.initial_params))

Number of parameters to optimize

__init__(optimizer)[source]
get_args()

Get parameters for this estimator.

Returns:
params : mapping of string to any

Parameter names mapped to their values.

get_best_behavior_template()

Return current best estimate of contextual policy.

get_desired_context()

Chooses desired context for next evaluation.

Returns:
context : ndarray-like, default=None

The context in which the next rollout shall be performed. If None, the environment may select the next context without any preferences.

set_context(context)

Set context of next evaluation.

Note that the set context need not necessarily be the same that was requested by get_desired_context().

Parameters:
context : array-like, shape (n_context_dims,)

The context in which the next rollout will be performed