Search code examples
pythonmachine-learningscikit-learnsvmanomaly-detection

Can I set the contamination value in One Class SVM?


I was wondering in Isolation Forrest, Elliptic Envelope and Local Outlier Factor (LOF) you can set the contamination value. Is it possible to do the same for Support Vector Margin?

Thank you


Solution

  • The contamination value as defined in Scikit-learn document:

    The amount of contamination of the data set, i.e. the proportion of outliers in the data set. Used when fitting to define the threshold on the scores of the samples.

    Considering this definition, yes there exist such a mechanism in SVM, or more precisely in soft margin SVM. In Soft margin SVM, you have a parameter C which controls the amount of misclassification that the model can tolerate in finding a desired hyperplane.

    You can read more here: https://stats.stackexchange.com/a/159051/237773