code: def score_samples(self, X):
          
          check_is_fitted(self, 'means_')
  
          X = check_array(X)
          if X.ndim == 1:
              X = X[:, np.newaxis]
          if X.size == 0:
              return np.array([]), np.empty((0, self.n_components))
          if X.shape[1] != self.means_.shape[1]:
              raise ValueError('The shape of X  is not compatible with self')
  
          lpr = (log_multivariate_normal_density(X, self.means_, self.covars_,
                                                 self.covariance_type)
                 + np.log(self.weights_))
          logprob = logsumexp(lpr, axis=1)
          responsibilities = np.exp(lpr - logprob[:, np.newaxis])
          return logprob, responsibilities
docs: Return the per-sample likelihood of the data under the model.
  
          Compute the log probability of X under the model and
          return the posterior distribution (responsibilities) of each
          mixture component for each element of X.
  
          Parameters
          ----------
          X: array_like, shape (n_samples, n_features)
              List of n_features-dimensional data points. Each row
              corresponds to a single data point.
  
          Returns
          -------
          logprob : array_like, shape (n_samples,)
              Log probabilities of each data point in X.
  
          responsibilities : array_like, shape (n_samples, n_components)
              Posterior probabilities of each mixture component for each
              observation