Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The MLP classification model output is not logit and vanilla cross entropy loss is used. #24

Open
findalexli opened this issue Apr 11, 2023 · 0 comments

Comments

@findalexli
Copy link

The downstream classifier as defined as follows has a simple linear model that can map to any number between negative inf to positive infinity. I switched to nn.bce_with_logits().

'''
class target_classifier(nn.Module):
def init(self, configs):
super(target_classifier, self).init()
self.logits = nn.Linear(2*128, 64)
self.logits_simple = nn.Linear(64, configs.num_classes_target)

def forward(self, emb):
    emb_flat = emb.reshape(emb.shape[0], -1)
    emb = torch.sigmoid(self.logits(emb_flat))
    pred = self.logits_simple(emb)
    return pred

'''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant