b197fb0946afe59b45a8c7a20a567ebfe253108f,neurodsp/tests/test_utils.py,,test_demean,#,11

Before Change


    dat = demean(dat)

    // TODO: Add isclose checking here
    assert True

def test_normalize_variance():

    dat = np.array([2, 2, 2])

After Change


def test_demean():

    d1 = np.array([1, 2, 3])
    d2 = np.array([0, 1, 2, 3, 0])

    // Check default - demean to 0
    out1 = demean(d1)
    assert np.isclose(out1.mean(), 0.)

    // Check demeaning and adding specific mean
    out2 = demean(d1, mean=1.)
    assert np.isclose(out2.mean(), 1.)

    // Check dealing with zero entries
    out3 = demean(d2)
    assert np.isclose(out3[np.nonzero(out3)].mean(), 0)

    // Check turning of non-zero selection
    out3 = demean(d2, mean=1, select_nonzero = False)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: neurodsp-tools/neurodsp
Commit Name: b197fb0946afe59b45a8c7a20a567ebfe253108f
Time: 2019-04-08
Author: tdonoghue@ucsd.edu
File Name: neurodsp/tests/test_utils.py
Class Name:
Method Name: test_demean


Project Name: scikit-learn/scikit-learn
Commit Name: 4744e062ffe801fe2c7c1faa2bda385f293d5b37
Time: 2020-08-31
Author: lorentzen.ch@gmail.com
File Name: sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py
Class Name:
Method Name: test_binomial_deviance


Project Name: scikit-learn-contrib/DESlib
Commit Name: 1ad718089f4d32a34e873091ff9d02a4c36d5d9f
Time: 2018-03-26
Author: rafaelmenelau@gmail.com
File Name: deslib/tests/test_base.py
Class Name:
Method Name: test_frienemy_not_all_classifiers_crosses_batch


Project Name: neurodsp-tools/neurodsp
Commit Name: b197fb0946afe59b45a8c7a20a567ebfe253108f
Time: 2019-04-08
Author: tdonoghue@ucsd.edu
File Name: neurodsp/tests/test_utils.py
Class Name:
Method Name: test_normalize_variance