a243ad678a264c898e133bb1f97efed72703ee06,mvpa2/tests/test_rsa.py,,test_CDist,#,78
Before Change
// check it doesn"t blow up without mean group samples
for metric in metrics:
pd_ = pdist(data, metric)
cd_ = CDist(sattr=None, pairwise_metric=metric)
assert_true(not cd_.is_trained)
cd_.train(ds)
After Change
// Some distance metrics
metrics = ["euclidean", "correlation", "cityblock", "mahalanobis"]
VI_mahalanobis = np.eye(5)
for sattr in [["targets"], None]:
for metric in metrics:
metric_kwargs = {"VI": VI_mahalanobis} if metric == "mahalanobis" \
else {}
scipy_cdist = cdist(train_data.samples, test_data.samples,
metric, **metric_kwargs)
pymvpa_cdist = CDist(pairwise_metric=metric,
pairwise_metric_kwargs=metric_kwargs,
sattr=sattr)
assert_true(not pymvpa_cdist.is_trained)
pymvpa_cdist.train(train_data)
assert_true(pymvpa_cdist.is_trained)
res = pymvpa_cdist(test_data)
// Check to make sure the cdist results are close to CDist results
assert_array_almost_equal(res.samples.ravel(),
scipy_cdist.ravel())
def test_CDist_cval():
targets = np.tile(range(3), 2)
chunks = np.repeat(np.array((0,1)), 3)
ds = dataset_wizard(samples=data, targets=targets, chunks=chunks)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: PyMVPA/PyMVPA
Commit Name: a243ad678a264c898e133bb1f97efed72703ee06
Time: 2016-10-02
Author: matteo.visconti.gr@dartmouth.edu
File Name: mvpa2/tests/test_rsa.py
Class Name:
Method Name: test_CDist
Project Name: pyannote/pyannote-audio
Commit Name: abbfdc5b04ec1824e42cebb472626d234ff7bd36
Time: 2017-01-09
Author: bredin@limsi.fr
File Name: scripts/speaker_embedding.py
Class Name:
Method Name: test
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: PyMVPA/PyMVPA
Commit Name: a243ad678a264c898e133bb1f97efed72703ee06
Time: 2016-10-02
Author: matteo.visconti.gr@dartmouth.edu
File Name: mvpa2/tests/test_rsa.py
Class Name:
Method Name: test_CDist