c24fdc1414900a4172c996cdc2459a494322ba2e,tests/test_transerror.py,ErrorsTests,testConfusionMatrix,#ErrorsTests#,26

Before Change


        self.failUnlessRaises(ZeroDivisionError, lambda x:x.percentCorrect, cm)
        No samples -- raise exception

        cm.add(reg, N.array([1,2,1,2,2,2,3,2,1]))

        self.failUnlessEqual(len(cm.sets), 1,
            msg="Should have a single set so far")
        self.failUnlessEqual(cm.matrix.shape, (3,3),

After Change


    def testConfusionMatrix(self):
        data = N.array([1,2,1,2,2,2,3,2,1], ndmin=2).T
        reg = [1,1,1,2,2,2,3,3,3]
        regl = [1,2,1,2,2,2,3,2,1]

        // Check if we are ok with any input type - either list, or N.array, or tuple
        for t in [reg, tuple(reg), list(reg), N.array(reg)]:
            for p in [regl, tuple(regl), list(regl), N.array(regl)]:
                cm = ConfusionMatrix(targets=t, predictions=p)
                // check table content
                self.failUnless((cm.matrix == [[2,1,0],[0,3,0],[1,1,1]]).all())

        // Do a bit more thorough checking
        cm = ConfusionMatrix()
        self.failUnlessRaises(ZeroDivisionError, lambda x:x.percentCorrect, cm)
        No samples -- raise exception
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: PyMVPA/PyMVPA
Commit Name: c24fdc1414900a4172c996cdc2459a494322ba2e
Time: 2008-05-05
Author: debian@onerussian.com
File Name: tests/test_transerror.py
Class Name: ErrorsTests
Method Name: testConfusionMatrix


Project Name: philipperemy/keras-tcn
Commit Name: ad8e98817f58c721f7173e188281ccec251ef7a8
Time: 2020-01-06
Author: premy.enseirb@gmail.com
File Name: tasks/sequential.py
Class Name:
Method Name:


Project Name: facebookresearch/ParlAI
Commit Name: 72c304fa7cac16ed19d8bc75a017f17c8073dd2f
Time: 2020-02-13
Author: roller@fb.com
File Name: parlai/core/torch_generator_agent.py
Class Name: TorchGeneratorAgent
Method Name: _compute_fairseq_bleu


Project Name: RaRe-Technologies/gensim
Commit Name: 680de8d4f35325e7486c07c4e06422929e826b57
Time: 2019-01-10
Author: __Singleton__@hackerdom.ru
File Name: gensim/corpora/lowcorpus.py
Class Name: LowCorpus
Method Name: line2doc