class_docstr: Represents a kernel based density estimator. The estimator uses the sklearn KernelDensity class internally.
class_docstr_tok: ["Represents","a","kernel","based","density","estimator",".","The","estimator","uses","the","sklearn","KernelDensity","class","internally","."]
code: def density(self, X: np.ndarray) -> np.ndarray:
      if self._kde_model is None:
          raise RuntimeError(
              "%s has not been fitted!" % self.__class__.__name__
          )
  
      X = shape_into_2d(X)
      self._validate_data(X)
  
      # Note, the output of score_samples are log values.
      return np.exp(self._kde_model.score_samples(X.reshape(-1, 1)))
  
file_path: dowhy/dowhy/gcm/density_estimators.py
imports: from typing import Optional
  import numpy
  from sklearn.mixture import BayesianGaussianMixture
  from sklearn.neighbors import KernelDensity
  from dowhy.gcm.density_estimator import DensityEstimator
  from dowhy.gcm.util.general import shape_into_2d
label_desc: Use image node_id 4 for calling the KernelDensityEstimator1D obj's underlying member method code with example usage: obj.density(X) and returns: np