class_docstr: Calculate affinities using a Gaussian mixture kernel.
  
  Instead of using a single perplexity to compute the affinities between data
  points, we can use a multiscale Gaussian kernel instead. This allows us to
  incorporate long range interactions.
  
  Please see the :ref:`parameter-guide` for more information.
  
  Parameters
  ----------
  data: np.ndarray
      The data matrix.
  
  perplexities: List[float]
      A list of perplexity values, which will be used in the multiscale
      Gaussian kernel. Perplexity can be thought of as the continuous
      :math:`k` number of nearest neighbors, for which t-SNE will attempt to
      preserve distances.
  
  method: str
      Specifies the nearest neighbor method to use. Can be ``exact``, ``annoy``,
      ``pynndescent``, ``hnsw``, ``approx``, or ``auto`` (default). ``approx``
      uses Annoy if the input data matrix is not a sparse object and if Annoy
      supports the given metric. Otherwise, it uses Pynndescent. ``auto`` uses
      exact nearest neighbors for N<1000 and the same heuristic as ``approx``
      for N>=1000.
  
  metric: Union[str, Callable]
      The metric to be used to compute affinities between points in the
      original space.
  
  metric_params: dict
      Additional keyword arguments for the metric function.
  
  symmetrize: bool
      Symmetrize the affinity matrix. During standard t-SNE optimization, the
      affinities are symmetrized. However, when embedding new data points into
      existing embeddings, symmetrization is not performed.
  
  n_jobs: int
      The number of threads to use while running t-SNE. This follows the
      scikit-learn convention, ``-1`` meaning all processors, ``-2`` meaning
      all but one, etc.
  
  random_state: Union[int, RandomState]
      If the value is an int, random_state is the seed used by the random
      number generator. If the value is a RandomState instance, then it will
      be used as the random number generator. If the value is None, the random
      number generator is the RandomState instance used by `np.random`.
  
  verbose: bool
  
  knn_index: Optional[nearest_neighbors.KNNIndex]
      Optionally, a precomptued ``openTSNE.nearest_neighbors.KNNIndex`` object
      can be specified. This option will ignore any KNN-related parameters.
      When ``knn_index`` is specified, ``data`` must be set to None.
class_docstr_tok: ["Calculate","affinities","using","a","Gaussian","mixture","kernel",".","Instead","of","using","a","single","perplexity","to","compute","the","affinities","between","data","points",",","we","can","use","a","multiscale","Gaussian","kernel","instead",".","This","allows","us","to","incorporate","long","range","interactions",".","Please","see","the",":","ref",":","`","parameter-guide","`","for","more","information",".","Parameters","--","--","--","--","--","data",":","np.ndarray","The","data","matrix",".","perplexities",":","List","[","float","]","A","list","of","perplexity","values",",","which","will","be","used","in","the","multiscale","Gaussian","kernel",".","Perplexity","can","be","thought","of","as","the","continuous",":","math",":","`","k","`","number","of","nearest","neighbors",",","for","which","t-SNE","will","attempt","to","preserve","distances",".","method",":","str","Specifies","the","nearest","neighbor","method","to","use",".","Can","be","``","exact","``",",","``","annoy","``",",","``","pynndescent","``",",","``","hnsw","``",",","``","approx","``",",","or","``","auto","``","(","default",")",".","``","approx","``","uses","Annoy","if","the","input","data","matrix","is","not","a","sparse","object","and","if","Annoy","supports","the","given","metric",".","Otherwise",",","it","uses","Pynndescent",".","``","auto","``","uses","exact","nearest","neighbors","for","N","<","1000","and","the","same","heuristic","as","``","approx","``","for","N",">","=1000",".","metric",":","Union","[","str",",","Callable","]","The","metric","to","be","used","to","compute","affinities","between","points","in","the","original","space",".","metric_params",":","dict","Additional","keyword","arguments","for","the","metric","function",".","symmetrize",":","bool","Symmetrize","the","affinity","matrix",".","During","standard","t-SNE","optimization",",","the","affinities","are","symmetrized",".","However",",","when","embedding","new","data","points","into","existing","embeddings",",","symmetrization","is","not","performed",".","n_jobs",":","int","The","number","of","threads","to","use","while","running","t-SNE",".","This","follows","the","scikit-learn","convention",",","``","-1","``","meaning","all","processors",",","``","-2","``","meaning","all","but","one",",","etc",".","random_state",":","Union","[","int",",","RandomState","]","If","the","value","is","an","int",",","random_state","is","the","seed","used","by","the","random","number","generator",".","If","the","value","is","a","RandomState","instance",",","then","it","will","be","used","as","the","random","number","generator",".","If","the","value","is","None",",","the","random","number","generator","is","the","RandomState","instance","used","by","`","np.random","`",".","verbose",":","bool","knn_index",":","Optional","[","nearest_neighbors.KNNIndex","]","Optionally",",","a","precomptued","``","openTSNE.nearest_neighbors.KNNIndex","``","object","can","be","specified",".","This","option","will","ignore","any","KNN-related","parameters",".","When","``","knn_index","``","is","specified",",","``","data","``","must","be","set","to","None","."]
docstr: Check and correct/truncate perplexities.
  
  If a perplexity is too large, it is corrected to the largest allowed
  value. It is then inserted into the list of perplexities only if that
  value doesn't already exist in the list.
docstr_tok: ["Check","and","correct\/truncate","perplexities",".","If","a","perplexity","is","too","large",",","it","is","corrected","to","the","largest","allowed","value",".","It","is","then","inserted","into","the","list","of","perplexities","only","if","that","value","does","n't","already","exist","in","the","list","."]
code: def check_perplexities(self, perplexities, n_samples):
      """Check and correct/truncate perplexities.
  
      If a perplexity is too large, it is corrected to the largest allowed
      value. It is then inserted into the list of perplexities only if that
      value doesn't already exist in the list.
  
      """
      if isinstance(perplexities, numbers.Number):
          perplexities = [perplexities]
  
      usable_perplexities = []
      for perplexity in sorted(perplexities):
          if perplexity <= 0:
              raise ValueError(
                  "Perplexity must be >=0. %.2f given" % perplexity
              )
  
          if 3 * perplexity > n_samples - 1:
              new_perplexity = (n_samples - 1) / 3
  
              if new_perplexity in usable_perplexities:
                  log.warning(
                      "Perplexity value %d is too high. Dropping "
                      "because the max perplexity is already in the "
                      "list." % perplexity
                  )
              else:
                  usable_perplexities.append(new_perplexity)
                  log.warning(
                      "Perplexity value %d is too high. Using "
                      "perplexity %.2f instead"
                      % (perplexity, new_perplexity)
                  )
          else:
              usable_perplexities.append(perplexity)
  
      return usable_perplexities
  
imports: import logging
  import numbers
  import operator
  from functools import reduce
  import numpy
  import scipy.sparse
  from openTSNE import _tsne
  from openTSNE import nearest_neighbors
  from openTSNE import utils
  from openTSNE.utils import is_package_installed
  import warnings
label_desc: Use image node_id 5 for calling the MultiscaleMixture obj's underlying member method code with example usage: obj.check_perplexities(perplexities, n_samples) and returns: usable_perplexities