(self, X: pd.DataFrame)
Since we predict the anomaly scores for each feature independently, we already return a binarized one-
        dimensional anomaly score array.
Since we predict the anomaly scores for each feature independently, we already return a binarized one-
        dimensional anomaly score array.
Since we predict the anomaly scores for each feature independently we already return a binarized one - dimensional anomaly score array .
def predict(self, X: pd.DataFrame):
        """Since we predict the anomaly scores for each feature independently, we already return a binarized one-
        dimensional anomaly score array."""
        with self.device:
            test_scores = np.zeros_like(X)
            for col_idx, col in enumerate(X.columns):
                mean, std, tf_session, model = \
                    self.means[col_idx], self.stds[col_idx], self.tf_sessions[col_idx], self.models[col_idx]
                test_values, _, _ = standardize_kpi(X.loc[:, col], mean=mean, std=std)
                test_missing = np.zeros_like(test_values)
                predictor = DonutPredictor(model)
                with tf_session.as_default():
                    test_score = predictor.get_score(test_values, test_missing)
                # Convert to negative reconstruction probability so score is in accordance with other detectors
                test_score = -np.power(np.e, test_score)
                test_scores[self.x_dims - 1:, col_idx] = test_score
            aggregated_test_scores = np.amax(test_scores, axis=1)
            aggregated_test_scores[:self.x_dims - 1] = np.nanmin(aggregated_test_scores) - sys.float_info.epsilon
            return aggregated_test_scores
def predict ( self , X : pd . DataFrame ) : with self . device : test_scores = np . zeros_like ( X ) for col_idx , col in enumerate ( X . columns ) : mean , std , tf_session , model = self . means [ col_idx ] , self . stds [ col_idx ] , self . tf_sessions [ col_idx ] , self . models [ col_idx ] test_values , _ , _ = standardize_kpi ( X . loc [ : , col ] , mean = mean , std = std ) test_missing = np . zeros_like ( test_values ) predictor = DonutPredictor ( model ) with tf_session . as_default ( ) : test_score = predictor . get_score ( test_values , test_missing ) # Convert to negative reconstruction probability so score is in accordance with other detectors test_score = - np . power ( np . e , test_score ) test_scores [ self . x_dims - 1 : , col_idx ] = test_score aggregated_test_scores = np . amax ( test_scores , axis = 1 ) aggregated_test_scores [ : self . x_dims - 1 ] = np . nanmin ( aggregated_test_scores ) - sys . float_info . epsilon return aggregated_test_scores