ConvLab-2 icon indicating copy to clipboard operation
ConvLab-2 copied to clipboard

BERTNLU postprocess.py 为什么可以通过 if intent_logits[j] > 0: 来获得intent的预测呢?

Open csmust opened this issue 2 years ago • 1 comments

csmust avatar Aug 16 '22 13:08 csmust

for j in range(dataloader.intent_dim):
    if intent_logits[j] > 0:   
        intent, domain, slot, value = re.split('\+', dataloader.id2intent[j])
        das.append([intent, domain, slot, value])

csmust avatar Aug 16 '22 13:08 csmust

Sorry for the late reply. intent_logits are the logits before sigmoid layer, since BCEWithLogitsLoss combines a Sigmoid layer and the BCELoss in one single class. Therefore, the logit>0 means output after sigmoid is larger than 0.5. https://github.com/thu-coai/ConvLab-2/blob/ad32b76022fa29cbc2f24cbefbb855b60492985e/convlab2/nlu/jointBERT/jointBERT.py#L44

zqwerty avatar Oct 17 '22 10:10 zqwerty