diff --git a/scikits/learn/svm/libsvm.py b/scikits/learn/svm/libsvm.py index 5889e9ff451a982404f439437e2336fc4524705c..ffe231a3f146a9a271ee4958176c3a9ff192c0e3 100644 --- a/scikits/learn/svm/libsvm.py +++ b/scikits/learn/svm/libsvm.py @@ -456,9 +456,9 @@ class OneClassSVM(BaseLibSVM): BaseLibSVM.__init__(self, 'one_class', kernel, degree, gamma, coef0, cache_size, eps, 0.0, nu, 0.0, shrinking, False) - def fit(self, X): + def fit(self, X, class_weight={}, sample_weight=[], **params): """ - Detects the soft boundary (aka soft boundary) of the set of samples X. + Detects the soft boundary of the set of samples X. Parameters ---------- @@ -466,5 +466,11 @@ class OneClassSVM(BaseLibSVM): Set of samples, where n_samples is the number of samples and n_features is the number of features. + Returns + ------- + self : object + Returns self. """ - super(OneClassSVM, self).fit(X, []) + super(OneClassSVM, self).fit( + X, [], class_weight=class_weight, sample_weight=sample_weight, + **params) diff --git a/scikits/learn/svm/sparse/libsvm.py b/scikits/learn/svm/sparse/libsvm.py index d338a85452a2ba27e0af99dfc384b6f93b58719a..8592e4267311a965fca997d9604766c04b645d18 100644 --- a/scikits/learn/svm/sparse/libsvm.py +++ b/scikits/learn/svm/sparse/libsvm.py @@ -116,5 +116,6 @@ class OneClassSVM (SparseBaseLibSVM): gamma, coef0, cache_size, eps, 0.0, nu, 0.0, shrinking, probability) - def fit(self, X, sample_weight=[]): - super(OneClassSVM, self).fit(X, [], sample_weight=sample_weight) + def fit(self, X, class_weight={}, sample_weight=[]): + super(OneClassSVM, self).fit( + X, [], class_weight=class_weight, ample_weight=sample_weight)