Repository: piskvorky/gensim

Issue:
Incorrect setting of FastText parameters during online training  
#### Description
The `FastText` model is trained with wrong parameters (`epochs`, `total_examples`, `start_alpha`, `end_alpha`) when calling `FastText.train` after building vocabulary. Since the above-mentioned training parameters are not logged, this bug is hidden from the users (probably explains why no one reported this issue earlier). This is a result of incorrect parameter setting ([here](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/fasttext.py#L531)) in the original pure python native implementation PR #1525 ([here](https://github.com/RaRe-Technologies/gensim/pull/1525/files#diff-d600f54965c37a9b12d856fe05956d90R205)).

#### Steps/Code/Corpus to Reproduce
No code -- since this issue is not detectable through code.

#### Expected Results
On calling `model.train(....)`, the model should train with parameters provided in the method call.

#### Actual Results
Model trains with the parameters set during model initialization.

Incorrect setting of FastText parameters during online training  
#### Description
The `FastText` model is trained with wrong parameters (`epochs`, `total_examples`, `start_alpha`, `end_alpha`) when calling `FastText.train` after building vocabulary. Since the above-mentioned training parameters are not logged, this bug is hidden from the users (probably explains why no one reported this issue earlier). This is a result of incorrect parameter setting ([here](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/fasttext.py#L531)) in the original pure python native implementation PR #1525 ([here](https://github.com/RaRe-Technologies/gensim/pull/1525/files#diff-d600f54965c37a9b12d856fe05956d90R205)).

#### Steps/Code/Corpus to Reproduce
No code -- since this issue is not detectable through code.

#### Expected Results
On calling `model.train(....)`, the model should train with parameters provided in the method call.

#### Actual Results
Model trains with the parameters set during model initialization.



Discussion:
This is an easy fix. Will submit PR for this ASAP with high priority. Not sure what the test case to catch this bug should be.
This is an easy fix. Will submit PR for this ASAP with high priority. Not sure what the test case to catch this bug should be.

Resolving patch:
diff --git a/gensim/models/fasttext.py b/gensim/models/fasttext.py
--- a/gensim/models/fasttext.py
+++ b/gensim/models/fasttext.py
@@ -528,9 +528,10 @@ def train(self, sentences, total_examples=None, total_words=None,
                 self.neg_labels = zeros(self.negative + 1)
                 self.neg_labels[0] = 1.
 
-        Word2Vec.train(
-            self, sentences, total_examples=self.corpus_count, epochs=self.iter,
-            start_alpha=self.alpha, end_alpha=self.min_alpha)
+        super(FastText, self).train(
+            sentences, total_examples=total_examples, total_words=total_words, epochs=epochs, start_alpha=start_alpha,
+            end_alpha=end_alpha, word_count=word_count, queue_factor=queue_factor, report_delay=report_delay
+        )
         self.get_vocab_word_vecs()
 
     def __getitem__(self, word):


Test patch: