1 |
bicatali 12/11/30 00:25:42 |
2 |
|
3 |
Added: 0.12.1-linalg.patch |
4 |
Log: |
5 |
Version bump |
6 |
|
7 |
(Portage version: 2.2.01.21313-prefix/cvs/Linux x86_64, signed Manifest commit with key 0x13CB1360) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sci-libs/scikits_learn/files/0.12.1-linalg.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-libs/scikits_learn/files/0.12.1-linalg.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-libs/scikits_learn/files/0.12.1-linalg.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: 0.12.1-linalg.patch |
16 |
=================================================================== |
17 |
--- a/sklearn/linear_model/least_angle.py |
18 |
+++ b/sklearn/linear_model/least_angle.py |
19 |
@@ -236,8 +236,8 @@ def lars_path(X, y, Xy=None, Gram=None, |
20 |
L_.flat[::n_active + 1] += (2 ** i) * eps |
21 |
least_squares, info = solve_cholesky(L_, |
22 |
sign_active[:n_active], lower=True) |
23 |
- AA = 1. / np.sqrt(np.sum(least_squares |
24 |
- * sign_active[:n_active])) |
25 |
+ tmp = max(np.sum(least_squares * sign_active[:n_active]), eps) |
26 |
+ AA = 1. / np.sqrt(tmp) |
27 |
i += 1 |
28 |
least_squares *= AA |
29 |
|
30 |
--- a/sklearn/linear_model/tests/test_least_angle.py |
31 |
+++ b/sklearn/linear_model/tests/test_least_angle.py |
32 |
@@ -101,6 +101,13 @@ def test_collinearity(): |
33 |
assert_true(not np.isnan(coef_path_).any()) |
34 |
residual = np.dot(X, coef_path_[:, -1]) - y |
35 |
assert_less((residual ** 2).sum(), 1.) # just make sure it's bounded |
36 |
+ |
37 |
+ n_samples = 10 |
38 |
+ X = np.random.rand(n_samples, 5) |
39 |
+ y = np.zeros(n_samples) |
40 |
+ _, _, coef_path_ = linear_model.lars_path(X, y, Gram='auto', copy_X=False, |
41 |
+ copy_Gram=False, alpha_min=0., method='lasso', verbose=0, max_iter=500) |
42 |
+ assert_array_almost_equal(coef_path_, np.zeros_like(coef_path_)) |
43 |
|
44 |
|
45 |
def test_no_path(): |