Skip to content

Commit 2d2c87f

Browse files
author
Amit Aides
committed
Fix to sparse SVC with kernel='poly'
1 parent 5e06d30 commit 2d2c87f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scikits/learn/svm/sparse/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def fit(self, X, y, class_weight={}, sample_weight=[], **params):
102102
self.class_weight, self.class_weight_label = \
103103
_get_class_weight(class_weight, y)
104104

105-
if (kernel_type == 2) and (self.gamma == 0):
105+
if (kernel_type in [1, 2]) and (self.gamma == 0):
106106
# if custom gamma is not provided ...
107107
self.gamma = 1.0 / X.shape[0]
108108

scikits/learn/svm/tests/test_sparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_SVC():
6060

6161
def test_SVC_iris():
6262
"""Test the sparse SVC with the iris dataset"""
63-
for k in ('linear', 'rbf'):
63+
for k in ('linear', 'poly', 'rbf'):
6464
sp_clf = svm.sparse.SVC(kernel=k).fit(iris.data, iris.target)
6565
clf = svm.SVC(kernel=k).fit(iris.data.todense(), iris.target)
6666

0 commit comments

Comments
 (0)