GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (4082)

Orange/classification/svm.py (39 issues)

1
import sklearn.svm as skl_svm
0 ignored issues
show
The import sklearn.svm could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
2
3
from Orange.classification import SklLearner, SklModel
4
from Orange.base import SklLearner as SklLearnerBase
5
from Orange.preprocess import Normalize
6
7
__all__ = ["SVMLearner", "LinearSVMLearner", "NuSVMLearner",
8
           "OneClassSVMLearner"]
9
10
11
svm_pps = SklLearner.preprocessors + [Normalize()]
12
13
14
class SVMClassifier(SklModel):
15
16
    def predict(self, X):
17
        value = self.skl_model.predict(X)
18
        if self.skl_model.probability:
19
            prob = self.skl_model.predict_proba(X)
20
            return value, prob
21
        return value
22
23
24
class SVMLearner(SklLearner):
25
    __wraps__ = skl_svm.SVC
26
    __returns__ = SVMClassifier
27
    name = 'svm'
28
    preprocessors = svm_pps
29
30
    def __init__(self, C=1.0, kernel='rbf', degree=3, gamma=0.0,
0 ignored issues
show
The argument C seems to be unused.
Loading history...
The argument gamma seems to be unused.
Loading history...
The argument degree seems to be unused.
Loading history...
The argument kernel seems to be unused.
Loading history...
31
                 coef0=0.0, shrinking=True, probability=False,
0 ignored issues
show
The argument shrinking seems to be unused.
Loading history...
The argument probability seems to be unused.
Loading history...
The argument coef0 seems to be unused.
Loading history...
32
                 tol=0.001, cache_size=200, max_iter=-1,
0 ignored issues
show
The argument cache_size seems to be unused.
Loading history...
The argument tol seems to be unused.
Loading history...
The argument max_iter seems to be unused.
Loading history...
33
                 preprocessors=None):
34
        super().__init__(preprocessors=preprocessors)
35
        self.params = vars()
36
        self.supports_multiclass = True
37
        self.supports_weights = True
38
39
40
class LinearSVMLearner(SklLearner):
41
    __wraps__ = skl_svm.LinearSVC
42
    name = 'linear svm'
43
    preprocessors = svm_pps
44
45
    def __init__(self, penalty='l2', loss='squared_hinge', dual=True,
0 ignored issues
show
The argument penalty seems to be unused.
Loading history...
The argument loss seems to be unused.
Loading history...
The argument dual seems to be unused.
Loading history...
46
                 tol=0.0001, C=1.0, multi_class='ovr', fit_intercept=True,
0 ignored issues
show
The argument C seems to be unused.
Loading history...
The argument multi_class seems to be unused.
Loading history...
The argument tol seems to be unused.
Loading history...
The argument fit_intercept seems to be unused.
Loading history...
47
                 intercept_scaling=True, random_state=None,
0 ignored issues
show
The argument random_state seems to be unused.
Loading history...
The argument intercept_scaling seems to be unused.
Loading history...
48
                 preprocessors=None):
49
        super().__init__(preprocessors=preprocessors)
50
        self.params = vars()
51
        self.supports_multiclass = True
52
53
54
class NuSVMClassifier(SklModel):
55
56
    def predict(self, X):
57
        value = self.skl_model.predict(X)
58
        if self.skl_model.probability:
59
            prob = self.skl_model.predict_proba(X)
60
            return value, prob
61
        return value
62
63
64
class NuSVMLearner(SklLearner):
65
    __wraps__ = skl_svm.NuSVC
66
    __returns__ = NuSVMClassifier
67
    name = 'nu svm'
68
    preprocessors = svm_pps
69
70
    def __init__(self, nu=0.5, kernel='rbf', degree=3, gamma=0.0, coef0=0.0,
0 ignored issues
show
The argument gamma seems to be unused.
Loading history...
The argument coef0 seems to be unused.
Loading history...
The argument kernel seems to be unused.
Loading history...
The argument nu seems to be unused.
Loading history...
The argument degree seems to be unused.
Loading history...
71
                 shrinking=True, probability=False, tol=0.001, cache_size=200,
0 ignored issues
show
The argument cache_size seems to be unused.
Loading history...
The argument shrinking seems to be unused.
Loading history...
The argument tol seems to be unused.
Loading history...
The argument probability seems to be unused.
Loading history...
72
                 max_iter=-1, preprocessors=None):
0 ignored issues
show
The argument max_iter seems to be unused.
Loading history...
73
        super().__init__(preprocessors=preprocessors)
74
        self.params = vars()
75
        self.supports_multiclass = True
76
        self.supports_weights = True
77
78
79
class OneClassSVMLearner(SklLearnerBase):
80
    __wraps__ = skl_svm.OneClassSVM
81
    name = 'one class svm'
82
    preprocessors = svm_pps
83
84
    def __init__(self, kernel='rbf', degree=3, gamma=0.0, coef0=0.0,
0 ignored issues
show
The argument gamma seems to be unused.
Loading history...
The argument coef0 seems to be unused.
Loading history...
The argument degree seems to be unused.
Loading history...
The argument kernel seems to be unused.
Loading history...
85
                 tol=0.001, nu=0.5, shrinking=True, cache_size=200,
0 ignored issues
show
The argument cache_size seems to be unused.
Loading history...
The argument shrinking seems to be unused.
Loading history...
The argument tol seems to be unused.
Loading history...
The argument nu seems to be unused.
Loading history...
86
                 max_iter=-1, preprocessors=None):
0 ignored issues
show
The argument max_iter seems to be unused.
Loading history...
87
        super().__init__(preprocessors=preprocessors)
88
        self.params = vars()
89
        self.supports_weights = True
90
91
    def fit(self, X, Y=None, W=None):
92
        clf = self.__wraps__(**self.params)
93
        if W is not None:
94
            return self.__returns__(clf.fit(X, W.reshape(-1)))
95
        return self.__returns__(clf.fit(X))
96
97
98
if __name__ == '__main__':
99
    import Orange
100
101
    data = Orange.data.Table('iris')
102
    learners = [SVMLearner(), NuSVMLearner(), LinearSVMLearner()]
103
    res = Orange.evaluation.CrossValidation(data, learners)
104
    for l, ca in zip(learners, Orange.evaluation.CA(res)):
105
        print("learner: {}\nCA: {}\n".format(l, ca))
106