Fasttext: Which algorithm is being used for the classification task ?

Created on 11 May 2018  路  3Comments  路  Source: facebookresearch/fastText

I have followed the references provided and the code and understood how the word-embedding are being generated. What I am not able to get is:

  1. How is sentence/document vector is created using individual word embedding

  2. Which algorithm is being used for the classification task (when using ./fasttext supervised supervised and then ./fasttext supervised predict)

Most helpful comment

Hi @a11apurva,

  1. A sentence/document vector is obtained by averaging the word/ngram embeddings.
  2. For the classification task, multinomial logistic regression is used, where the sentence/document vector corresponds to the features. When applying fastText on problems with a large number of classes, you can use the hierarchical softmax to speed-up the computation (with the command line option -loss hs).

Please note that the two weight matrices (corresponding to the word/ngram embeddings and the classifiers) are learned jointly.

Best,
Edouard.

All 3 comments

Hi @a11apurva,

  1. A sentence/document vector is obtained by averaging the word/ngram embeddings.
  2. For the classification task, multinomial logistic regression is used, where the sentence/document vector corresponds to the features. When applying fastText on problems with a large number of classes, you can use the hierarchical softmax to speed-up the computation (with the command line option -loss hs).

Please note that the two weight matrices (corresponding to the word/ngram embeddings and the classifiers) are learned jointly.

Best,
Edouard.

Hi, in which file can I see the implementation of multinomial logistic regression? I only saw a binary logistic function in a file.

Thank you @EdouardGrave , it would be very useful if this info is mentioned in the supervised-tutorial file

Was this page helpful?
0 / 5 - 0 ratings