def decision_function(self, X):
        """Predict raw anomaly score of X using the fitted detector.

        The anomaly score of an input sample is computed based on different
        detector algorithms. For consistency, outliers are assigned with
        larger anomaly scores.

        Parameters
        ----------
        X : numpy array of shape (n_samples, n_features)
            The training input samples. Sparse matrices are accepted only
            if they are supported by the base estimator.

        Returns
        -------
        anomaly_scores : numpy array of shape (n_samples,)
            The anomaly score of the input samples.
        """
        check_is_fitted(self, ['hist_', 'bin_edges_'])
        X = check_array(X)

        if isinstance(self.n_bins, str) and self.n_bins.lower() == "auto":
            outlier_scores = _calculate_outlier_scores_auto(X, self.bin_edges_,
                                                            self.hist_,
                                                            self.alpha,
                                                            self.tol)
        elif check_parameter(self.n_bins, low=2, high=np.inf):
            outlier_scores = _calculate_outlier_scores(X, self.bin_edges_,
                                                       self.hist_,
                                                       self.n_bins,
                                                       self.alpha, self.tol)
        return invert_order(np.sum(outlier_scores, axis=1))
Predict raw anomaly score of X using the fitted detector.

        The anomaly score of an input sample is computed based on different
        detector algorithms. For consistency, outliers are assigned with
        larger anomaly scores.

        Parameters
        ----------
        X : numpy array of shape (n_samples, n_features)
            The training input samples. Sparse matrices are accepted only
            if they are supported by the base estimator.

        Returns
        -------
        anomaly_scores : numpy array of shape (n_samples,)
            The anomaly score of the input samples.
        
pyod/models/hbos.py