code: def _joint_probabilities(distances, desired_perplexity, verbose):
      """Compute joint probabilities p_ij from distances.
  
      Parameters
      ----------
      distances : array, shape (n_samples * (n_samples-1) / 2,)
          Distances of samples are stored as condensed matrices, i.e.
          we omit the diagonal and duplicate entries and store everything
          in a one-dimensional array.
  
      desired_perplexity : float
          Desired perplexity of the joint probability distributions.
  
      verbose : int
          Verbosity level.
  
      Returns
      -------
      P : array, shape (n_samples * (n_samples-1) / 2,)
          Condensed joint probability matrix.
      """
      # Compute conditional probabilities such that they approximately match
      # the desired perplexity
      distances = astype(distances, np.float32, copy=False)
      conditional_P = _utils._binary_search_perplexity(
          distances, None, desired_perplexity, verbose
      )
      P = conditional_P + conditional_P.T
      sum_P = np.maximum(np.sum(P), MACHINE_EPSILON)
      P = np.maximum(squareform(P) / sum_P, MACHINE_EPSILON)
      return P
  
imports: import numpy
  from scipy import linalg
  import scipy.sparse
  from scipy.spatial.distance import pdist
  from scipy.spatial.distance import squareform
  from ..neighbors import BallTree
  from ..base import BaseEstimator
  from ..utils import check_array
  from ..utils import check_random_state
  from ..utils.extmath import _ravel
  from ..decomposition import PCA
  from ..metrics.pairwise import pairwise_distances
  from .None import _utils
  from .None import _barnes_hut_tsne
  from ..utils.fixes import astype
  from ..externals.six import string_types
label_desc: Use image node_id 1 for calling a global function with example usage: _joint_probabilities(distances, desired_perplexity, verbose) and returns: P