imitation.testing.hypothesis_strategies#

Hypothesis strategies for generating sequences of trajectories for testing.

Module Attributes

gym_spaces

A strategy to generate spaces supported by trajectory serialization.

info_dict_contents

A strategy to generate contents of the info dict for a trajectory.

trajectory_length

The length of a trajectories we want to test.

trajectory

A strategy to generate a single trajectory (with or without reward) for testing.

trajectories_without_reward_list

A strategy to generate lists of trajectories (without reward) for testing.

trajectories_with_reward_list

A strategy to generate lists of trajectories (with reward) for testing.

trajectories_list

A strategy to generate lists of trajectories (with or without reward) for testing.

imitation.testing.hypothesis_strategies.gym_spaces = sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)])#

A strategy to generate spaces supported by trajectory serialization.

imitation.testing.hypothesis_strategies.info_dict_contents = dictionaries(keys=text(), values=one_of(integers(), floats(allow_nan=False), text(), lists(floats(allow_nan=False))))#

A strategy to generate contents of the info dict for a trajectory.

imitation.testing.hypothesis_strategies.trajectories_list = one_of(lists(builds(_build_trajectory_without_reward, act_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='act_space'), info_dict_contents=dictionaries(keys=text(), values=one_of(integers(), floats(allow_nan=False), text(), lists(floats(allow_nan=False)))), length=integers(min_value=1, max_value=10), obs_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='obs_space'), terminal=booleans()), min_size=1, max_size=10), lists(builds(_build_trajectory_with_rew, act_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='act_space'), info_dict_contents=dictionaries(keys=text(), values=one_of(integers(), floats(allow_nan=False), text(), lists(floats(allow_nan=False)))), length=integers(min_value=1, max_value=10), max_rew=floats(min_value=-100, max_value=100), min_rew=floats(min_value=-100, max_value=100), obs_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='obs_space'), terminal=booleans()), min_size=1, max_size=10))#

A strategy to generate lists of trajectories (with or without reward) for testing.

All trajectories in the list are generated using the same spaces. They either all have reward or none of them have reward.

imitation.testing.hypothesis_strategies.trajectories_with_reward_list = lists(builds(_build_trajectory_with_rew, act_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='act_space'), info_dict_contents=dictionaries(keys=text(), values=one_of(integers(), floats(allow_nan=False), text(), lists(floats(allow_nan=False)))), length=integers(min_value=1, max_value=10), max_rew=floats(min_value=-100, max_value=100), min_rew=floats(min_value=-100, max_value=100), obs_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='obs_space'), terminal=booleans()), min_size=1, max_size=10)#

A strategy to generate lists of trajectories (with reward) for testing.

All trajectories in the list are generated using the same spaces.

imitation.testing.hypothesis_strategies.trajectories_without_reward_list = lists(builds(_build_trajectory_without_reward, act_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='act_space'), info_dict_contents=dictionaries(keys=text(), values=one_of(integers(), floats(allow_nan=False), text(), lists(floats(allow_nan=False)))), length=integers(min_value=1, max_value=10), obs_space=shared(sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), key='obs_space'), terminal=booleans()), min_size=1, max_size=10)#

A strategy to generate lists of trajectories (without reward) for testing.

All trajectories in the list are generated using the same spaces.

imitation.testing.hypothesis_strategies.trajectory = one_of(builds(_build_trajectory_without_reward, act_space=sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), info_dict_contents=dictionaries(keys=text(), values=one_of(integers(), floats(allow_nan=False), text(), lists(floats(allow_nan=False)))), length=integers(min_value=1, max_value=10), obs_space=sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), terminal=booleans()), builds(_build_trajectory_with_rew, act_space=sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), info_dict_contents=dictionaries(keys=text(), values=one_of(integers(), floats(allow_nan=False), text(), lists(floats(allow_nan=False)))), length=integers(min_value=1, max_value=10), max_rew=floats(min_value=-100, max_value=100), min_rew=floats(min_value=-100, max_value=100), obs_space=sampled_from([Discrete(3), MultiDiscrete([3 4]), Box(-1.0, 1.0, (1,), float32), Box(-1.0, 1.0, (2,), float32), Box(-inf, inf, (2,), float32)]), terminal=booleans()))#

A strategy to generate a single trajectory (with or without reward) for testing.

imitation.testing.hypothesis_strategies.trajectory_length = integers(min_value=1, max_value=10)#

The length of a trajectories we want to test.