@@ -124,8 +124,7 @@ def _solve_dense_cholesky_kernel(K, y, alpha, sample_weight=None):
124124 # Only one penalty, we can solve multi-target problems in one time.
125125 K .flat [::n_samples + 1 ] += alpha [0 ]
126126
127- dual_coef = linalg .solve (K , y ,
128- sym_pos = True , overwrite_a = True )
127+ dual_coef = linalg .solve (K , y , sym_pos = True , overwrite_a = True )
129128
130129 # K is expensive to compute and store in memory so change it back in
131130 # case it was user-given.
@@ -196,7 +195,8 @@ def ridge_regression(X, y, alpha, sample_weight=1.0, solver='auto',
196195 - 'auto' chooses the solver automatically based on the type of data.
197196
198197 - 'svd' uses a Singular Value Decomposition of X to compute the Ridge
199- coefficients. More stable for singular matrices than 'dense_cholesky'.
198+ coefficients. More stable for singular matrices than
199+ 'dense_cholesky'.
200200
201201 - 'dense_cholesky' uses the standard scipy.linalg.solve function to
202202 obtain a closed-form solution via a Cholesky decomposition of
@@ -266,7 +266,8 @@ def ridge_regression(X, y, alpha, sample_weight=1.0, solver='auto',
266266 alpha = safe_asarray (alpha ).ravel ()
267267 if alpha .size not in [1 , n_targets ]:
268268 raise ValueError ("Number of targets and number of penalties "
269- "do not correspond: %d != %d" % (alpha .size , n_targets ))
269+ "do not correspond: %d != %d"
270+ % (alpha .size , n_targets ))
270271
271272 if alpha .size == 1 and n_targets > 1 :
272273 alpha = np .repeat (alpha , n_targets )
@@ -293,7 +294,7 @@ def ridge_regression(X, y, alpha, sample_weight=1.0, solver='auto',
293294 coef = safe_sparse_dot (X .T , dual_coef , dense_output = True ).T
294295 else :
295296 try :
296- coef = _solve_dense_cholesky (X , y , alpha )
297+ coef = _solve_dense_cholesky (X , y , alpha )
297298 except linalg .LinAlgError :
298299 # use SVD solver if matrix is singular
299300 solver = 'svd'
@@ -379,7 +380,8 @@ class Ridge(_BaseRidge, RegressorMixin):
379380 - 'auto' chooses the solver automatically based on the type of data.
380381
381382 - 'svd' uses a Singular Value Decomposition of X to compute the Ridge
382- coefficients. More stable for singular matrices than 'dense_cholesky'.
383+ coefficients. More stable for singular matrices than
384+ 'dense_cholesky'.
383385
384386 - 'dense_cholesky' uses the standard scipy.linalg.solve function to
385387 obtain a closed-form solution.
0 commit comments