Fork me on GitHub

bolero.environment.ContextualEnvironment

class bolero.environment.ContextualEnvironment[source]

Common interface for (contextual) environments.

__init__()

x.__init__(…) initializes x; see help(type(x)) for signature

get_args()

Get parameters for this estimator.

Returns:
params : mapping of string to any

Parameter names mapped to their values.

get_feedback()

Get the feedbacks for the last evaluation period.

Returns:
feedbacks : array

Feedback values

get_maximum_feedback(context)[source]

Returns the maximum sum of feedbacks obtainable in given context.

get_num_context_dims()[source]

Returns the number of context dimensions.

get_num_inputs()

Get number of environment inputs.

Parameters:
n_inputs : int

Number of environment inputs

get_num_outputs()

Get number of environment outputs.

Parameters:
n_outputs : int

Number of environment outputs

get_outputs(values)

Get environment outputs, e.g. state of the environment.

Parameters:
values : array

Outputs of the environment, will be modified

init()

Initialize environment.

is_behavior_learning_done()

Check if the behavior learning is finished.

Returns:
finished : bool

Is the learning of a behavior finished?

is_evaluation_done()

Check if the evaluation of the behavior is finished.

Returns:
finished : bool

Is the evaluation finished?

request_context(context)[source]

Request that a specific context is used.

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

The requested context that shall be used in the next rollout. Defaults to None. In that case, the environment selects the next context

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

The actual context used in the next rollout. This may or may not be the requested context, depending on the respective environment.

reset()

Reset state of the environment.

set_inputs(values)

Set environment inputs, e.g. next action.

Parameters:
values : array,

Input of the environment

step_action()

Take a step in the environment.