code: def log_multivariate_normal_density(X, mean, covar, min_covar=1.0e-7):
      """Log probability for full covariance matrices."""
  
      # New BSD License
      #
      # Copyright (c) 2007 - 2012 The scikit-learn developers.
      # All rights reserved.
      #
      #
      # Redistribution and use in source and binary forms, with or without
      # modification, are permitted provided that the following conditions are met:
      #
      #   a. Redistributions of source code must retain the above copyright notice,
      #      this list of conditions and the following disclaimer.
      #   b. Redistributions in binary form must reproduce the above copyright
      #      notice, this list of conditions and the following disclaimer in the
      #      documentation and/or other materials provided with the distribution.
      #   c. Neither the name of the Scikit-learn Developers  nor the names of
      #      its contributors may be used to endorse or promote products
      #      derived from this software without specific prior written
      #      permission.
      #
      #
      # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
      # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
      # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
      # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
      # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
      # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
      # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
      # DAMAGE.
  
      #  taken from scikit-learn
  
      if hasattr(linalg, "solve_triangular"):
          # only in scipy since 0.9
          solve_triangular = linalg.solve_triangular
      else:
          # slower, but works
          solve_triangular = linalg.solve
      n_dim = X.shape[0]
      mu = mean
      cv = covar
  
      try:
          cv_chol = linalg.cholesky(cv, lower=True)
      except linalg.LinAlgError:
          # The model is most probabily stuck in a component with too
          # few observations, we need to reinitialize this components
          cv_chol = linalg.cholesky(
              cv + min_covar * np.eye(n_dim), lower=True
          )
      cv_log_det = 2 * np.sum(np.log(np.diagonal(cv_chol)))
      cv_sol = solve_triangular(cv_chol, (X - mu).T, lower=True).T
      if cv_sol.ndim == 1:
          cv_sol = np.expand_dims(cv_sol, axis=0)
      log_prob = -0.5 * (
          np.sum(cv_sol**2, axis=1)
          + n_dim * np.log(2 * np.pi)
          + cv_log_det
      )
  
      return log_prob
  
imports: from __future__ import division
  from math import exp
  import warnings
  import matplotlib.pyplot
  from mpl_toolkits.mplot3d import axes3d
  import numpy
  from numpy.linalg import inv
  import scipy
  from scipy.spatial.distance import mahalanobis
  from filterpy.stats import norm_cdf, multivariate_gaussian, logpdf, mahalanobis
  from scipy import linalg
label_desc: Use image node_id 8 for calling a global function with example usage: log_multivariate_normal_density(X, mean, covar, min_covar) and returns: log_prob