dd7c34ea3480f2ffd8843171676aaa22b1777bd8,nilearn/decomposition/tests/test_canica.py,,test_canica_square_img,#,8

Before Change


    // Find pairs of matching components
    indices = range(4)

    for i in range(4):
        map = np.abs(maps[i]) > np.abs(maps[i]).max() * 0.95
        for j in indices:
            ref_map = components[j].ravel() != 0
            if np.all(map.ravel() == ref_map):
                indices.remove(j)
                break
        else:
            assert False, "Non matching component"

if __name__ == "__main__":
    test_canica_square_img()

After Change


    // FIXME: This could be done more efficiently, e.g. thanks to hungarian
    // Find pairs of matching components
    // compute the cross-correlation matrix between components
    K = np.corrcoef(components, maps.reshape(4, 400))[4:, :4]
    // K should be a permutation matrix, hence its coefficients 
    // should all be close to 0 1 or -1
    K_abs = np.abs(K)
    assert_true(np.sum(K_abs > .9) == 4)
    K_abs[K_abs > .9] -= 1
    assert_array_almost_equal(K_abs, 0, 1)

if __name__ == "__main__":
    test_canica_square_img()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: nilearn/nilearn
Commit Name: dd7c34ea3480f2ffd8843171676aaa22b1777bd8
Time: 2014-05-28
Author: bertrand.thirion@inria.fr
File Name: nilearn/decomposition/tests/test_canica.py
Class Name:
Method Name: test_canica_square_img


Project Name: eth-cscs/reframe
Commit Name: e3f9de083ed935a54ecb97665e9fb01de976cded
Time: 2020-12-14
Author: jgp@cscs.ch
File Name: cscs-checks/microbenchmarks/gpu/gpu_burn/gpu_burn_test.py
Class Name: GpuBurnTest
Method Name: report_smallest_node


Project Name: pgmpy/pgmpy
Commit Name: ca337ebba627326cd7b15b454053e31f51b5e441
Time: 2015-06-16
Author: ankurankan@gmail.com
File Name: pgmpy/inference/Sampling.py
Class Name: BayesianModelSampling
Method Name: rejection_sample