class_docstr: Display a projection of a vectorized corpus in two dimensions using TSNE,
  a nonlinear dimensionality reduction method that is particularly well
  suited to embedding in two or three dimensions for visualization as a
  scatter plot. TSNE is widely used in text analysis to show clusters or
  groups of documents or utterances and their relative proximities.
  
  TSNE will return a scatter plot of the vectorized corpus, such that each
  point represents a document or utterance. The distance between two points
  in the visual space is embedded using the probability distribution of
  pairwise similarities in the higher dimensionality; thus TSNE shows
  clusters of similar documents and the relationships between groups of
  documents as a scatter plot.
  
  TSNE can be used with either clustering or classification; by specifying
  the ``classes`` argument, points will be colored based on their similar
  traits. For example, by passing ``cluster.labels_`` as ``y`` in ``fit()``, all
  points in the same cluster will be grouped together. This extends the
  neighbor embedding with more information about similarity, and can allow
  better interpretation of both clusters and classes.
  
  For more, see https://lvdmaaten.github.io/tsne/
  
  Parameters
  ----------
  
  ax : matplotlib axes
      The axes to plot the figure on.
  
  decompose : string or None, default: ``'svd'``
      A preliminary decomposition is often used prior to TSNE to make the
      projection faster. Specify ``"svd"`` for sparse data or ``"pca"`` for
      dense data. If None, the original data set will be used.
  
  decompose_by : int, default: 50
      Specify the number of components for preliminary decomposition, by
      default this is 50; the more components, the slower TSNE will be.
  
  labels : list of strings
      The names of the classes in the target, used to create a legend.
      Labels must match names of classes in sorted order.
  
  colors : list or tuple of colors
      Specify the colors for each individual class
  
  colormap : string or matplotlib cmap
      Sequential colormap for continuous target
  
  random_state : int, RandomState instance or None, optional, default: None
      If int, random_state is the seed used by the random number generator;
      If RandomState instance, random_state is the random number generator;
      If None, the random number generator is the RandomState instance used
      by np.random. The random state is applied to the preliminary
      decomposition as well as tSNE.
  
  alpha : float, default: 0.7
      Specify a transparency where 1 is completely opaque and 0 is completely
      transparent. This property makes densely clustered points more visible.
  
  kwargs : dict
      Pass any additional keyword arguments to the TSNE transformer.
class_docstr_tok: ["Display","a","projection","of","a","vectorized","corpus","in","two","dimensions","using","TSNE",",","a","nonlinear","dimensionality","reduction","method","that","is","particularly","well","suited","to","embedding","in","two","or","three","dimensions","for","visualization","as","a","scatter","plot",".","TSNE","is","widely","used","in","text","analysis","to","show","clusters","or","groups","of","documents","or","utterances","and","their","relative","proximities",".","TSNE","will","return","a","scatter","plot","of","the","vectorized","corpus",",","such","that","each","point","represents","a","document","or","utterance",".","The","distance","between","two","points","in","the","visual","space","is","embedded","using","the","probability","distribution","of","pairwise","similarities","in","the","higher","dimensionality",";","thus","TSNE","shows","clusters","of","similar","documents","and","the","relationships","between","groups","of","documents","as","a","scatter","plot",".","TSNE","can","be","used","with","either","clustering","or","classification",";","by","specifying","the","``","classes","``","argument",",","points","will","be","colored","based","on","their","similar","traits",".","For","example",",","by","passing","``","cluster.labels_","``","as","``","y","``","in","``","fit","(",")","``",",","all","points","in","the","same","cluster","will","be","grouped","together",".","This","extends","the","neighbor","embedding","with","more","information","about","similarity",",","and","can","allow","better","interpretation","of","both","clusters","and","classes",".","For","more",",","see","https",":","\/\/lvdmaaten.github.io\/tsne\/","Parameters","--","--","--","--","--","ax",":","matplotlib","axes","The","axes","to","plot","the","figure","on",".","decompose",":","string","or","None",",","default",":","``","'svd","'","``","A","preliminary","decomposition","is","often","used","prior","to","TSNE","to","make","the","projection","faster",".","Specify","``","``","svd","''","``","for","sparse","data","or","``","``","pca","''","``","for","dense","data",".","If","None",",","the","original","data","set","will","be","used",".","decompose_by",":","int",",","default",":","50","Specify","the","number","of","components","for","preliminary","decomposition",",","by","default","this","is","50",";","the","more","components",",","the","slower","TSNE","will","be",".","labels",":","list","of","strings","The","names","of","the","classes","in","the","target",",","used","to","create","a","legend",".","Labels","must","match","names","of","classes","in","sorted","order",".","colors",":","list","or","tuple","of","colors","Specify","the","colors","for","each","individual","class","colormap",":","string","or","matplotlib","cmap","Sequential","colormap","for","continuous","target","random_state",":","int",",","RandomState","instance","or","None",",","optional",",","default",":","None","If","int",",","random_state","is","the","seed","used","by","the","random","number","generator",";","If","RandomState","instance",",","random_state","is","the","random","number","generator",";","If","None",",","the","random","number","generator","is","the","RandomState","instance","used","by","np.random",".","The","random","state","is","applied","to","the","preliminary","decomposition","as","well","as","tSNE",".","alpha",":","float",",","default",":","0.7","Specify","a","transparency","where","1","is","completely","opaque","and","0","is","completely","transparent",".","This","property","makes","densely","clustered","points","more","visible",".","kwargs",":","dict","Pass","any","additional","keyword","arguments","to","the","TSNE","transformer","."]
docstr: Creates an internal transformer pipeline to project the data set into
  2D space using TSNE, applying an pre-decomposition technique ahead of
  embedding if necessary. This method will reset the transformer on the
  class, and can be used to explore different decompositions.
  
  Parameters
  ----------
  
  decompose : string or None, default: ``'svd'``
      A preliminary decomposition is often used prior to TSNE to make
      the projection faster. Specify ``"svd"`` for sparse data or ``"pca"``
      for dense data. If decompose is None, the original data set will
      be used.
  
  decompose_by : int, default: 50
      Specify the number of components for preliminary decomposition, by
      default this is 50; the more components, the slower TSNE will be.
  
  Returns
  -------
  
  transformer : Pipeline
      Pipelined transformer for TSNE projections
docstr_tok: ["Creates","an","internal","transformer","pipeline","to","project","the","data","set","into","2D","space","using","TSNE",",","applying","an","pre-decomposition","technique","ahead","of","embedding","if","necessary",".","This","method","will","reset","the","transformer","on","the","class",",","and","can","be","used","to","explore","different","decompositions",".","Parameters","--","--","--","--","--","decompose",":","string","or","None",",","default",":","``","'svd","'","``","A","preliminary","decomposition","is","often","used","prior","to","TSNE","to","make","the","projection","faster",".","Specify","``","``","svd","''","``","for","sparse","data","or","``","``","pca","''","``","for","dense","data",".","If","decompose","is","None",",","the","original","data","set","will","be","used",".","decompose_by",":","int",",","default",":","50","Specify","the","number","of","components","for","preliminary","decomposition",",","by","default","this","is","50",";","the","more","components",",","the","slower","TSNE","will","be",".","Returns","--","--","--","-","transformer",":","Pipeline","Pipelined","transformer","for","TSNE","projections"]
code: def make_transformer(
      self, decompose="svd", decompose_by=50, tsne_kwargs={}
  ):
      """
      Creates an internal transformer pipeline to project the data set into
      2D space using TSNE, applying an pre-decomposition technique ahead of
      embedding if necessary. This method will reset the transformer on the
      class, and can be used to explore different decompositions.
  
      Parameters
      ----------
  
      decompose : string or None, default: ``'svd'``
          A preliminary decomposition is often used prior to TSNE to make
          the projection faster. Specify ``"svd"`` for sparse data or ``"pca"``
          for dense data. If decompose is None, the original data set will
          be used.
  
      decompose_by : int, default: 50
          Specify the number of components for preliminary decomposition, by
          default this is 50; the more components, the slower TSNE will be.
  
      Returns
      -------
  
      transformer : Pipeline
          Pipelined transformer for TSNE projections
      """
  
      # TODO: detect decompose by inferring from sparse matrix or dense or
      # If number of features > 50 etc.
      decompositions = {"svd": TruncatedSVD, "pca": PCA}
  
      if decompose and decompose.lower() not in decompositions:
          raise YellowbrickValueError(
              "'{}' is not a valid decomposition, use {}, or None".format(
                  decompose, ", ".join(decompositions.keys())
              )
          )
  
      # Create the pipeline steps
      steps = []
  
      # Add the pre-decomposition
      if decompose:
          klass = decompositions[decompose]
          steps.append(
              (
                  decompose,
                  klass(
                      n_components=decompose_by,
                      random_state=self.random_state,
                  ),
              )
          )
  
      # Add the TSNE manifold
      steps.append(
          (
              "tsne",
              TSNE(
                  n_components=2,
                  random_state=self.random_state,
                  **tsne_kwargs,
              ),
          )
      )
  
      # return the pipeline
      return Pipeline(steps)
  
file_path: yellowbrick/yellowbrick/text/tsne.py
imports: import numpy
  from collections import defaultdict
  from yellowbrick.draw import manual_legend
  from yellowbrick.text.base import TextVisualizer
  from yellowbrick.style.colors import resolve_colors
  from yellowbrick.exceptions import YellowbrickValueError
  from sklearn.manifold import TSNE
  from sklearn.pipeline import Pipeline
  from sklearn.decomposition import TruncatedSVD, PCA
label_desc: Use image node_id 2 for calling the TSNEVisualizer obj's underlying member method code with example usage: obj.make_transformer(decompose, decompose_by, tsne_kwargs) and returns: Pipeline