Skip to content

Commit

Permalink
fix bug #86
Browse files Browse the repository at this point in the history
  • Loading branch information
QinbinLi committed Jul 4, 2018
1 parent 13fce80 commit 1915ab4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions python/thundersvmScikit.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ def fit(self, X, y):
self._gamma = 1.0 / X.shape[1]
else:
self._gamma = self.gamma

kernel = KERNEL_TYPE.index(self.kernel)
if self.kernel not in KERNEL_TYPE:
print ("The kernel parameter not recognized, please refer to the document.")
exit()
else:
kernel = KERNEL_TYPE.index(self.kernel)

fit = self._sparse_fit if self._sparse else self._dense_fit
self.model = thundersvm.model_new(solver_type)
Expand Down Expand Up @@ -332,7 +335,7 @@ def load_from_file(self, path):

class SVC(SvmModel, ClassifierMixin):
_impl = 'c_svc'
def __init__(self, kernel = 2, degree = 3,
def __init__(self, kernel = 'rbf', degree = 3,
gamma = 'auto', coef0 = 0.0, C = 1.0,
tol = 0.001, probability = False, class_weight = None,
shrinking = False, cache_size = None, verbose = False,
Expand All @@ -350,7 +353,7 @@ def __init__(self, kernel = 2, degree = 3,

class NuSVC(SvmModel, ClassifierMixin):
_impl = 'nu_svc'
def __init__(self, kernel = 2, degree = 3, gamma = 'auto',
def __init__(self, kernel = 'rbf', degree = 3, gamma = 'auto',
coef0 = 0.0, nu = 0.5, tol = 0.001,
probability = False, shrinking = False, cache_size = None, verbose = False,
max_iter = -1, n_jobs = -1, max_mem_size = -1, random_state = None, decison_function_shape = 'ovo'):
Expand All @@ -365,7 +368,7 @@ def __init__(self, kernel = 2, degree = 3, gamma = 'auto',

class OneClassSVM(SvmModel):
_impl = 'one_class'
def __init__(self, kernel = 2, degree = 3, gamma = 'auto',
def __init__(self, kernel = 'rbf', degree = 3, gamma = 'auto',
coef0 = 0.0, nu = 0.5, tol = 0.001,
shrinking = False, cache_size = None, verbose = False,
max_iter = -1, n_jobs = -1, max_mem_size = -1, random_state = None):
Expand All @@ -382,7 +385,7 @@ def fit(self, X, y=None):

class SVR(SvmModel, RegressorMixin):
_impl = 'epsilon_svr'
def __init__(self, kernel = 2, degree = 3, gamma = 'auto',
def __init__(self, kernel = 'rbf', degree = 3, gamma = 'auto',
coef0 = 0.0, C = 1.0, epsilon = 0.1,
tol = 0.001, probability = False,
shrinking = False, cache_size = None, verbose = False,
Expand All @@ -397,7 +400,7 @@ def __init__(self, kernel = 2, degree = 3, gamma = 'auto',

class NuSVR(SvmModel, RegressorMixin):
_impl = 'nu_svr'
def __init__(self, kernel = 2, degree = 3, gamma = 'auto',
def __init__(self, kernel = 'rbf', degree = 3, gamma = 'auto',
coef0 = 0.0, nu = 0.5, C = 1.0, tol = 0.001, probability = False,
shrinking = False, cache_size = None, verbose = False,
max_iter = -1, n_jobs = -1, max_mem_size = -1):
Expand Down

0 comments on commit 1915ab4

Please sign in to comment.