Open albertcthomas opened 5 years ago
Why 0.1 and/or why 0.5? I assume we took the default from liblinear. I would rather not change it unless there's significant evidence that the current value doesn't make sense.
For outlier detection I think that we always assume the proportion of outliers to be small, say 5 or 10% rather than 50%. For novelty detection, nu
is the false positive rate that we also want to be small in general. The scikit-learn examples involving the OneClassSVM use the following values for nu
: 0.1, 0.1, 0.15, 0.261.
Other outlier detection estimators were all using a contamination parameter with default value equal to 0.1. Now IsolationForest and LOF use 'auto'.
libsvm indeed has
-n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)
Maybe they just wanted to have it consistent between the three classes, which is indeed not a good reason.
Relevant statement from http://users.cecs.anu.edu.au/~williams/papers/P132.pdf:
From the discussion in the paper it looks like 0.1 would indeed make more sense if we want to be consistent with the other estimators.
what would be the default value in case OneClassSVM is used for Novelty detection rather than Outlier detection
For novelty detection nu corresponds to the false positive rate, hence 0.1 or 0.05 is a usual default value.
I guess I am a bit confused with the usage of One class SVM for novelty detection. The documentation says "The training data is not polluted by outliers and we are interested in detecting whether a new observation is an outlier. " So that would mean that the model would consider the entire dataset i provide for training as one class without. However, in reality the model classifies each record as either a 1 or 0 for outlier or not. Is this correct behavior or am I doing something wrong.
This is the correct behavior. The model will classify some records as being outliers even if they are in fact normal records (false positives).
I let this issue open since it could make sense to change the default values of OneClassSVM
. I closed the associated PR since we need more investigation regarding the stability of the algorithm with a smaller nu
default value.
I think the default value for
nu
in theOneClassSVM
should be 0.1 and not 0.5. Asnu
roughly corresponds to the fraction of outliers, it makes more sense to set it to a lower value.