docstr: Test lsi[vector] transformation.
docstr_tok: ["Test","lsi","[","vector","]","transformation","."]
code: def test_transform(self):
      """Test lsi[vector] transformation."""
      # create the transformation model
      model = self.model
  
      # make sure the decomposition is enough accurate
      u, s, vt = scipy.linalg.svd(
          matutils.corpus2dense(self.corpus, self.corpus.num_terms),
          full_matrices=False,
      )
      self.assertTrue(
          np.allclose(s[:2], model.projection.s)
      )  # singular values must match
  
      # transform one document
      doc = list(self.corpus)[0]
      transformed = model[doc]
      vec = matutils.sparse2full(
          transformed, 2
      )  # convert to dense vector, for easier equality tests
      expected = np.array(
          [-0.6594664, 0.142115444]
      )  # scaled LSI version
      # expected = np.array([-0.1973928, 0.05591352])  # non-scaled LSI version
      self.assertTrue(np.allclose(abs(vec), abs(expected)))
  
imports: import logging
  import unittest
  import numpy
  import scipy.linalg
  from gensim import matutils
  from gensim.corpora.mmcorpus import MmCorpus
  from gensim.models import lsimodel
  from gensim.test import basetmtests
  from gensim.test.utils import datapath, get_tmpfile
label_desc: Use image node_id 2 for calling the TestLsiModel obj's underlying member method code with example usage: obj.test_transform() without return types