ba256835a4f33d9139a70b6440c3223123132bc8,torchnet/meter/confusionmeter.py,ConfusionMeter,add,#ConfusionMeter#,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"
In pattern: SUPERPATTERN
Frequency: 3
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: scikit-learn-contrib/DESlib
Commit Name: 1002cfbcc9f8182404fb058f959d625de2eabbfc
Time: 2018-03-22
Author: rafaelmenelau@gmail.com
File Name: deslib/dcs/rank.py
Class Name: Rank
Method Name: estimate_competence
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