List of commits:
Subject Hash Author Date (UTC)
add running auc meter 1494873cc463891b978b263e0d8bd691f3b30526 Xiangru Lian 2019-01-13 08:48:23
fix 1ed58b687a60985cd23721b0189a22429f3d1fe4 Xiangru Lian 2019-01-09 21:52:01
add reset to auc estimator 333badd5489e538b0ee9b5441331322ba72d3981 Xiangru Lian 2019-01-08 21:17:22
add riemann auc estimator 8ce1b37008f10d6ca825728b1d0106b03bb0529d Xiangru Lian 2019-01-08 21:11:27
fix d4f0a50ffb6afea07df425d759fdf8460839d0ce Xiangru Lian 2019-01-07 22:27:56
add numpy support 2e10283edfc427ea4da6a76c8c3a6f85a44bace4 Xiangru Lian 2019-01-07 22:24:12
update fcfc8a26e275395688fb3fa50538f890c1f612e4 Xiangru Lian 2019-01-07 21:55:04
use markdown for readme f46e30761b4f361d5494484d9bdb20dc04a20d83 Xiangru Lian 2019-01-07 21:53:46
add readme a9a0b91ea0e0485039ea76b6b69c5f983815e8a3 Xiangru Lian 2019-01-07 21:52:31
fix 16a965862eaefa554a540fd2eeee26f73907d5dd Xiangru Lian 2019-01-07 21:37:12
fix setup.py 24e85045cc859ffa7d6f514c80257fde94c0794a Xiangru Lian 2019-01-07 21:35:15
compatible with setup.py 657782ac87ea9251f2e3726b483089eca5384caf Xiangru Lian 2019-01-07 21:33:48
initial commit 27cb0b3b4f5f20240af6d14ead4f373a1aaa5343 Xiangru Lian 2019-01-07 21:26:20
Update .gitignore 52642556fea807b773617938eecd2d9d17f34bc6 ikzk 2019-01-07 20:16:37
Commit 1494873cc463891b978b263e0d8bd691f3b30526 - add running auc meter
Author: Xiangru Lian
Author date (UTC): 2019-01-13 08:48
Committer name: Xiangru Lian
Committer date (UTC): 2019-01-13 08:48
Parent(s): 1ed58b687a60985cd23721b0189a22429f3d1fe4
Signing key:
Tree: 4bd764c3dc1ed7427db5f89cd2ab7bb6dd4aa469
File Lines added Lines deleted
persia_pytorch_toolkit/meter_utils.py 20 4
File persia_pytorch_toolkit/meter_utils.py changed (mode: 100644) (index da129aa..5cb420e)
1 1 import torch import torch
2 import queue
2 3
3 4 class RiemannAUCMeter(): class RiemannAUCMeter():
4 5 """ """
 
... ... class RiemannAUCMeter():
13 14 indices = torch.clamp(outputs * self.num_bins, min=0, max=self.num_bins - 1).long() indices = torch.clamp(outputs * self.num_bins, min=0, max=self.num_bins - 1).long()
14 15 p_indices = torch.masked_select(indices, labels != 0) p_indices = torch.masked_select(indices, labels != 0)
15 16 n_indices = torch.masked_select(indices, labels == 0) n_indices = torch.masked_select(indices, labels == 0)
16 p_mask = torch.sparse.FloatTensor(p_indices.unsqueeze(0), torch.ones_like(p_indices), torch.Size([self.num_bins]))
17 n_mask = torch.sparse.FloatTensor(n_indices.unsqueeze(0), torch.ones_like(n_indices), torch.Size([self.num_bins]))
18 self.p_cnt += p_mask
19 self.n_cnt += n_mask
17 self.p_mask = torch.sparse.FloatTensor(p_indices.unsqueeze(0), torch.ones_like(p_indices), torch.Size([self.num_bins]))
18 self.n_mask = torch.sparse.FloatTensor(n_indices.unsqueeze(0), torch.ones_like(n_indices), torch.Size([self.num_bins]))
19 self.p_cnt += self.p_mask
20 self.n_cnt += self.n_mask
20 21
21 22 def value(self): def value(self):
22 23 p_sum = self.p_cnt.sum().item() p_sum = self.p_cnt.sum().item()
 
... ... class RiemannAUCMeter():
35 36 self.n_cnt = torch.zeros(self.num_bins, dtype=torch.long) self.n_cnt = torch.zeros(self.num_bins, dtype=torch.long)
36 37
37 38
39 class RiemannRunningAUCMeter(RiemannAUCMeter):
40 def __init__(self, num_bins=100000, buffer_size=100):
41 super().__init__(num_bins)
42 self.buffer_size = buffer_size
43 self.buffer = queue.Queue(maxsize=self.buffer_size)
44
45 def add(self, outputs, labels):
46 super().add(outputs, labels)
47 if self.buffer.full():
48 p_mask, n_mask = self.buffer.get()
49 self.p_cnt -= p_mask
50 self.n_cnt -= n_mask
51 self.buffer.put((self.p_mask, self.n_mask))
52
53
38 54 if __name__ == "__main__": if __name__ == "__main__":
39 55 meter = RiemannAUCMeter() meter = RiemannAUCMeter()
40 56 torch.manual_seed(7) torch.manual_seed(7)
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/ikzk/persia-pytorch-toolkit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/ikzk/persia-pytorch-toolkit

Clone this repository using git:
git clone git://git.rocketgit.com/user/ikzk/persia-pytorch-toolkit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main