title: Gensim Doc2Vec - Why does infer_vector() use alpha?
body: <p>I try to map sentences to a vector in order to make sentences comparable to each other. To test gensim's Doc2Vec model, I downloaded sklearn's newsgroup dataset and trained the model on it.</p>
  <p>In order to compare two sentences, I use model.infer_vector() and I am wondering why two calls using the same sentence delivers me different vectors:</p>
  <pre><code>model = Doc2Vec(vector_size=100, window=8, min_count=5, workers=6)
  model.build_vocab(documents)
  
  epochs=10
  for epoch in range(epochs):
      print(&quot;Training epoch %d&quot; % (epoch+1))
      model.train(documents,  total_examples=len(documents), epochs=epochs)
  
      v1 = model.infer_vector(&quot;I feel good&quot;)
      v2 = model.infer_vector(&quot;I feel good&quot;)
      print(np.linalg.norm(v1-v2)) 
  </code></pre>
  <p>Output:</p>
  <blockquote>
  <p>Training epoch 1</p>
  <p>0.41606528</p>
  <p>Training epoch 2</p>
  <p>0.43440753</p>
  <p>Training epoch 3</p>
  <p>0.3203116</p>
  <p>Training epoch 4</p>
  <p>0.3039317</p>
  <p>Training epoch 5</p>
  <p>0.68224543</p>
  <p>Training epoch 6</p>
  <p>0.5862567</p>
  <p>Training epoch 7</p>
  <p>0.5424634</p>
  <p>Training epoch 8</p>
  <p>0.7618142</p>
  <p>Training epoch 9</p>
  <p>0.8170159</p>
  <p>Training epoch 10</p>
  <p>0.6028216</p>
  </blockquote>
  <p>If I set alpha and min_alpha = 0 I get consistent vectors for the &quot;I feel fine&quot; and &quot;I feel good&quot;, but the model gives me the same vector in every epoch, so it does not seem to learn anything:</p>
  <blockquote>
  <p>Training epoch 1</p>
  <p>0.043668125</p>
  <p>Training epoch 2</p>
  <p>0.043668125</p>
  <p>Training epoch 3</p>
  <p>0.043668125</p>
  <p>Training epoch 4</p>
  <p>0.043668125</p>
  <p>Training epoch 5</p>
  <p>0.043668125</p>
  <p>Training epoch 6</p>
  <p>0.043668125</p>
  <p>Training epoch 7</p>
  <p>0.043668125</p>
  <p>Training epoch 8</p>
  <p>0.043668125</p>
  <p>Training epoch 9</p>
  <p>0.043668125</p>
  <p>Training epoch 10</p>
  <p>0.043668125</p>
  </blockquote>
  <p>So my questions are:</p>
  <ol>
  <li><p>Why do I even have the possibility to specify a learning rate for inference? I would expect that the model is only changed during training and not during inference.</p>
  </li>
  <li><p>If I specify alpha=0 for inference, why does the distance between those two vectors not change during different epochs?</p>
  </li>
  </ol>