parameters: (max_squared_sum, alpha_scaled, loss, fit_intercept)
docstring: Compute automatic step size for SAG solver
  
      The step size is set to 1 / (alpha_scaled + L + fit_intercept) where L is
      the max sum of squares for over all samples.
  
      Parameters
      ----------
      max_squared_sum : float
          Maximum squared sum of X over samples.
  
      alpha_scaled : float
          Constant that multiplies the regularization term, scaled by
          1. / n_samples, the number of samples.
  
      loss : string, in {"log", "squared"}
          The loss function used in SAG solver.
  
      fit_intercept : bool
          Specifies if a constant (a.k.a. bias or intercept) will be
          added to the decision function.
  
      Returns
      -------
      step_size : float
          Step size used in SAG solver.
  
      References
      ----------
      Schmidt, M., Roux, N. L., & Bach, F. (2013).
      Minimizing finite sums with the stochastic average gradient
      https://hal.inria.fr/hal-00860051/document
docstring_summary: Compute automatic step size for SAG solver
docstring_tokens: Compute automatic step size for SAG solver
function: def get_auto_step_size(max_squared_sum, alpha_scaled, loss, fit_intercept):
      """Compute automatic step size for SAG solver
  
      The step size is set to 1 / (alpha_scaled + L + fit_intercept) where L is
      the max sum of squares for over all samples.
  
      Parameters
      ----------
      max_squared_sum : float
          Maximum squared sum of X over samples.
  
      alpha_scaled : float
          Constant that multiplies the regularization term, scaled by
          1. / n_samples, the number of samples.
  
      loss : string, in {"log", "squared"}
          The loss function used in SAG solver.
  
      fit_intercept : bool
          Specifies if a constant (a.k.a. bias or intercept) will be
          added to the decision function.
  
      Returns
      -------
      step_size : float
          Step size used in SAG solver.
  
      References
      ----------
      Schmidt, M., Roux, N. L., & Bach, F. (2013).
      Minimizing finite sums with the stochastic average gradient
      https://hal.inria.fr/hal-00860051/document
      """
      if loss in ('log', 'multinomial'):
          # inverse Lipschitz constant for log loss
          return 4.0 / (max_squared_sum + int(fit_intercept)
                        + 4.0 * alpha_scaled)
      elif loss == 'squared':
          # inverse Lipschitz constant for squared loss
          return 1.0 / (max_squared_sum + int(fit_intercept) + alpha_scaled)
      else:
          raise ValueError("Unknown loss function for SAG solver, got %s "
                           "instead of 'log' or 'squared'" % loss)
function_tokens: def get_auto_step_size ( max_squared_sum , alpha_scaled , loss , fit_intercept ) : if loss in ( 'log' , 'multinomial' ) : # inverse Lipschitz constant for log loss return 4.0 / ( max_squared_sum + int ( fit_intercept ) + 4.0 * alpha_scaled ) elif loss == 'squared' : # inverse Lipschitz constant for squared loss return 1.0 / ( max_squared_sum + int ( fit_intercept ) + alpha_scaled ) else : raise ValueError ( "Unknown loss function for SAG solver, got %s " "instead of 'log' or 'squared'" % loss )