Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertSamoilescu committed Dec 11, 2024
1 parent 46291dc commit e784b1b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions alibi_detect/od/pytorch/svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,14 @@ def fit( # type: ignore[override]
- converged: `bool` indicating whether training converged.
- n_iter: number of iterations performed.
"""
x_nys = self.nystroem.fit(x_ref).transform(x_ref)
x_nys = self.nystroem.fit(x_ref).transform(x_ref).cpu().numpy()
self.svm = SGDOneClassSVM(
tol=tol,
max_iter=max_iter,
verbose=verbose,
nu=self.nu
)
x_nys_np = x_nys.cpu().numpy()
self.svm = self.svm.fit(x_nys_np)
self.svm = self.svm.fit(x_nys)
self._set_fitted()
return {
'converged': self.svm.n_iter_ < max_iter,
Expand Down

0 comments on commit e784b1b

Please sign in to comment.