class_docstr: Class to implement a partially regularized regression.
  
  A partially regularized regression is defined as
  
      beta_0, beta_1, beta_2 = argmin ||y - X_0beta_0 - X_1beta_1 - X_2beta_2||_2^2 + a_1 * ||beta_1||_1 + a_2 * ||beta_2||_2^2
  
  This regression formulation allows user to specify which regressor to have what type of regularization.
  For example, in automatic changepoint detection, "ct1" should not be penalized, yearly seasonality can have light L2 norm regularization,
  while the changepoint regressors need L1 norm regularization to be sparse.
  
  Attributes
  ----------
  l1_index : `list`[`int`, `str`], default None
      The index of columns that are to be penalized with L1 norm.
  l1_alpha : `float`, default 0.001
      The L1 norm regularization parameter.
  l2_index : `list`[`int`, `str`], default None
      The index of columns that are to be penalized with L2 norm.
  l2_alpha : `float`, default 0.001
      The L2 norm regularization parameter.
  has_constant : `list`[`int`]
      A list of detected constant column indices by `intercept_checker`.
  constant_index : `list`[`int`]
      A list of constant column indices after preprocessing.
  non_penalize_index : `list`[`int`]
      A list of column indices whose corresponding regressors are not to be penalized.
  intercept_ : `float`
      The fitted intercept.
  coef_ : `numpy.array`
      The fitted coefficients.
class_docstr_tok: ["Class","to","implement","a","partially","regularized","regression",".","A","partially","regularized","regression","is","defined","as","beta_0",",","beta_1",",","beta_2","=","argmin","||y","-","X_0beta_0","-","X_1beta_1","-","X_2beta_2||_2^2","+","a_1","*","||beta_1||_1","+","a_2","*","||beta_2||_2^2","This","regression","formulation","allows","user","to","specify","which","regressor","to","have","what","type","of","regularization",".","For","example",",","in","automatic","changepoint","detection",",","``","ct1","''","should","not","be","penalized",",","yearly","seasonality","can","have","light","L2","norm","regularization",",","while","the","changepoint","regressors","need","L1","norm","regularization","to","be","sparse",".","Attributes","--","--","--","--","--","l1_index",":","`","list","`","[","`","int","`",",","`","str","`","]",",","default","None","The","index","of","columns","that","are","to","be","penalized","with","L1","norm",".","l1_alpha",":","`","float","`",",","default","0.001","The","L1","norm","regularization","parameter",".","l2_index",":","`","list","`","[","`","int","`",",","`","str","`","]",",","default","None","The","index","of","columns","that","are","to","be","penalized","with","L2","norm",".","l2_alpha",":","`","float","`",",","default","0.001","The","L2","norm","regularization","parameter",".","has_constant",":","`","list","`","[","`","int","`","]","A","list","of","detected","constant","column","indices","by","`","intercept_checker","`",".","constant_index",":","`","list","`","[","`","int","`","]","A","list","of","constant","column","indices","after","preprocessing",".","non_penalize_index",":","`","list","`","[","`","int","`","]","A","list","of","column","indices","whose","corresponding","regressors","are","not","to","be","penalized",".","intercept_",":","`","float","`","The","fitted","intercept",".","coef_",":","`","numpy.array","`","The","fitted","coefficients","."]
docstr: Preprocesses the input design matrix, the response vector, l1_index, l2_index and constant columns.
  
  Parameters
  ----------
  x : `numpy.array` or `pandas.DataFrame`
      The design matrix.
  y : `numpy.array`, `pandas.DataFrame` or `pandas.Series`
      The response vector.
  
  Returns
  -------
  x : `numpy.array`
      The processed design matrix.
  y : `numpy.array`
      The processed response vector.
docstr_tok: ["Preprocesses","the","input","design","matrix",",","the","response","vector",",","l1_index",",","l2_index","and","constant","columns",".","Parameters","--","--","--","--","--","x",":","`","numpy.array","`","or","`","pandas.DataFrame","`","The","design","matrix",".","y",":","`","numpy.array","`",",","`","pandas.DataFrame","`","or","`","pandas.Series","`","The","response","vector",".","Returns","--","--","--","-","x",":","`","numpy.array","`","The","processed","design","matrix",".","y",":","`","numpy.array","`","The","processed","response","vector","."]
code: def _check_input(self, x, y):
      """Preprocesses the input design matrix, the response vector, l1_index, l2_index and constant columns.
  
      Parameters
      ----------
      x : `numpy.array` or `pandas.DataFrame`
          The design matrix.
      y : `numpy.array`, `pandas.DataFrame` or `pandas.Series`
          The response vector.
  
      Returns
      -------
      x : `numpy.array`
          The processed design matrix.
      y : `numpy.array`
          The processed response vector.
      """
      if self.l1_index is None:
          self.l1_index = []
      if self.l2_index is None:
          self.l2_index = []
      if isinstance(x, pd.DataFrame):
          columns = x.columns
      else:
          columns = []
      if not all([isinstance(x, int) for x in self.l1_index]):
          l1_index = [
              i for i, col in enumerate(columns) if col in self.l1_index
          ]
          if len(l1_index) != len(self.l1_index):
              raise ValueError(
                  "l1_index takes either a list of integer indices or a list of "
                  "a subset of the columns names in x (if x is pandas.DataFrame)."
              )
          self.l1_index = l1_index
      if not all([isinstance(x, int) for x in self.l2_index]):
          l2_index = [
              i for i, col in enumerate(columns) if col in self.l2_index
          ]
          if len(l2_index) != len(self.l2_index):
              raise ValueError(
                  "l2_index takes either a list of integer indices or a list of "
                  "a subset of the columns names in x (if x is pandas.DataFrame)."
              )
          self.l2_index = l2_index
      if isinstance(x, pd.DataFrame):
          x = x.values
      if isinstance(y, Union[pd.DataFrame, pd.Series].__args__):
          y = y.values
      self.has_constant = constant_col_finder(x)
      if not self.has_constant:
          x = np.concatenate([x, np.ones([x.shape[0], 1])], axis=1)
          self.constant_index = x.shape[1] - 1
      else:
          self.constant_index = self.has_constant
      self.non_penalize_index = [
          i
          for i in range(x.shape[1])
          if i not in self.l1_index and i not in self.l2_index
      ]
      return x, y
  
imports: from typing import Union
  import numpy
  import pandas
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.linear_model import Lasso
  from sklearn.linear_model import LassoCV
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import Ridge
  from sklearn.linear_model import RidgeCV
  from sklearn.linear_model._coordinate_descent import _alpha_grid
  from sklearn.model_selection import check_cv
  from greykite.common.python_utils import ignore_warnings
label_desc: Use image node_id 4 for calling the PartialRegularizeRegression obj's underlying member method code with example usage: obj._check_input(x, y) and returns: x,  y