def score(self, X, return_responsibilities=False):
    nc = len(self.weights)
    X = numpy.array(X)
    if (X.ndim == 1):
        X = X[:, None]
    if (X.shape[1] != self.means.shape[1]):
        raise ValueError('The shape of X  is not compatible with self')
    mins = self.lims[:, 0]
    maxes = self.lims[:, 1]
    lpr = (numpy.log(self.weights) + log_multivariate_normal_density(X, self.means, self.covs, 'full'))
    mask = (X >= mins[None, :]).all(axis=(- 1))
    mask &= (X <= maxes[None, :]).all(axis=(- 1))
    logprob = logsumexp(lpr, axis=1)
    logprob[(~ mask)] = (- numpy.inf)
    if return_responsibilities:
        responsibilities = numpy.exp((lpr - logprob[:, None]))
        responsibilities[(~ mask)] = 0
        return (logprob, responsibilities)
    return logprob
def score(self, X, return_responsibilities=False):
    nc = len(self.weights)
    X = numpy.array(X)
    if (X.ndim == 1):
        X = X[:, None]
    if (X.shape[1] != self.means.shape[1]):
        raise ValueError('The shape of X  is not compatible with self')
    mins = self.lims[:, 0]
    maxes = self.lims[:, 1]
    lpr = (numpy.log(self.weights) + log_multivariate_normal_density(X, self.means, self.covs, 'full'))
    mask = (X >= mins[None, :]).all(axis=(- 1))
    mask &= (X <= maxes[None, :]).all(axis=(- 1))
    logprob = logsumexp(lpr, axis=1)
    logprob[(~ mask)] = (- numpy.inf)
    if return_responsibilities:
        responsibilities = numpy.exp((lpr - logprob[:, None]))
        responsibilities[(~ mask)] = 0
        return (logprob, responsibilities)
    return logprob