2665eecc8c29cae4e7a93ec587f5d59e916025e3,mvpa/tests/test_svm.py,SVMTests,testCperClass,#SVMTests#Any#,98

Before Change


            self.failUnless(cve.states.confusion.stats["P""][1] > 0)

        e = cve(ds_)
        if cfg.getboolean("tests", "labile", default="yes"):
            self.failUnless(cve.states.confusion.stats["P""][1] < 5,
                            msg="With disballance we should have almost no "
                            "hits. Got %f" % cve.states.confusion.stats["P""][1])
            //print "D:", cve.confusion.stats["P""][1], cve.confusion.stats["MCC"][1]

        // Set "1 C per label"
        // recreate cvte since previous might have operated on copies
        cve = CrossValidatedTransferError(TransferError(clf), NFoldSplitter(),
                                          enable_states="confusion")
        oldC = clf.params.C
        // TODO: provide clf.params.C not with a tuple but dictionary

After Change


                                          enable_states="confusion")
        // on balanced
        e = cve(ds__)
        tpr_1 = cve.states.confusion.stats["TPR"][1]

        // on disbalanced
        e = cve(ds_)
        tpr_2 =  cve.states.confusion.stats["TPR"][1]

        // Set "1 C per label"
        // recreate cvte since previous might have operated on copies
        cve = CrossValidatedTransferError(TransferError(clf), NFoldSplitter(),
                                          enable_states="confusion")
        oldC = clf.params.C
        // TODO: provide clf.params.C not with a tuple but dictionary
        //       with C per label (now order is deduced in a cruel way)
        ratio = N.sqrt(float(spl[ds_.UL[0]])/spl[ds_.UL[1]])
        clf.params.C = (-1/ratio, -1*ratio)
        try:
            // on disbalanced but with balanced C
            e_ = cve(ds_)
            // reassign C
            clf.params.C = oldC
        except:
            clf.params.C = oldC
            raise
        tpr_3 = cve.states.confusion.stats["TPR"][1]

        // Actual tests
        if cfg.getboolean("tests", "labile", default="yes"):
            self.failUnless(tpr_1 > 0.25,
                            msg="Without disballance we should have some "
                            "hits, but got TPR=%.3f" % tpr_1)

            self.failUnless(tpr_2 < 0.25,
                            msg="With disballance we should have almost no "
                            "hits for minor, but got TPR=%.3f" % tpr_2)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: PyMVPA/PyMVPA
Commit Name: 2665eecc8c29cae4e7a93ec587f5d59e916025e3
Time: 2009-12-17
Author: debian@onerussian.com
File Name: mvpa/tests/test_svm.py
Class Name: SVMTests
Method Name: testCperClass


Project Name: PyMVPA/PyMVPA
Commit Name: b157150be42a40cd0bd9e7609caadb267133cd4c
Time: 2009-08-19
Author: debian@onerussian.com
File Name: mvpa/tests/test_procrust.py
Class Name: ProcrusteanMapperTests
Method Name: testSimple


Project Name: PyMVPA/PyMVPA
Commit Name: 7859ecea2734c65fa6eabb014b2936c5aebc5cb2
Time: 2007-11-07
Author: debian@onerussian.com
File Name: tests/test_dataset.py
Class Name: DatasetTests
Method Name: testZScoring