code: def _get_perplexity(D, beta):
      """Compute the perplexity and the A-row for a specific value of the
      precision of a Gaussian distribution.
  
      Parameters
      ----------
      D : array, shape (n_samples, )
          The dissimilarity matrix of the training samples.
      """
  
      A = np.exp(-D * beta)
      sumA = np.sum(A)
      H = np.log(sumA) + beta * np.sum(D * A) / sumA
      return H, A
  
file_path: pyod/pyod/models/sos.py
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  from numba import njit
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from .base import BaseDetector
label_desc: Use image node_id 1 for calling a global function with example usage: _get_perplexity(D, beta) and returns: H,  A