Пример #1
0
def test_features_numerical_features_no_target(
        feature_list, target, expected, data_classification_balanced, feature_descriptor
):
    """Testing if .numerical_features() returns correct values when drop_target = True (without Target feature name)."""
    X, y = data_classification_balanced
    f = Features(X, y, feature_descriptor)

    f._numerical_features = feature_list
    f.target = target
    actual = f.numerical_features(drop_target=True)

    assert actual == expected
Пример #2
0
def test_features_numerical_features_exclude_transformed(
        data_classification_balanced, feature_descriptor, transformed_features
):
    """Testing if returning numerical features list with transformed columns excluded works properly."""
    col_list = ["Height", "Price"]
    X, y = data_classification_balanced

    f = Features(X, y, feature_descriptor, transformed_features)
    actual_result = f.numerical_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