Thanks! The approach isn’t specific to binary classification, but you will have to make some minor adjustments. Off the top of my head, you will need to either change the BinaryClassificationProcessor class or define your own Processor subclass. The BinaryClassificationProcessor simply returns 0 and 1 as the labels, it doesn’t actually check the data for labels. Your new Processor subclass will have to return a list of all the labels in your multiclass dataset.

A more straightforward, but way hackier, solution would be to change the line (1st line, 6th cell, in BERT.ipynb) that calls the get_labels() method to simply assign a list of the proper labels to label_list.


label_list = ['positive', 'neutral', 'negative']

Other than that, everything else should work as is.

Let me know if you run into any trouble, and I’ll see if I can help.

AI researcher, avid reader, fantasy and Sci-Fi geek, and fan of the Oxford comma.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store