def _compute_regularization(alpha, l1_ratio, regularization):
 alpha_H = 0.0
 alpha_W = 0.0
 if (regularization in ('both', 'components')):
  alpha_H = float(alpha)
 if (regularization in ('both', 'transformation')):
  alpha_W = float(alpha)
 l1_reg_W = (alpha_W * l1_ratio)
 l1_reg_H = (alpha_H * l1_ratio)
 l2_reg_W = (alpha_W * (1.0 - l1_ratio))
 l2_reg_H = (alpha_H * (1.0 - l1_ratio))
 return (l1_reg_W, l1_reg_H, l2_reg_W, l2_reg_H)

def _compute_regularization ( alpha , l1_ratio , regularization ) : alpha_H = 0.0 alpha_W = 0.0 if ( regularization in ( 'both' , 'components' ) ) : alpha_H = float ( alpha ) if ( regularization in ( 'both' , 'transformation' ) ) : alpha_W = float ( alpha ) l1_reg_W = ( alpha_W * l1_ratio ) l1_reg_H = ( alpha_H * l1_ratio ) l2_reg_W = ( alpha_W * ( 1.0 - l1_ratio ) ) l2_reg_H = ( alpha_H * ( 1.0 - l1_ratio ) ) return ( l1_reg_W , l1_reg_H , l2_reg_W , l2_reg_H )
compute l1 and l2 regularization coefficients for w and h .