@@ -31,10 +31,12 @@ class OWSVM(OWBaseLearner):
3131 pps = SklLearner .preprocessors
3232 scaling = [Scale (center = Scale .NoCentering )]
3333
34+ def __init__ (self ):
35+ super ().__init__ (SklLearner .preprocessors )
36+
3437 class Outputs (OWBaseLearner .Outputs ):
3538 support_vectors = Output ("Support vectors" , Table , explicit = True )
3639
37-
3840 #: Different types of SVMs
3941 SVM , Nu_SVM = range (2 )
4042 #: SVM type
@@ -71,6 +73,13 @@ class Outputs(OWBaseLearner.Outputs):
7173 ("RBF" , "exp(-g|x-y|²)" ),
7274 ("Sigmoid" , "tanh(g x⋅y + c)" ))
7375
76+ def set_preprocessor (self , preprocessor ):
77+ if preprocessor is None :
78+ self .preprocessors = self .pps
79+ else :
80+ self .preprocessors = preprocessor
81+ self .apply ()
82+
7483 def add_main_layout (self ):
7584 self ._add_type_box ()
7685 self ._add_kernel_box ()
@@ -222,7 +231,7 @@ def create_learner(self):
222231 'probability' : True ,
223232 'tol' : self .tol ,
224233 'max_iter' : self .max_iter if self .limit_iter else - 1 ,
225- 'preprocessors' : self .pps + self .scaling if self .scale_data else self .pps
234+ 'preprocessors' : self .preprocessors + self .scaling if self .scale_data else self .preprocessors
226235 }
227236 if self .svm_type == self .SVM :
228237 return SVMLearner (C = self .C , epsilon = self .epsilon , ** common_args )
0 commit comments