简体   繁体   中英

Multi-label classification with FastText

I was wondering if FastText is able to deal with multi-labelled data? Could someone share a simple example along with a confusion matrix (true vs predicted labels)? I have already taken a look at FastText documentation page.

Thank you in advance

This section describes multi label classification : https://github.com/facebookresearch/fastText/blob/main/docs/supervised-tutorial.md#multi-label-classification

A convenient way to handle multiple labels is to use independent binary classifiers for each label. This can be done with -loss one-vs-all or -loss ova .

Preparing training data

That has been described at the end of the section Installing fastText

Each line of the text file contains a list of labels , followed by the corresponding document . All the labels start by the __label __ prefix, which is how fastText recognize what is a label or what is a word.

The docs, & the format for supplying labeled text, only seem to mention a single label per text.

You could try repeating the same text more than once in your training data, each time with one of the appropriate labels. (You might want to re-shuffle the training data so that such repeated texts don't appear directly alongside each other.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM