33"""
44Tests CoreML SupportVectorClassifier converter.
55"""
6+ from distutils .version import StrictVersion
67try :
78 from sklearn .impute import SimpleImputer as Imputer
89 import sklearn .preprocessing
@@ -59,6 +60,9 @@ def validate_zipmap(self, model):
5960 self .assertEqual (len (node .output ), 1 )
6061 self .assertTrue ('classProbability' in node .output )
6162
63+ @unittest .skipIf (
64+ StrictVersion (coremltools .__version__ ) > StrictVersion ("3.1" ),
65+ reason = "untested" )
6266 def test_support_vector_classifier_binary_no_prob (self ):
6367 svm , X = self ._fit_binary_classification (SVC (gamma = 0.5 ))
6468 svm_coreml = coremltools .converters .sklearn .convert (svm )
@@ -71,6 +75,9 @@ def test_support_vector_classifier_binary_no_prob(self):
7175 dump_data_and_model (X , svm , svm_onnx , basename = "CmlBinSVC-Out0" ,
7276 allow_failure = True )
7377
78+ @unittest .skipIf (
79+ StrictVersion (coremltools .__version__ ) > StrictVersion ("3.1" ),
80+ reason = "untested" )
7481 def test_support_vector_classifier_binary_with_prob (self ):
7582 svm , X = self ._fit_binary_classification (SVC (probability = True , gamma = 0.5 ))
7683 svm_coreml = coremltools .converters .sklearn .convert (svm )
@@ -79,6 +86,9 @@ def test_support_vector_classifier_binary_with_prob(self):
7986 self .validate_zipmap (svm_onnx )
8087 self ._check_model_outputs (svm_onnx , ['classLabel' , 'classProbability' ])
8188
89+ @unittest .skipIf (
90+ StrictVersion (coremltools .__version__ ) > StrictVersion ("3.1" ),
91+ reason = "untested" )
8292 def test_support_vector_classifier_multiclass_no_prob (self ):
8393 svm , X = self ._fit_multi_classification (SVC (gamma = 0.5 ))
8494 svm_coreml = coremltools .converters .sklearn .convert (svm )
@@ -88,6 +98,9 @@ def test_support_vector_classifier_multiclass_no_prob(self):
8898 self .assertEqual (len (nodes ), 1 )
8999 self ._check_model_outputs (svm_onnx , ['classLabel' ])
90100
101+ @unittest .skipIf (
102+ StrictVersion (coremltools .__version__ ) > StrictVersion ("3.1" ),
103+ reason = "untested" )
91104 def test_support_vector_classifier_multiclass_with_prob (self ):
92105 svm , X = self ._fit_multi_classification (SVC (probability = True , gamma = 0.5 ))
93106 svm_coreml = coremltools .converters .sklearn .convert (svm )
0 commit comments