class_docstr: Implements the cross-validation version of
  `~greykite.algo.common.partial_regularize_regression.PartialRegularizeRegression`.
  
  Attributes
  ----------
  l1_index : `list`[`int`, `str`], default None
      The index of columns that are to be penalized with L1 norm.
  l1_alphas : `list`[`float`], default None
      The L1 norm regularization parameters.
  n_l1_alphas : `int`, default 50.
      The number of L1 norm regularization parameters. Will not be used if `l1_alphas` is provided.
  l2_index : `list`[`int`, `str`], default None
      The index of columns that are to be penalized with L2 norm.
  l2_alphas : `list`[`float`], default (0.001, 0.1, 10)
      The L2 norm regularization parameter.
  cv : `int`, cross-validation generator, or iterable, default 5
      Determines the cross-validation splitting strategy. This is the same as the ``cv`` in `sklearn` modules.
      Possible inputs for cv are:
          - None, to use the default 5-fold cross validation,
          - integer, to specify the number of folds.
          - :term:`CV splitter`,
          - An iterable yielding (train, test) splits as arrays of indices.
  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.
  best_model : `~greykite.algo.common.partial_regularize_regression.PartialRegularizeRegression`
      The best model selected by cross validation.
  best_mse : `float`
      The best cross-validated test mse.
  l1_alpha_ : `float`
      The best L1 norm regularization parameter.
  l2_alpha_ : `float`
      The best L2 norm regularization parameter.
  intercept_ : `float`
      The fitted intercept.
  coef_ : `numpy.array`
      The fitted coefficients.
class_docstr_tok: ["Implements","the","cross-validation","version","of","`","~greykite.algo.common.partial_regularize_regression.PartialRegularizeRegression","`",".","Attributes","--","--","--","--","--","l1_index",":","`","list","`","[","`","int","`",",","`","str","`","]",",","default","None","The","index","of","columns","that","are","to","be","penalized","with","L1","norm",".","l1_alphas",":","`","list","`","[","`","float","`","]",",","default","None","The","L1","norm","regularization","parameters",".","n_l1_alphas",":","`","int","`",",","default","50",".","The","number","of","L1","norm","regularization","parameters",".","Will","not","be","used","if","`","l1_alphas","`","is","provided",".","l2_index",":","`","list","`","[","`","int","`",",","`","str","`","]",",","default","None","The","index","of","columns","that","are","to","be","penalized","with","L2","norm",".","l2_alphas",":","`","list","`","[","`","float","`","]",",","default","(","0.001",",","0.1",",","10",")","The","L2","norm","regularization","parameter",".","cv",":","`","int","`",",","cross-validation","generator",",","or","iterable",",","default","5","Determines","the","cross-validation","splitting","strategy",".","This","is","the","same","as","the","``","cv","``","in","`","sklearn","`","modules",".","Possible","inputs","for","cv","are",":","-","None",",","to","use","the","default","5-fold","cross","validation",",","-","integer",",","to","specify","the","number","of","folds",".","-",":","term",":","`","CV","splitter","`",",","-","An","iterable","yielding","(","train",",","test",")","splits","as","arrays","of","indices",".","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",".","best_model",":","`","~greykite.algo.common.partial_regularize_regression.PartialRegularizeRegression","`","The","best","model","selected","by","cross","validation",".","best_mse",":","`","float","`","The","best","cross-validated","test","mse",".","l1_alpha_",":","`","float","`","The","best","L1","norm","regularization","parameter",".","l2_alpha_",":","`","float","`","The","best","L2","norm","regularization","parameter",".","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 sub-list of "
                  "columns 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 sub-list of "
                  "columns in x (if x is pandas.DataFrame)."
              )
          self.l2_index = l2_index
      if (
          len(
              [
                  x
                  for x in range(x.shape[1])
                  if x in self.l1_index and x in self.l2_index
              ]
          )
          > 0
      ):
          raise ValueError("l1_index and l2_index can not overlap.")
      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 PartialRegularizeRegressionCV obj's underlying member method code with example usage: obj._check_input(x, y) and returns: x,  y