@@ -151,7 +151,7 @@ def ridge_regression(
151151 # https://github.com/projectglow/glow/issues/266
152152 diag [:n_zero_reg ] = 1
153153 diags .append (np .diag (diag )) # type: ignore[no-untyped-call]
154- diags = np .stack (diags )
154+ diags = np .stack (diags ) # type: ignore[assignment]
155155 B = np .linalg .inv (XtX + diags ) @ XtY # type: ignore[no-untyped-call]
156156 B = B .astype (dtype or XtX .dtype )
157157 assert_array_shape (B , n_alpha , n_obs , n_outcome )
@@ -363,8 +363,8 @@ def _stage_2(
363363 alphas = get_alphas (n_variant_block * n_alpha_1 )
364364 n_alpha_2 = alphas .size
365365
366- YR = []
367- BR = []
366+ YR_list = []
367+ BR_list = []
368368 for i in range (n_outcome ):
369369 # Slice and reshape to new 2D covariate matrix;
370370 # The order of raveling in trailing dimensions is important
@@ -382,11 +382,11 @@ def _stage_2(
382382 BB , YPB = _ridge_regression_cv (XPB , YB , alphas , n_zero_reg = n_covar )[- 2 :]
383383 assert_array_shape (BB , n_alpha_2 , n_sample_block * n_indvar , 1 )
384384 assert_array_shape (YPB , n_alpha_2 , n_sample , 1 )
385- BR .append (BB )
386- YR .append (YPB )
385+ BR_list .append (BB )
386+ YR_list .append (YPB )
387387
388388 # Concatenate predictions along outcome dimension
389- YR = da .concatenate (YR , axis = 2 )
389+ YR = da .concatenate (YR_list , axis = 2 )
390390 assert_block_shape (YR , 1 , n_sample_block , n_outcome )
391391 assert_chunk_shape (YR , n_alpha_2 , sample_chunks [0 ], 1 )
392392 assert_array_shape (YR , n_alpha_2 , n_sample , n_outcome )
@@ -399,7 +399,7 @@ def _stage_2(
399399 assert YR .shape [1 :] == Y .T .shape
400400
401401 # Concatenate betas along outcome dimension
402- BR = da .concatenate (BR , axis = 2 )
402+ BR = da .concatenate (BR_list , axis = 2 )
403403 assert_block_shape (BR , 1 , n_sample_block , n_outcome )
404404 assert_chunk_shape (BR , n_alpha_2 , n_indvar , 1 )
405405 assert_array_shape (BR , n_alpha_2 , n_sample_block * n_indvar , n_outcome )
0 commit comments