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, ['net_lst', 'iForest_lst', 'x_reduced_lst'])
        X = check_array(X)

        # conduct min-max normalization before feeding into neural networks
        X = self.minmax_scaler.transform(X)

        testing_n_samples = X.shape[0]
        score_lst = np.zeros([self.n_ensemble, testing_n_samples])

        # iteration
        for i in range(self.n_ensemble):
            # transform testing data to representation
            x_reduced = self._deep_representation(self.net_lst[i], X)

            # calculate outlier scores
            scores = _cal_score(x_reduced, self.iForest_lst[i])
            score_lst[i] = scores

        final_scores = np.average(score_lst, axis=0)
        return final_scores
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/dif.py