You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same as multiclass classification with few modifications.
n_classes = 2, in last layer , self.out = nn.Linear(self.bert.config.hidden_size, n_classes), actually this will be automatically handled by the code for mutlicalss classification itself --- model = SentimentClassifier(len(class_names))
replace softmax with sigmoid here --- F.softmax(model(input_ids, attention_mask), dim=1)
loss function should be changed to BinaryCrossEntropyLoss i.e nn.BCELoss() from ---- loss_fn = nn.CrossEntropyLoss().to(device)
I use sentiment analysis with bert, however it is multiclass classification, how to change for binary class text classification.
The text was updated successfully, but these errors were encountered: