示例#1
0
    def predict(self, X):
        '''
        Returns +1 if the sample is predicted to be novel, -1 otherwise.
        '''
        ks = metrics.pairwise_kernels(X=self.X_train, Y=X, metric=self.metric)
        scores = score(self.projection, self.target_points, ks)
        prediction = np.array([1 if sc > self.threshold else -1 for sc in scores])

        return prediction
示例#2
0
    def predict(self, X):
        '''
        Returns +1 if the sample is predicted to be novel, -1 otherwise.
        '''
        ks = metrics.pairwise_kernels(X=self.X_train, Y=X, metric=self.metric)
        scores = score(self.projection, self.target_points, ks)
        prediction = np.array(
            [1 if sc > self.threshold else -1 for sc in scores])

        return prediction
示例#3
0
    def predict(self, X):
        '''
        Returns +1 if the sample is predicted to be novel, -1 otherwise.

        The threshold is selected between 0 and the minimum distance between
        two target points.
        '''
        ks = metrics.pairwise_kernels(X=self.X_train, Y=X, metric=self.metric)
        scores = score(self.projection, self.target_points, ks)
        # min_dist = self._get_pairwise_min_dist()
        prediction = np.array([1 if sc > self.threshold else -1 for sc in scores])

        return scores
示例#4
0
    def predict(self, X):
        '''
        Returns +1 if the sample is predicted to be novel, -1 otherwise.

        The threshold is selected between 0 and the minimum distance between
        two target points.
        '''
        ks = metrics.pairwise_kernels(X=self.X_train, Y=X, metric=self.metric)
        scores = score(self.projection, self.target_points, ks)
        # min_dist = self._get_pairwise_min_dist()
        prediction = np.array(
            [1 if sc > self.threshold else -1 for sc in scores])

        return scores