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

staticpowertransformer throws error intermittently #48

Open
ab93 opened this issue Oct 17, 2022 · 0 comments
Open

staticpowertransformer throws error intermittently #48

ab93 opened this issue Oct 17, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest

Comments

@ab93
Copy link
Member

ab93 commented Oct 17, 2022

Intermittently this test case throws this error, mostly because of the random number that is generated.

=================================== FAILURES ===================================
_________________ TestTransformers.test_staticpowertransformer _________________

self = <numalogic.tests.preprocess.test_transformer.TestTransformers testMethod=test_staticpowertransformer>

    def test_staticpowertransformer(self):
        x = 1 + np.random.randn(5, 3)
        transformer = StaticPowerTransformer(3, add_factor=2)
        x_prime = transformer.transform(x)
    
        assert_almost_equal(np.power(2 + x, 3), x_prime)
        assert_almost_equal(transformer.fit_transform(x), x_prime)
>       assert_almost_equal(transformer.inverse_transform(x_prime), x, decimal=4)
E       AssertionError: 
E       Arrays are not almost equal to 4 decimals
E       
E       x and y nan location mismatch:
E        x: array([[1.9392, 3.3033, 0.2871],
E              [1.5581, 1.6368, 2.0375],
E              [0.3713, 3.0054, 1.0976],...
E        y: array([[ 1.9392,  3.3033,  0.2871],
E              [ 1.5581,  1.6368,  2.0375],
E              [ 0.3713,  3.0054,  1.0976],...

numalogic/tests/preprocess/test_transformer.py:26: AssertionError
=============================== warnings summary ===============================
numalogic/tests/preprocess/test_transformer.py::TestTransformers::test_staticpowertransformer
  /home/runner/work/numalogic/numalogic/numalogic/preprocess/transformer.py:41: RuntimeWarning: invalid value encountered in power
    return np.power(X, 1.0 / self.n) - self.add_factor

Need to offset the random number to make sure that test case always passes.

@ab93 ab93 added bug Something isn't working good first issue Good for newcomers hacktoberfest labels Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant