ba256835a4f33d9139a70b6440c3223123132bc8,torchnet/meter/confusionmeter.py,ConfusionMeter,add,#ConfusionMeter#Any#Any#,42

Before Change


                    "multi-label setting is not supported"
 
        pred = output.argmax(1)
        for i,n in enumerate(pred):
            pos = onehot and target[i].argmax(0) or int(target[i])
            self.conf[pos][n] += 1

    def value(self):
        if self.normalized:
            conf = self.conf.astype(np.float32)
            return conf / conf.sum(1).clip(min=1e-12)[:,None]

After Change


        x = predicted + self.k * target
        bincount_2d = np.bincount(x.astype(np.int32),
                                  minlength=self.k ** 2)
        assert bincount_2d.size == self.k ** 2
        conf = bincount_2d.reshape((self.k, self.k))

        self.conf += conf
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: pytorch/tnt
Commit Name: ba256835a4f33d9139a70b6440c3223123132bc8
Time: 2017-08-24
Author: swetha.tanamala@gmail.com
File Name: torchnet/meter/confusionmeter.py
Class Name: ConfusionMeter
Method Name: add


Project Name: CellProfiler/CellProfiler
Commit Name: 5416ceec0e93d4b09bc68ba6054356ea00bb7584
Time: 2017-08-31
Author: mcquin@users.noreply.github.com
File Name: tests/modules/test_overlayobjects.py
Class Name:
Method Name: test_run


Project Name: CellProfiler/CellProfiler
Commit Name: 53059cec9053a8429b7f0a8f06e6cbe1672b60e7
Time: 2013-01-16
Author: leek@broadinstitute.org
File Name: cellprofiler/modules/groups.py
Class Name: Groups
Method Name: on_activated


Project Name: richzhang/PerceptualSimilarity
Commit Name: 7b34113cc3b5529a127bd02667de9de0b5b75df9
Time: 2019-07-26
Author: rich.zhang@eecs.berkeley.edu
File Name: models/networks_basic.py
Class Name: PNet
Method Name: forward