Permalink
Browse files

coverage 100% + pep8 small fix

  • Loading branch information...
1 parent e44915f commit ed33845dc2e5756a2264b73f3651ce2fe88e715e @paolo-losi paolo-losi committed Apr 26, 2011
Showing with 15 additions and 1 deletion.
  1. +1 −1 scikits/learn/svm/bounds.py
  2. +14 −0 scikits/learn/svm/tests/test_bounds.py
@@ -80,5 +80,5 @@ def l1_min_c(X, y, loss='l2', fit_intercept=True, intercept_scaling=1.0):
raise ValueError('Ill-posed l1_min_c calculation')
if loss == 'l2':
return 0.5 / den
- else: # loss == 'log':
+ else: # loss == 'log':
return 2.0 / den
@@ -1,3 +1,5 @@
+import nose
+
import numpy as np
from scipy import sparse as sp
@@ -57,3 +59,15 @@ def check_l1_min_c(X, y, loss, fit_intercept=True, intercept_scaling=None):
clf.fit(X, y)
assert (np.asanyarray(clf.coef_) != 0).any() or \
(np.asanyarray(clf.intercept_) != 0).any()
+
+
+@nose.tools.raises(ValueError)
+def test_ill_posed_min_c():
+ X = [[0, 0], [0, 0]]
+ y = [0, 1]
+ l1_min_c(X, y)
+
+
+@nose.tools.raises(ValueError)
+def test_unsupported_loss():
+ l1_min_c(dense_X, Y1, 'l1')

0 comments on commit ed33845

Please sign in to comment.