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

Before Change


            assert (target.sum(1) == 1).all(), \
                    "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



        // hack for bincounting 2 arrays together
        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))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

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: danforthcenter/plantcv
Commit Name: 132a83a86879f4389e4d3acbe989399be0f2c708
Time: 2018-10-18
Author: hschuhl@danforthcenter.org
File Name: plantcv/plantcv/fill.py
Class Name:
Method Name: fill


Project Name: konstantint/PassportEye
Commit Name: 929c186c4dfa80a1ac975b5f2b95002ca12889d0
Time: 2020-11-28
Author: kt@ut.ee
File Name: passporteye/mrz/scripts.py
Class Name:
Method Name: mrz