docstr: Infer a vector for given post-bulk training document.
  
  Notes
  -----
  Subsequent calls to this function may infer different representations for the same document.
  For a more stable representation, increase the number of epochs to assert a stricter convergence.
  
  Parameters
  ----------
  doc_words : list of str
      A document for which the vector representation will be inferred.
  alpha : float, optional
      The initial learning rate. If unspecified, value from model initialization will be reused.
  min_alpha : float, optional
      Learning rate will linearly drop to `min_alpha` over all inference epochs. If unspecified,
      value from model initialization will be reused.
  epochs : int, optional
      Number of times to train the new document. Larger values take more time, but may improve
      quality and run-to-run stability of inferred vectors. If unspecified, the `epochs` value
      from model initialization will be reused.
  
  Returns
  -------
  np.ndarray
      The inferred paragraph vector for the new document.
code: def infer_vector(
      self, doc_words, alpha=None, min_alpha=None, epochs=None
  ):
      """Infer a vector for given post-bulk training document.
  
      Notes
      -----
      Subsequent calls to this function may infer different representations for the same document.
      For a more stable representation, increase the number of epochs to assert a stricter convergence.
  
      Parameters
      ----------
      doc_words : list of str
          A document for which the vector representation will be inferred.
      alpha : float, optional
          The initial learning rate. If unspecified, value from model initialization will be reused.
      min_alpha : float, optional
          Learning rate will linearly drop to `min_alpha` over all inference epochs. If unspecified,
          value from model initialization will be reused.
      epochs : int, optional
          Number of times to train the new document. Larger values take more time, but may improve
          quality and run-to-run stability of inferred vectors. If unspecified, the `epochs` value
          from model initialization will be reused.
  
      Returns
      -------
      np.ndarray
          The inferred paragraph vector for the new document.
  
      """
      if isinstance(
          doc_words, str
      ):  # a common mistake; fail with a nicer error
          raise TypeError(
              "Parameter doc_words of infer_vector() must be a list of strings (not a single string)."
          )
  
      alpha = alpha or self.alpha
      min_alpha = min_alpha or self.min_alpha
      epochs = epochs or self.epochs
  
      doctag_vectors = pseudorandom_weak_vector(
          self.dv.vector_size, seed_string=" ".join(doc_words)
      )
      doctag_vectors = doctag_vectors.reshape(1, self.dv.vector_size)
  
      doctags_lockf = np.ones(1, dtype=REAL)
      doctag_indexes = [0]
      work = zeros(self.layer1_size, dtype=REAL)
      if not self.sg:
          neu1 = matutils.zeros_aligned(self.layer1_size, dtype=REAL)
  
      alpha_delta = (alpha - min_alpha) / max(epochs - 1, 1)
  
      for i in range(epochs):
          if self.sg:
              train_document_dbow(
                  self,
                  doc_words,
                  doctag_indexes,
                  alpha,
                  work,
                  learn_words=False,
                  learn_hidden=False,
                  doctag_vectors=doctag_vectors,
                  doctags_lockf=doctags_lockf,
              )
          elif self.dm_concat:
              train_document_dm_concat(
                  self,
                  doc_words,
                  doctag_indexes,
                  alpha,
                  work,
                  neu1,
                  learn_words=False,
                  learn_hidden=False,
                  doctag_vectors=doctag_vectors,
                  doctags_lockf=doctags_lockf,
              )
          else:
              train_document_dm(
                  self,
                  doc_words,
                  doctag_indexes,
                  alpha,
                  work,
                  neu1,
                  learn_words=False,
                  learn_hidden=False,
                  doctag_vectors=doctag_vectors,
                  doctags_lockf=doctags_lockf,
              )
          alpha -= alpha_delta
  
      return doctag_vectors[0]
  
imports: import logging
  import os
  from collections import namedtuple, defaultdict
  from collections.abc import Iterable
  from timeit import default_timer
  from dataclasses import dataclass
  from numpy import zeros, float32, vstack, integer, dtype
  import numpy
  from gensim import utils, matutils
  from gensim.utils import deprecated
  from gensim.models import Word2Vec, FAST_VERSION
  from gensim.models.keyedvectors import KeyedVectors, pseudorandom_weak_vector
label_desc: Use image node_id 15 for calling the Doc2Vec obj's underlying member method code with example usage: obj.infer_vector(doc_words, alpha, min_alpha, epochs) and returns: doctag_vectors