简体   繁体   中英

data format for fasttext python

I want to build and test classifier. I made 2 files - train.txt and test.txt


train.txt/test.txt


__label__1 , (text)\\n


__label__2 , (text)\\n


__label__3 , (text)\\n


and so on. After building a classifier:

classifier = fasttext.supervised("train.txt","model")

result = classifier.test("test.txt")

The precision is always 1/n (n - number of lines). So the classifier is for every input returning the same entity (for example 2 for all inputs).

You don't need to have a comma between a label and a text. All label should be prefixed (as in your example) and be before the text in both train and test files.

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