Skip to content

Commit

Permalink
Update kpca.py
Browse files Browse the repository at this point in the history
fix to cover selected components
  • Loading branch information
tam17aki authored Nov 14, 2023
1 parent 819c8fc commit e78400f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyod/models/kpca.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def fit(self, X, y=None):
random_state=self.random_state,
)
x_transformed = self.kpca.fit_transform(X)
x_transformed = x_transformed[:, : self.n_selected_components_]

centerer = self.kpca.get_centerer
kernel = self.kpca.get_kernel
Expand Down Expand Up @@ -375,6 +376,8 @@ def decision_function(self, X):
gram_matrix = kernel(X, self.kpca.X_fit_)

x_transformed = self.kpca.transform(X)
x_transformed = x_transformed[:, : self.n_selected_components_]

potential = []
for i in range(X.shape[0]):
sample = X[i, :].reshape(1, -1)
Expand Down

0 comments on commit e78400f

Please sign in to comment.