7b20a10273955a6b33a8563a878aadd9c0dfe0a6,mvpa2/tests/test_rsa.py,,test_CDist,#,76

Before Change


    ds = dataset_wizard(samples=data, targets=targets, chunks=chunks)
    // Some distance metrics
    euc = pdist(data, "euclidean")
    pear = pdist(data, "correlation")
    city = pdist(data, "cityblock")
    cdist_euc = CDist(pairwise_metric="euclidean")
    cdist_pear = CDist(pairwise_metric="correlation")
    cdist_city = CDist(pairwise_metric="cityblock")
    for pd_, cd_ in zip([euc, pear, city], [cdist_euc, cdist_pear, cdist_city]):
        cd_.train(ds[ds.sa.chunks == 0, ])
        res = cd_(ds[ds.sa.chunks == 1, ])
        // Check to make sure the pdist results are close to CDist results
        assert_array_almost_equal(res.samples.ravel(), squareform(pd_)[:3, 3:].ravel())


def test_PDist():
    targets = np.tile(xrange(3),2)
    chunks = np.repeat(np.array((0,1)),3)
    ds = dataset_wizard(samples=data, targets=targets, chunks=chunks)

After Change


    ds = dataset_wizard(samples=data, targets=targets, chunks=chunks)
    // Some distance metrics
    metrics = ["euclidean", "correlation", "cityblock"]
    for metric in metrics:
        pd_ = pdist(data, metric)
        cd_ = CDist(pairwise_metric=metric)

        cd_.train(ds[ds.sa.chunks == 0, ])
        res = cd_(ds[ds.sa.chunks == 1, ])
        // Check to make sure the pdist results are close to CDist results
        assert_array_almost_equal(res.samples.ravel(),
                                  squareform(pd_)[:3, 3:].ravel())


def test_PDist():
    targets = np.tile(xrange(3),2)
    chunks = np.repeat(np.array((0,1)),3)
    ds = dataset_wizard(samples=data, targets=targets, chunks=chunks)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: PyMVPA/PyMVPA
Commit Name: 7b20a10273955a6b33a8563a878aadd9c0dfe0a6
Time: 2016-09-29
Author: matteo.visconti.gr@dartmouth.edu
File Name: mvpa2/tests/test_rsa.py
Class Name:
Method Name: test_CDist


Project Name: nilearn/nilearn
Commit Name: 76e40262c6a7d134b6b03b71b84984bd85454a04
Time: 2018-07-05
Author: jerome@dockes.org
File Name: nilearn/datasets/tests/test_struct.py
Class Name:
Method Name: test_fetch_surf_fsaverage


Project Name: nilearn/nilearn
Commit Name: f816b2d21de51ea97a45d8cbece6a528848c56e4
Time: 2019-04-18
Author: gael.varoquaux@normalesup.org
File Name: examples/03_connectivity/plot_compare_decomposition.py
Class Name:
Method Name: