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

Before Change


    chunks = np.repeat(np.array((0,1)),3)
    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


    chunks = np.repeat(np.array((0,1)), 3)
    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: 6

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: tensorflow/models
Commit Name: f7b4c6de2037ebedf6bc8ea5979e81666d54534f
Time: 2020-12-01
Author: rathodv@google.com
File Name: research/object_detection/meta_architectures/center_net_meta_arch.py
Class Name:
Method Name: convert_strided_predictions_to_normalized_boxes


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