test_box_polar_utils ==================== .. py:module:: test_box_polar_utils Classes ------- .. autoapisummary:: test_box_polar_utils.TestBoxCartesianDistribution test_box_polar_utils.TestBoxCartesianEndToEnd test_box_polar_utils.TestBoxCartesianEnvironment test_box_polar_utils.TestBoxCartesianPBDistribution Functions --------- .. autoapisummary:: test_box_polar_utils.test_mixed_distributions Module Contents --------------- .. py:class:: TestBoxCartesianDistribution Tests for BoxCartesianDistribution. .. py:method:: env() .. py:method:: pf_estimator(env, pf_module) .. py:method:: pf_module() .. py:method:: test_log_prob_exit_at_boundary(env, pf_estimator) Exit at boundary should have finite log_prob (learned Bernoulli). .. py:method:: test_log_prob_finite(env, pf_estimator) Log probabilities should be finite for valid actions. .. py:method:: test_no_exit_from_s0(env, pf_estimator) Exit from s0 should have log_prob = -inf. .. py:method:: test_sample_non_s0_in_range(env, pf_estimator) From non-s0, sampled actions should be >= delta. .. py:method:: test_sample_s0_in_range(env, pf_estimator) From s0, sampled actions should be in [0, 1] (full space coverage). .. py:method:: test_sample_shape(env, pf_estimator) Sampled actions should have correct shape. .. py:class:: TestBoxCartesianEndToEnd End-to-end tests for the Cartesian Box implementation. .. py:method:: env() .. py:method:: pb_estimator(env) .. py:method:: pf_estimator(env) .. py:method:: test_backward_trajectory_reaches_s0(env, pb_estimator) A backward trajectory should reach s0. .. py:method:: test_reward_function(env) Reward function should return expected values. .. py:method:: test_trajectory_stays_in_bounds(env, pf_estimator) A trajectory should stay within [0, 1]^2. .. py:class:: TestBoxCartesianEnvironment Tests for the Box environment with Cartesian semantics. .. py:method:: env() .. py:method:: test_backward_step_subtracts_action(env) Backward step should subtract action from state. .. py:method:: test_exit_action_valid(env) Exit actions should be valid for non-s0 states. .. py:method:: test_forward_backward_roundtrip(env) Forward then backward should return to original state. .. py:method:: test_forward_step_adds_action(env) Forward step should add action to state. .. py:method:: test_is_action_valid_boundary(env) Actions shouldn't push state past boundary. .. py:method:: test_is_action_valid_non_s0_forward(env) From non-s0, forward actions should be >= delta. .. py:method:: test_is_action_valid_s0_forward(env) From s0, forward actions should be in [0, 1] (full space coverage). .. py:class:: TestBoxCartesianPBDistribution Tests for BoxCartesianPBDistribution (backward policy). .. py:method:: env() .. py:method:: pb_estimator(env, pb_module) .. py:method:: pb_module() .. py:method:: test_log_prob_near_origin(env, pb_estimator) Log prob for near-origin states going to s0 should be 0. When near origin (any dimension <= delta), BTS is forced and log_prob = 0. For numerical robustness, any action from a near-origin state is treated as BTS since that's the only valid action anyway. .. py:method:: test_sample_mixed_dims_near_origin(env, pb_estimator) States with mixed dims (some < delta, some >= delta) should handle correctly. .. py:method:: test_sample_near_origin_to_s0(env, pb_estimator) States near origin should go directly to s0. .. py:method:: test_sample_non_origin_valid(env, pb_estimator) Backward actions from non-origin should be valid. .. py:method:: test_sample_shape(env, pb_estimator) Sampled backward actions should have correct shape. .. py:function:: test_mixed_distributions(n_components, n_components_s0) Tests the `DistributionWrapper` class. :param n_components: The number of components for non-s0 states. :param n_components_s0: The number of components for s0.