Ejemplo n.º 1
0
def test_features_categorical_features_no_target(
        feature_list, target, expected, data_classification_balanced, feature_descriptor
):
    """Testing if .categorical_features() returns correct values when drop_target = True (without Target feature
    name). """
    X, y = data_classification_balanced
    f = Features(X, y, feature_descriptor)

    f._categorical_features = feature_list
    f.target = target
    actual = f.categorical_features(drop_target=True)

    assert actual == expected
Ejemplo n.º 2
0
def test_features_categorical_features_exclude_transformed(
        data_classification_balanced, feature_descriptor, transformed_features
):
    """Testing if returning categorical features list with transformed columns excluded works properly."""
    col_list = ["AgeGroup", "bool", "Product", "Sex", "Target"]
    X, y = data_classification_balanced

    f = Features(X, y, feature_descriptor, transformed_features)
    actual_result = f.categorical_features(exclude_transformed=True)
    if transformed_features:
        expected_result = [feature for feature in col_list if feature not in transformed_features]
    else:
        expected_result = col_list

    assert actual_result == expected_result