Utils

A collection of helper functions and classes.

class imperfecto.misc.utils.lessVerboseEnum(value)[source]

Bases: enum.Enum

A less verbose version of the Enum class.

Example:

class Test(lessVerboseEnum):
    TEST=0

print(Test.TEST) # prints "TEST" instead of "Test.TEST"
imperfecto.misc.utils.get_action(action_probs)[source]

Sample an action from an action probability distribution.

Parameters

action_probs (ndarray) – a numpy array of probabilities of length n_actions

Return type

int

Returns

the index of the action sampled with the given probabilities