1 | import sklearn.svm as skl_svm |
||
0 ignored issues
–
show
|
|||
2 | |||
3 | from Orange.regression import SklLearner |
||
4 | from Orange.preprocess import Normalize |
||
5 | |||
6 | __all__ = ["SVRLearner", "NuSVRLearner"] |
||
7 | |||
8 | svm_pps = SklLearner.preprocessors + [Normalize()] |
||
9 | |||
10 | |||
11 | class SVRLearner(SklLearner): |
||
12 | __wraps__ = skl_svm.SVR |
||
13 | name = 'svr' |
||
14 | preprocessors = svm_pps |
||
15 | |||
16 | def __init__(self, kernel='rbf', degree=3, gamma=0.0, coef0=0.0, |
||
0 ignored issues
–
show
|
|||
17 | tol=0.001, C=1.0, epsilon=0.1, shrinking=True, |
||
0 ignored issues
–
show
|
|||
18 | cache_size=200, max_iter=-1, preprocessors=None): |
||
0 ignored issues
–
show
|
|||
19 | super().__init__(preprocessors=preprocessors) |
||
20 | self.params = vars() |
||
21 | self.supports_weights = True |
||
22 | |||
23 | |||
24 | class NuSVRLearner(SklLearner): |
||
25 | __wraps__ = skl_svm.NuSVR |
||
26 | name = 'nu svr' |
||
27 | preprocessors = svm_pps |
||
28 | |||
29 | def __init__(self, nu=0.5, C=1.0, kernel='rbf', degree=3, gamma=0.0, |
||
0 ignored issues
–
show
|
|||
30 | coef0=0.0, shrinking=True, tol=0.001, |
||
0 ignored issues
–
show
|
|||
31 | cache_size=200, max_iter=-1, preprocessors=None): |
||
0 ignored issues
–
show
|
|||
32 | super().__init__(preprocessors=preprocessors) |
||
33 | self.params = vars() |
||
34 | self.supports_weights = True |
||
35 | |||
36 | |||
37 | if __name__ == '__main__': |
||
38 | import Orange |
||
39 | |||
40 | data = Orange.data.Table('housing') |
||
41 | learners = [SVRLearner(), NuSVRLearner()] |
||
42 | res = Orange.evaluation.CrossValidation(data, learners) |
||
43 | for l, ca in zip(learners, Orange.evaluation.RMSE(res)): |
||
44 | print("learner: {}\nRMSE: {}\n".format(l, ca)) |
||
45 | |||
46 |
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.
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.