Skip to content

AE1SVM: nu is documented as "Parameter for the SVM loss" but is never used #751

Description

@owgreen-dev

AE1SVM.__init__ accepts and documents nu:

# pyod/models/ae1svm.py:224
nu : float, optional (default=0.1)
    Parameter for the SVM loss.

It is stored at ae1svm.py:257 (self.nu = nu) and that is its only non-signature occurrence in the module. The training loss at ae1svm.py:334-336 is

svm_loss = torch.mean(torch.clamp(1 - svm_scores, min=0))
loss = self.alpha * recon_loss + svm_loss

a plain hinge with no ν term. AE1SVM(nu=0.01) and AE1SVM(nu=0.5) train identically.

Why it matters: ν is the defining hyperparameter of a one-class SVM (it bounds the fraction of training points treated as outliers and the fraction of support vectors); in the AE-1SVM paper (Nguyen & Vien, 2018) the OC-SVM term is (1/ν)·mean(max(0, ρ − w·φ(x))) − ρ. A user tuning nu gets no effect and no warning. Same shape as #714 (DevNet).

Proposed fix: either (a) wire nu into the loss with a learnable ρ per the paper, with a regression test that two nu values produce different decision_scores_; or (b) if the simplified hinge is intentional, remove nu from the signature/docstring with a deprecation. Happy to do either once you say which.

Found with a script that checks every detector for the sklearn parameter contract (get_params/clone/refit); drafted with Claude Code assistance and verified by hand.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions