'Compute the decision function of the given observations.
Parameters
X : array-like, shape (n_samples, n_features)
raw_values : bool
Whether or not to consider raw Mahalanobis distances as the
decision function. Must be False (default) for compatibility
with the others outlier detection tools.
Returns
decision : array-like, shape (n_samples, )
Decision function of the samples.
It is equal to the Mahalanobis distances if `raw_values`
is True. By default (``raw_values=False``), it is equal
to the cubic root of the shifted Mahalanobis distances.
In that case, the threshold for being an outlier is 0, which
ensures a compatibility with other outlier detection tools
such as the One-Class SVM.'

def decision_function(self, X, raw_values=False):

    check_is_fitted(self, 'threshold_')
    X = check_array(X)
    mahal_dist = self.mahalanobis(X)
    if raw_values:
        decision = mahal_dist
    else:
        transformed_mahal_dist = (mahal_dist ** 0.33)
        decision = ((self.threshold_ ** 0.33) - transformed_mahal_dist)
    return decision
