class_docstr: Representation of a kernel-density estimate using Gaussian kernels.
  
  Parameters
  ----------
  dataset : array-like
      Datapoints to estimate from. In case of univariate data this is a 1-D
      array, otherwise a 2D array with shape (# of dims, # of data).
  bw_method : str, scalar or callable, optional
      The method used to calculate the estimator bandwidth.  This can be
      'scott', 'silverman', a scalar constant or a callable.  If a
      scalar, this will be used directly as `kde.factor`.  If a
      callable, it should take a `GaussianKDE` instance as only
      parameter and return a scalar. If None (default), 'scott' is used.
  
  Attributes
  ----------
  dataset : ndarray
      The dataset passed to the constructor.
  dim : int
      Number of dimensions.
  num_dp : int
      Number of datapoints.
  factor : float
      The bandwidth factor, obtained from `kde.covariance_factor`, with which
      the covariance matrix is multiplied.
  covariance : ndarray
      The covariance matrix of *dataset*, scaled by the calculated bandwidth
      (`kde.factor`).
  inv_cov : ndarray
      The inverse of *covariance*.
  
  Methods
  -------
  kde.evaluate(points) : ndarray
      Evaluate the estimated pdf on a provided set of points.
  kde(points) : ndarray
      Same as kde.evaluate(points)
class_docstr_tok: ["Representation","of","a","kernel-density","estimate","using","Gaussian","kernels",".","Parameters","--","--","--","--","--","dataset",":","array-like","Datapoints","to","estimate","from",".","In","case","of","univariate","data","this","is","a","1-D","array",",","otherwise","a","2D","array","with","shape","(","#","of","dims",",","#","of","data",")",".","bw_method",":","str",",","scalar","or","callable",",","optional","The","method","used","to","calculate","the","estimator","bandwidth",".","This","can","be","'scott","'",",","'silverman","'",",","a","scalar","constant","or","a","callable",".","If","a","scalar",",","this","will","be","used","directly","as","`","kde.factor","`",".","If","a","callable",",","it","should","take","a","`","GaussianKDE","`","instance","as","only","parameter","and","return","a","scalar",".","If","None","(","default",")",",","'scott","'","is","used",".","Attributes","--","--","--","--","--","dataset",":","ndarray","The","dataset","passed","to","the","constructor",".","dim",":","int","Number","of","dimensions",".","num_dp",":","int","Number","of","datapoints",".","factor",":","float","The","bandwidth","factor",",","obtained","from","`","kde.covariance_factor","`",",","with","which","the","covariance","matrix","is","multiplied",".","covariance",":","ndarray","The","covariance","matrix","of","*","dataset","*",",","scaled","by","the","calculated","bandwidth","(","`","kde.factor","`",")",".","inv_cov",":","ndarray","The","inverse","of","*","covariance","*",".","Methods","--","--","--","-","kde.evaluate","(","points",")",":","ndarray","Evaluate","the","estimated","pdf","on","a","provided","set","of","points",".","kde","(","points",")",":","ndarray","Same","as","kde.evaluate","(","points",")"]
docstr: Evaluate the estimated pdf on a set of points.
  
  Parameters
  ----------
  points : (# of dimensions, # of points)-array
      Alternatively, a (# of dimensions,) vector can be passed in and
      treated as a single point.
  
  Returns
  -------
  (# of points,)-array
      The values at each point.
  
  Raises
  ------
  ValueError : if the dimensionality of the input points is different
               than the dimensionality of the KDE.
docstr_tok: ["Evaluate","the","estimated","pdf","on","a","set","of","points",".","Parameters","--","--","--","--","--","points",":","(","#","of","dimensions",",","#","of","points",")","-array","Alternatively",",","a","(","#","of","dimensions",",",")","vector","can","be","passed","in","and","treated","as","a","single","point",".","Returns","--","--","--","-","(","#","of","points",",",")","-array","The","values","at","each","point",".","Raises","--","--","--","ValueError",":","if","the","dimensionality","of","the","input","points","is","different","than","the","dimensionality","of","the","KDE","."]
code: def evaluate(self, points):
      """
      Evaluate the estimated pdf on a set of points.
  
      Parameters
      ----------
      points : (# of dimensions, # of points)-array
          Alternatively, a (# of dimensions,) vector can be passed in and
          treated as a single point.
  
      Returns
      -------
      (# of points,)-array
          The values at each point.
  
      Raises
      ------
      ValueError : if the dimensionality of the input points is different
                   than the dimensionality of the KDE.
  
      """
      points = np.atleast_2d(points)
  
      dim, num_m = np.array(points).shape
      if dim != self.dim:
          raise ValueError(
              f"points have dimension {dim}, dataset has "
              f"dimension {self.dim}"
          )
  
      result = np.zeros(num_m)
  
      if num_m >= self.num_dp:
          # there are more points than data, so loop over data
          for i in range(self.num_dp):
              diff = self.dataset[:, i, np.newaxis] - points
              tdiff = np.dot(self.inv_cov, diff)
              energy = np.sum(diff * tdiff, axis=0) / 2.0
              result = result + np.exp(-energy)
      else:
          # loop over points
          for i in range(num_m):
              diff = self.dataset - points[:, i, np.newaxis]
              tdiff = np.dot(self.inv_cov, diff)
              energy = np.sum(diff * tdiff, axis=0) / 2.0
              result[i] = np.sum(np.exp(-energy), axis=0)
  
      result = result / self.norm_factor
  
      return result
  
imports: import functools
  from numbers import Number
  import numpy
  from matplotlib import _api, _docstring, cbook
label_desc: Use image node_id 4 for calling the GaussianKDE obj's underlying member method code with example usage: obj.evaluate(points) and returns: result