def test_transform_each_marginal_to_uniform_no_orig_table(self): """Ensures correct output from _transform_each_marginal_to_uniform. In this case the argument `orig_feature_table` is None. """ this_feature_table = prob_dist._transform_each_marginal_to_uniform( NEW_FEATURE_TABLE, orig_feature_table=None) self.assertTrue(numpy.allclose( this_feature_table.to_numpy(), FEATURE_TABLE_UNIF_MARGINALS_NEW_TO_NEW.to_numpy(), atol=TOLERANCE, equal_nan=True))
def test_transform_each_marginal_to_uniform_columns_in_diff_order(self): """Ensures correct output from _transform_each_marginal_to_uniform. In this case, columns of `new_feature_table` and `orig_feature_table` are in different orders. """ this_feature_table = prob_dist._transform_each_marginal_to_uniform( new_feature_table=NEW_FEATURE_TABLE, orig_feature_table=ORIG_FEATURE_TABLE[['b', 'c', 'a']]) self.assertTrue(numpy.allclose( this_feature_table.to_numpy(), FEATURE_TABLE_UNIF_MARGINALS_NEW_TO_ORIG.to_numpy(), atol=TOLERANCE, equal_nan=True))
def test_transform_each_marginal_to_uniform_extra_columns(self): """Ensures correct output from _transform_each_marginal_to_uniform. In this case, `orig_feature_table` contains all columns of `new_feature_table` plus extra columns. """ this_orig_feature_table = copy.deepcopy(ORIG_FEATURE_TABLE) this_orig_feature_table['d'] = this_orig_feature_table['b'] this_feature_table = prob_dist._transform_each_marginal_to_uniform( new_feature_table=NEW_FEATURE_TABLE, orig_feature_table=this_orig_feature_table) self.assertTrue(numpy.allclose( this_feature_table.to_numpy(), FEATURE_TABLE_UNIF_MARGINALS_NEW_TO_ORIG.to_numpy(), atol=TOLERANCE, equal_nan=True))