class_docstr: Regression via a penalized Generalized Linear Model (GLM).
  
  GLMs based on a reproductive Exponential Dispersion Model (EDM) aim at fitting and
  predicting the mean of the target y as y_pred=h(X*w) with coefficients w.
  Therefore, the fit minimizes the following objective function with L2 priors as
  regularizer::
  
      1/(2*sum(s_i)) * sum(s_i * deviance(y_i, h(x_i*w)) + 1/2 * alpha * ||w||_2^2
  
  with inverse link function h, s=sample_weight and per observation (unit) deviance
  deviance(y_i, h(x_i*w)). Note that for an EDM, 1/2 * deviance is the negative
  log-likelihood up to a constant (in w) term.
  The parameter ``alpha`` corresponds to the lambda parameter in glmnet.
  
  Instead of implementing the EDM family and a link function separately, we directly
  use the loss functions `from sklearn._loss` which have the link functions included
  in them for performance reasons. We pick the loss functions that implement
  (1/2 times) EDM deviances.
  
  Read more in the :ref:`User Guide <Generalized_linear_models>`.
  
  .. versionadded:: 0.23
  
  Parameters
  ----------
  alpha : float, default=1
      Constant that multiplies the penalty term and thus determines the
      regularization strength. ``alpha = 0`` is equivalent to unpenalized
      GLMs. In this case, the design matrix `X` must have full column rank
      (no collinearities).
      Values must be in the range `[0.0, inf)`.
  
  fit_intercept : bool, default=True
      Specifies if a constant (a.k.a. bias or intercept) should be
      added to the linear predictor (X @ coef + intercept).
  
  solver : {'lbfgs', 'newton-cholesky'}, default='lbfgs'
      Algorithm to use in the optimization problem:
  
      'lbfgs'
          Calls scipy's L-BFGS-B optimizer.
  
      'newton-cholesky'
          Uses Newton-Raphson steps (in arbitrary precision arithmetic equivalent to
          iterated reweighted least squares) with an inner Cholesky based solver.
          This solver is a good choice for `n_samples` >> `n_features`, especially
          with one-hot encoded categorical features with rare categories. Be aware
          that the memory usage of this solver has a quadratic dependency on
          `n_features` because it explicitly computes the Hessian matrix.
  
          .. versionadded:: 1.2
  
  max_iter : int, default=100
      The maximal number of iterations for the solver.
      Values must be in the range `[1, inf)`.
  
  tol : float, default=1e-4
      Stopping criterion. For the lbfgs solver,
      the iteration will stop when ``max{|g_j|, j = 1, ..., d} <= tol``
      where ``g_j`` is the j-th component of the gradient (derivative) of
      the objective function.
      Values must be in the range `(0.0, inf)`.
  
  warm_start : bool, default=False
      If set to ``True``, reuse the solution of the previous call to ``fit``
      as initialization for ``coef_`` and ``intercept_``.
  
  verbose : int, default=0
      For the lbfgs solver set verbose to any positive number for verbosity.
      Values must be in the range `[0, inf)`.
  
  Attributes
  ----------
  coef_ : array of shape (n_features,)
      Estimated coefficients for the linear predictor (`X @ coef_ +
      intercept_`) in the GLM.
  
  intercept_ : float
      Intercept (a.k.a. bias) added to linear predictor.
  
  n_iter_ : int
      Actual number of iterations used in the solver.
  
  _base_loss : BaseLoss, default=HalfSquaredError()
      This is set during fit via `self._get_loss()`.
      A `_base_loss` contains a specific loss function as well as the link
      function. The loss to be minimized specifies the distributional assumption of
      the GLM, i.e. the distribution from the EDM. Here are some examples:
  
      =======================  ========  ==========================
      _base_loss               Link      Target Domain
      =======================  ========  ==========================
      HalfSquaredError         identity  y any real number
      HalfPoissonLoss          log       0 <= y
      HalfGammaLoss            log       0 < y
      HalfTweedieLoss          log       dependent on tweedie power
      HalfTweedieLossIdentity  identity  dependent on tweedie power
      =======================  ========  ==========================
  
      The link function of the GLM, i.e. mapping from linear predictor
      `X @ coeff + intercept` to prediction `y_pred`. For instance, with a log link,
      we have `y_pred = exp(X @ coeff + intercept)`.
class_docstr_tok: ["Regression","via","a","penalized","Generalized","Linear","Model","(","GLM",")",".","GLMs","based","on","a","reproductive","Exponential","Dispersion","Model","(","EDM",")","aim","at","fitting","and","predicting","the","mean","of","the","target","y","as","y_pred=h","(","X","*","w",")","with","coefficients","w.","Therefore",",","the","fit","minimizes","the","following","objective","function","with","L2","priors","as","regularizer",":",":","1\/","(","2","*","sum","(","s_i",")",")","*","sum","(","s_i","*","deviance","(","y_i",",","h","(","x_i","*","w",")",")","+","1\/2","*","alpha","*","||w||_2^2","with","inverse","link","function","h",",","s=sample_weight","and","per","observation","(","unit",")","deviance","deviance","(","y_i",",","h","(","x_i","*","w",")",")",".","Note","that","for","an","EDM",",","1\/2","*","deviance","is","the","negative","log-likelihood","up","to","a","constant","(","in","w",")","term",".","The","parameter","``","alpha","``","corresponds","to","the","lambda","parameter","in","glmnet",".","Instead","of","implementing","the","EDM","family","and","a","link","function","separately",",","we","directly","use","the","loss","functions","`","from","sklearn._loss","`","which","have","the","link","functions","included","in","them","for","performance","reasons",".","We","pick","the","loss","functions","that","implement","(","1\/2","times",")","EDM","deviances",".","Read","more","in","the",":","ref",":","`","User","Guide","<","Generalized_linear_models",">","`",".","..","versionadded",":",":","0.23","Parameters","--","--","--","--","--","alpha",":","float",",","default=1","Constant","that","multiplies","the","penalty","term","and","thus","determines","the","regularization","strength",".","``","alpha","=","0","``","is","equivalent","to","unpenalized","GLMs",".","In","this","case",",","the","design","matrix","`","X","`","must","have","full","column","rank","(","no","collinearities",")",".","Values","must","be","in","the","range","`","[","0.0",",","inf",")","`",".","fit_intercept",":","bool",",","default=True","Specifies","if","a","constant","(","a.k.a",".","bias","or","intercept",")","should","be","added","to","the","linear","predictor","(","X","@","coef","+","intercept",")",".","solver",":","{","'lbfgs","'",",","'newton-cholesky","'","}",",","default='lbfgs'","Algorithm","to","use","in","the","optimization","problem",":","'lbfgs'","Calls","scipy","'s","L-BFGS-B","optimizer",".","'newton-cholesky'","Uses","Newton-Raphson","steps","(","in","arbitrary","precision","arithmetic","equivalent","to","iterated","reweighted","least","squares",")","with","an","inner","Cholesky","based","solver",".","This","solver","is","a","good","choice","for","`","n_samples","`",">",">","`","n_features","`",",","especially","with","one-hot","encoded","categorical","features","with","rare","categories",".","Be","aware","that","the","memory","usage","of","this","solver","has","a","quadratic","dependency","on","`","n_features","`","because","it","explicitly","computes","the","Hessian","matrix",".","..","versionadded",":",":","1.2","max_iter",":","int",",","default=100","The","maximal","number","of","iterations","for","the","solver",".","Values","must","be","in","the","range","`","[","1",",","inf",")","`",".","tol",":","float",",","default=1e-4","Stopping","criterion",".","For","the","lbfgs","solver",",","the","iteration","will","stop","when","``","max","{","|g_j|",",","j","=","1",",","...",",","d","}","<","=","tol","``","where","``","g_j","``","is","the","j-th","component","of","the","gradient","(","derivative",")","of","the","objective","function",".","Values","must","be","in","the","range","`","(","0.0",",","inf",")","`",".","warm_start",":","bool",",","default=False","If","set","to","``","True","``",",","reuse","the","solution","of","the","previous","call","to","``","fit","``","as","initialization","for","``","coef_","``","and","``","intercept_","``",".","verbose",":","int",",","default=0","For","the","lbfgs","solver","set","verbose","to","any","positive","number","for","verbosity",".","Values","must","be","in","the","range","`","[","0",",","inf",")","`",".","Attributes","--","--","--","--","--","coef_",":","array","of","shape","(","n_features",",",")","Estimated","coefficients","for","the","linear","predictor","(","`","X","@","coef_","+","intercept_","`",")","in","the","GLM",".","intercept_",":","float","Intercept","(","a.k.a",".","bias",")","added","to","linear","predictor",".","n_iter_",":","int","Actual","number","of","iterations","used","in","the","solver",".","_base_loss",":","BaseLoss",",","default=HalfSquaredError","(",")","This","is","set","during","fit","via","`","self._get_loss","(",")","`",".","A","`","_base_loss","`","contains","a","specific","loss","function","as","well","as","the","link","function",".","The","loss","to","be","minimized","specifies","the","distributional","assumption","of","the","GLM",",","i.e",".","the","distribution","from","the","EDM",".","Here","are","some","examples",":","=======================","========","==========================","_base_loss","Link","Target","Domain","=======================","========","==========================","HalfSquaredError","identity","y","any","real","number","HalfPoissonLoss","log","0","<","=","y","HalfGammaLoss","log","0","<","y","HalfTweedieLoss","log","dependent","on","tweedie","power","HalfTweedieLossIdentity","identity","dependent","on","tweedie","power","=======================","========","==========================","The","link","function","of","the","GLM",",","i.e",".","mapping","from","linear","predictor","`","X","@","coeff","+","intercept","`","to","prediction","`","y_pred","`",".","For","instance",",","with","a","log","link",",","we","have","`","y_pred","=","exp","(","X","@","coeff","+","intercept",")","`","."]
docstr: Compute the linear_predictor = `X @ coef_ + intercept_`.
  
  Note that we often use the term raw_prediction instead of linear predictor.
  
  Parameters
  ----------
  X : {array-like, sparse matrix} of shape (n_samples, n_features)
      Samples.
  
  Returns
  -------
  y_pred : array of shape (n_samples,)
      Returns predicted values of linear predictor.
docstr_tok: ["Compute","the","linear_predictor","=","`","X","@","coef_","+","intercept_","`",".","Note","that","we","often","use","the","term","raw_prediction","instead","of","linear","predictor",".","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}","of","shape","(","n_samples",",","n_features",")","Samples",".","Returns","--","--","--","-","y_pred",":","array","of","shape","(","n_samples",",",")","Returns","predicted","values","of","linear","predictor","."]
code: def _linear_predictor(self, X):
      """Compute the linear_predictor = `X @ coef_ + intercept_`.
  
      Note that we often use the term raw_prediction instead of linear predictor.
  
      Parameters
      ----------
      X : {array-like, sparse matrix} of shape (n_samples, n_features)
          Samples.
  
      Returns
      -------
      y_pred : array of shape (n_samples,)
          Returns predicted values of linear predictor.
      """
      check_is_fitted(self)
      X = self._validate_data(
          X,
          accept_sparse=["csr", "csc", "coo"],
          dtype=[np.float64, np.float32],
          ensure_2d=True,
          allow_nd=False,
          reset=False,
      )
      return X @ self.coef_ + self.intercept_
  
imports: from numbers import Integral, Real
  import numpy
  import scipy.optimize
  from ..._loss.loss import HalfGammaLoss, HalfPoissonLoss, HalfSquaredError, HalfTweedieLoss, HalfTweedieLossIdentity
  from ...base import BaseEstimator, RegressorMixin, _fit_context
  from ...utils import check_array
  from ...utils._openmp_helpers import _openmp_effective_n_threads
  from ...utils._param_validation import Hidden, Interval, StrOptions
  from ...utils.optimize import _check_optimize_result
  from ...utils.validation import _check_sample_weight, check_is_fitted
  from .._linear_loss import LinearModelLoss
  from ._newton_solver import NewtonCholeskySolver, NewtonSolver
label_desc: Use image node_id 3 for calling the _GeneralizedLinearRegressor obj's underlying member method code with example usage: obj._linear_predictor(X) and returns: unknown