From f75d2311cd5851fcf35c9d4b5f6be49878f3256d Mon Sep 17 00:00:00 2001
From: Fabian Pedregosa <fabian.pedregosa@inria.fr>
Date: Tue, 14 Dec 2010 17:58:35 +0100
Subject: [PATCH] FIX: do not invert the sign of decision_function in
 OneClasSVM.

---
 scikits/learn/svm/base.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scikits/learn/svm/base.py b/scikits/learn/svm/base.py
index afe86ded53..1a4a8f348a 100644
--- a/scikits/learn/svm/base.py
+++ b/scikits/learn/svm/base.py
@@ -276,10 +276,14 @@ class BaseLibSVM(BaseEstimator):
                       self.support_, self.label_, self.probA_,
                       self.probB_)
 
-        # libsvm has the convention of returning negative values for
-        # rightmost labels, so we invert the sign since our label_ is
-        # sorted by increasing order
-        return -dec_func
+
+        if self.impl != 'one_class':
+            # libsvm has the convention of returning negative values for
+            # rightmost labels, so we invert the sign since our label_ is
+            # sorted by increasing order
+            return -dec_func
+        else:
+            return dec_func
 
     @property
     def coef_(self):
-- 
GitLab