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


                "in one-hot encoding, target values should be 0 or 1"
            assert (target.sum(1) == 1).all(), \
                "multi-label setting is not supported"
            target = np.argmax(target, 1)
        else:
            assert (predicted.max() < self.k) and (predicted.min() >= 0), \
                "predicted values are not between 1 and k"

        // 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: 4

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: scikit-learn-contrib/DESlib
Commit Name: bba1901f835525551dde9ec1537d041abc88d293
Time: 2021-04-08
Author: rafaelmenelau@gmail.com
File Name: deslib/static/oracle.py
Class Name: Oracle
Method Name: predict


Project Name: explosion/thinc
Commit Name: 7094da48fe0e670e587ee6ab54ec814211c22f84
Time: 2017-01-31
Author: honnibal+gh@gmail.com
File Name: thinc/neural/_classes/model.py
Class Name: Model
Method Name: evaluate


Project Name: chuyangliu/snake
Commit Name: 1226a2eee68336240a35fce9678320ca9430584f
Time: 2018-01-06
Author: chuyang.s.liu@gmail.com
File Name: snake/solver/dqn.py
Class Name: DQNSolver
Method Name: __choose_action