#NEWLINE# def _solve_svd( X , y , alpha ) : #NEWLINE# #INDENT# ( U , s , Vt ) = linalg . svd ( X , full_matrices = False ) #NEWLINE# idx = ( s > 1e-15 ) #NEWLINE# s_nnz = s [ idx ] [ : , np . newaxis ] #NEWLINE# UTy = np . dot ( U . T , y ) #NEWLINE# d = np . zeros ( ( s . size , alpha . size ) ) #NEWLINE# d [ idx ] = ( s_nnz / ( ( s_nnz ** 2 ) + alpha ) ) #NEWLINE# d_UT_y = ( d * UTy ) #NEWLINE# return np . dot ( Vt . T , d_UT_y ) . T