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
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
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
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