How to use the xenonpy.datatools.transform.BoxCox function in xenonpy

To help you get started, we’ve selected a few xenonpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_4x1_ravel_2(data):
    bc = BoxCox()
    bc.fit(data[0].ravel())
    trans = bc.transform((data[0].ravel())[:2])
    assert trans.shape == (data[2].ravel())[:2].shape
    assert np.all(trans == (data[2].ravel())[:2])
    inverse = bc.inverse_transform(trans)
    assert inverse.shape == (data[0].ravel())[:2].shape
    assert np.allclose(inverse, (data[0].ravel())[:2])
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_err_4x1_2(data):
    bc = BoxCox(on_err='nan')
    trans = bc.fit_transform(data[4])
    assert np.all(np.isnan(trans))
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_4x1_3(data):
    bc = BoxCox()
    bc.fit_transform(data[0])
    trans = bc.transform(data[0][:2])
    assert trans.shape == data[2][:2].shape
    assert np.all(trans == data[2][:2])
    inverse = bc.inverse_transform(trans)
    assert inverse.shape == data[0][:2].shape
    assert np.allclose(inverse, data[0][:2])
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_err_4x4_3(data):
    bc = BoxCox(on_err='log')
    trans = bc.fit_transform(data[5])
    assert np.all(trans == data[7])
    inverse = bc.inverse_transform(trans)
    assert np.all(inverse == data[5])
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_4x4_1(data):
    bc = BoxCox()
    bc.fit_transform(data[1])
    trans = bc.transform(data[1][:2])
    assert trans.shape == data[3][:2].shape
    assert np.all(trans == data[3][:2])
    inverse = bc.inverse_transform(trans)
    assert inverse.shape == data[1][:2].shape
    assert np.allclose(inverse, data[1][:2])
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_err():
    with pytest.raises(ValueError):
        bc = BoxCox(on_err='raise')
        bc.fit_transform([1, 1, 1])
    with pytest.raises(FloatingPointError):
        bc = BoxCox(on_err='raise')
        bc.fit_transform([1e20, 1, 1e20])
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_err_4x1_3(data):
    bc = BoxCox(on_err='log')
    trans = bc.fit_transform(data[4])
    assert np.all(trans == data[6])
    inverse = bc.inverse_transform(trans)
    assert np.all(inverse == data[4])
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_4x1_1(data):
    bc = BoxCox()
    trans = bc.fit_transform(data[0])
    assert np.all(trans == data[2])
    assert trans.shape == data[2].shape
    inverse = bc.inverse_transform(trans)
    assert np.allclose(inverse, data[0])
    assert inverse.shape == data[0].shape
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_4x1_ravel_1(data):
    bc = BoxCox()
    trans = bc.fit_transform(data[0].ravel())
    assert np.all(trans == data[2].ravel())
    inverse = bc.inverse_transform(trans)
    assert np.allclose(inverse, data[0].ravel())
github yoshida-lab / XenonPy / tests / datatools / test_boxcox.py View on Github external
def test_transform_err_4x4_2(data):
    bc = BoxCox(on_err='nan')
    trans = bc.fit_transform(data[5])
    assert np.all(np.isnan(trans))