Skip to content

SVR kernel string issues with dense data in python 2.7 #87

@mheilman

Description

@mheilman

If feature scaling is set to both when using SVR (causing dense matrices to be used), then SVR complains (see below).

I'm guessing this started with the 0.17.1 bug fix release that aimed to fix a similar issue for python 3.

(python 2 unicode support strikes again!)

Traceback (most recent call last):
  File "/opt/python/2.7/lib/python2.7/site-packages/gridmap/job.py", line 196, in execute
    self.ret = self.function(*self.args, **self.kwlist)
  File "/opt/python/2.7/lib/python2.7/site-packages/skll/experiments.py", line 656, in _classify_featureset
    grid_jobs=grid_search_jobs)
  File "/opt/python/2.7/lib/python2.7/site-packages/skll/learner.py", line 1116, in cross_validate
    shuffle=False))
  File "/opt/python/2.7/lib/python2.7/site-packages/skll/learner.py", line 809, in train
    grid_searcher.fit(xtrain, classes)
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/grid_search.py", line 707, in fit
    return self._fit(X, y, ParameterGrid(self.param_grid))
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/grid_search.py", line 493, in _fit
    for parameters in parameter_iterable
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py", line 517, in __call__
    self.dispatch(function, args, kwargs)
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py", line 312, in dispatch
    job = ImmediateApply(func, args, kwargs)
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py", line 136, in __init__
    self.results = func(*args, **kwargs)
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/grid_search.py", line 306, in fit_grid_point
    clf.fit(X_train, y_train, **fit_params)
  File "/opt/python/2.7/lib/python2.7/site-packages/skll/learner.py", line 224, in fit
    orig_fit(self, X, y=y)
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/svm/base.py", line 178, in fit
    fit(X, y, sample_weight, solver_type, kernel, random_seed=seed)
  File "/opt/python/2.7/lib/python2.7/site-packages/sklearn/svm/base.py", line 233, in _dense_fit
    max_iter=self.max_iter, random_seed=random_seed)
TypeError: Argument 'kernel' has incorrect type (expected str, got unicode)
done

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions