Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrdinalCategoricalBucketer test fails #20

Closed
orchardbirds opened this issue Jun 16, 2021 · 0 comments
Closed

OrdinalCategoricalBucketer test fails #20

orchardbirds opened this issue Jun 16, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@orchardbirds
Copy link
Contributor

================================== FAILURES ==================================
____________________________ test_encoding_method ____________________________

df =       EDUCATION  MARRIAGE  LIMIT_BAL  BILL_AMT1  default pet_ownership
0             1         2   400000.0   201800.0...        0       no pets
5999          2         1   410000.0    71532.0        1     dog lover

[6000 rows x 6 columns]

    def test_encoding_method(df):
        """Test the encoding method."""
        X = df[["EDUCATION", "default"]]
        y = df["default"]

        ocb = OrdinalCategoricalBucketer(tol=0.03, variables=["EDUCATION"], encoding_method="frequency")
        ocb.fit(X, y)

        assert ocb.features_bucket_mapping_.get("EDUCATION").map == {1: 1, 2: 0, 3: 2}

        ocb = OrdinalCategoricalBucketer(tol=0.03, variables=["EDUCATION"], encoding_method="ordered")
        ocb.fit(X, y)

>       assert ocb.features_bucket_mapping_.get("EDUCATION").map == {1: 2, 2: 0, 3: 1}
E       assert {1: 0, 2: 2, 3: 1} == {1: 2, 2: 0, 3: 1}
E         Omitting 1 identical items, use -vv to show
E         Differing items:
E         {1: 0} != {1: 2}
E         {2: 2} != {2: 0}
E         Use -v to get the full diff

tests/test_bucketer_OrdinalCategoricalBucketer.py:66: AssertionError
@orchardbirds orchardbirds added the bug Something isn't working label Jun 16, 2021
@orchardbirds orchardbirds self-assigned this Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant