FMFP icon indicating copy to clipboard operation
FMFP copied to clipboard

temperature scaling

Open Lyttonkeepfoing opened this issue 9 months ago • 6 comments

It's a really nice repo. I read your paper and wondering the baseline you set is MSP+Temperature Scaling? But I could not find the Temperture Scaling operations in your code. parser.add_argument('--cwd_weight', default=0.1, type=float, help='Trianing time tempscaling') the option here class KDLoss(nn.Module): def init(self, temp_factor): super(KDLoss, self).init() self.temp_factor = temp_factor self.kl_div = nn.KLDivLoss(reduction="sum")

def forward(self, input, target):
    log_p = torch.log_softmax(input/self.temp_factor, dim=1)
    q = torch.softmax(target/self.temp_factor, dim=1)
    loss = self.kl_div(log_p, q)*(self.temp_factor**2)/input.size(0)
    return loss

kdloss = KDLoss(2.0) the KDL loss here. And Temperre Scaling is used in training time not inference? You said it's a post-hoc method, so you should use it in your inference time? Could you help me with this confusion?

Lyttonkeepfoing avatar Sep 27 '23 05:09 Lyttonkeepfoing