try making break_ties support work both before and after it was introduced
@@ -412,7 +412,7 @@ def fit(self, X, y, sample_weight=None):
# see comment on the other call to np.iinfo in this file
seed = rnd.randint(np.iinfo('i').max)
- if ( not sparse and not self.probability and not self.break_ties and
+ if ( not sparse and not self.probability and getattr(self, 'break_ties', False) and
sample_weight.size == 0 and self.class_weight is None and kernel in ['linear', 'rbf']):
self._daal_fit = True
@@ -506,6 +506,14 @@ def predict(self, X):
return self.classes_.take(np.asarray(y, dtype=np.intp))
+__base_svc_init_arg_names__ = []
+
+try:
+ __base_svc_init_arg_names__ = sklearn.svm.base.BaseSVC.__init__.co_varnames
+except:
+ pass
+
+if 'break_ties' in __base_svc_init_arg_names__:
class SVC(sklearn.svm.base.BaseSVC):
_impl = 'c_svc'
@@ -522,7 +530,23 @@ class SVC(sklearn.svm.base.BaseSVC):
class_weight=class_weight, verbose=verbose, max_iter=max_iter,
decision_function_shape=decision_function_shape, break_ties=break_ties,
random_state=random_state)
+else:
+ class SVC(sklearn.svm.base.BaseSVC):
+ _impl = 'c_svc'
+ def __init__(self, C=1.0, kernel='rbf', degree=3, gamma='auto_deprecated',
+ coef0=0.0, shrinking=True, probability=False,
+ tol=1e-3, cache_size=200, class_weight=None,
+ verbose=False, max_iter=-1, decision_function_shape='ovr',
+ random_state=None):
+
+ super(SVC, self).__init__(
+ kernel=kernel, degree=degree, gamma=gamma,
+ coef0=coef0, tol=tol, C=C, nu=0., shrinking=shrinking,
+ probability=probability, cache_size=cache_size,
+ class_weight=class_weight, verbose=verbose, max_iter=max_iter,
+ decision_function_shape=decision_function_shape,
+ random_state=random_state)
SVC.fit = fit
SVC.predict = predict
