def test_data_bias_config_multi_facet():
    label_values = [1]
    facet_name = ["Facet1", "Facet2"]
    facet_threshold = [[0], [1, 2]]
    group_name = "A151"

    data_bias_config = BiasConfig(
        label_values_or_threshold=label_values,
        facet_name=facet_name,
        facet_values_or_threshold=facet_threshold,
        group_name=group_name,
    )

    expected_config = {
        "label_values_or_threshold":
        label_values,
        "facet": [
            {
                "name_or_index": facet_name[0],
                "value_or_threshold": facet_threshold[0]
            },
            {
                "name_or_index": facet_name[1],
                "value_or_threshold": facet_threshold[1]
            },
        ],
        "group_variable":
        group_name,
    }
    assert expected_config == data_bias_config.get_config()
Ejemplo n.º 2
0
def test_facet_of_bias_config(facet_name, facet_values_or_threshold, expected_result):
    label_values = [1]
    bias_config = BiasConfig(
        label_values_or_threshold=label_values,
        facet_name=facet_name,
        facet_values_or_threshold=facet_values_or_threshold,
    )
    expected_config = {
        "label_values_or_threshold": label_values,
        **expected_result,
    }
    assert bias_config.get_config() == expected_config
Ejemplo n.º 3
0
def test_data_bias_config():
    label_values = [1]
    facet_name = "F1"
    facet_threshold = 0.3
    group_name = "A151"

    data_bias_config = BiasConfig(
        label_values_or_threshold=label_values,
        facet_name=facet_name,
        facet_values_or_threshold=facet_threshold,
        group_name=group_name,
    )

    expected_config = {
        "label_values_or_threshold": label_values,
        "facet": [{"name_or_index": facet_name, "value_or_threshold": facet_threshold}],
        "group_variable": group_name,
    }
    assert expected_config == data_bias_config.get_config()