class_docstr: Implements the quantile regression model.
  
  Supports weighted sample, l1 regularization
  and weighted l1 regularization.
  These options can be configured to support different use cases.
  For example, specifying quantile to be 0.5 and sample weight to be the
  inverse absolute value of response minimizes the MAPE.
class_docstr_tok: ["Implements","the","quantile","regression","model",".","Supports","weighted","sample",",","l1","regularization","and","weighted","l1","regularization",".","These","options","can","be","configured","to","support","different","use","cases",".","For","example",",","specifying","quantile","to","be","0.5","and","sample","weight","to","be","the","inverse","absolute","value","of","response","minimizes","the","MAPE","."]
docstr: Checks validity of input.
  
  Parameters
  ----------
  x : `numpy.array`, `pandas.DataFrame` or `pandas.Series`
      The design matrix.
  y : `numpy.array`, `pandas.DataFrame` or `pandas.Series`
      The response vector.
  
  Returns
  -------
  x : `numpy.array`
      The processed x.
  y : `numpy.array`
      The processed y.
docstr_tok: ["Checks","validity","of","input",".","Parameters","--","--","--","--","--","x",":","`","numpy.array","`",",","`","pandas.DataFrame","`","or","`","pandas.Series","`","The","design","matrix",".","y",":","`","numpy.array","`",",","`","pandas.DataFrame","`","or","`","pandas.Series","`","The","response","vector",".","Returns","--","--","--","-","x",":","`","numpy.array","`","The","processed","x.","y",":","`","numpy.array","`","The","processed","y","."]
code: def _process_input(
      self, x: np.typing.ArrayLike, y: np.typing.ArrayLike
  ) -> [np.array, np.array]:
      """Checks validity of input.
  
      Parameters
      ----------
      x : `numpy.array`, `pandas.DataFrame` or `pandas.Series`
          The design matrix.
      y : `numpy.array`, `pandas.DataFrame` or `pandas.Series`
          The response vector.
  
      Returns
      -------
      x : `numpy.array`
          The processed x.
      y : `numpy.array`
          The processed y.
      """
      # Type conversion and value checks.
      if isinstance(x, (pd.DataFrame, pd.Series)):
          x = x.values
      if isinstance(y, (pd.DataFrame, pd.Series)):
          y = y.values
      if len(y.shape) > 1:
          log_message(
              message=f"A column-vector y was passed when a 1d array was expected. "
              f"Please change the shape of y to (n_samples,), "
              f"for example using ravel().",
              level=LoggingLevelEnum.WARNING,
          )
          y = y.ravel()
      self.n, self.p = x.shape
      if y.shape[0] != self.n:
          raise ValueError(
              f"The shapes of x and y do not match. "
              f"x has {self.n} observations while y has "
              f"{y.shape[0]} observations."
          )
      if self.quantile < 0 or self.quantile > 1:
          raise ValueError(
              f"Quantile q must be between 0.0 and 1.0, found {self.quantile}."
          )
      if self.sample_weight is None:
          self.sample_weight = np.ones(self.n)
      else:
          self.sample_weight = np.array(self.sample_weight).ravel()
          if self.sample_weight.shape[0] != self.n:
              raise ValueError(
                  f"The length of sample weight must match the number of observations"
                  f" {self.n}, but found {self.sample_weight.shape[0]}."
              )
      if self.feature_weight is None:
          self.feature_weight = np.ones(self.p)
      else:
          self.feature_weight = np.array(self.feature_weight).ravel()
          if self.feature_weight.shape[0] != self.p:
              raise ValueError(
                  f"The length of feature weight must match the number of features"
                  f" {self.p}, but found {self.feature_weight.shape[0]}."
              )
      if self.max_iter <= 0:
          raise ValueError(
              f"max_iter must be a positive integer, found {self.max_iter}."
          )
      if self.tol <= 0:
          raise ValueError(
              f"tol must be a positive number, found {self.tol}."
          )
  
      # Handles intercept and degenerate columns.
      # If ``self.fit_intercept`` is True,
      # the degenerate columns are dropped.
      # It will append an intercept column for the alpha = 0 case.
      # For the alpha > 0 case, the intercept is fitted separately.
      if self.fit_intercept:
          self.constant_cols = constant_col_finder(x)
          self.nonconstant_cols = [
              i for i in range(self.p) if i not in self.constant_cols
          ]
          if self.alpha == 0:
              x = np.concatenate(
                  [np.ones([self.n, 1]), x[:, self.nonconstant_cols]],
                  axis=1,
              )
  
      # If ``optimize_mape`` is ``True``, this overrides ``quantile`` and ``sample_weight``.
      if self.optimize_mape:
          log_message(
              message="The parameter 'optimize_mape' is set to 'True', "
              "ignoring the input 'quantile' and 'sample_weight', "
              "setting 'quantile' to 0.5 and 'sample_weight' to the inverse "
              "absolute values of the response.",
              level=LoggingLevelEnum.WARNING,
          )
          self.sample_weight = 1 / np.abs(y)
          self.quantile = 0.5
  
      return x, y
  
imports: from __future__ import annotations
  from typing import Dict
  from typing import Optional
  import cvxpy
  import numpy
  import pandas
  import scipy
  from sklearn.base import BaseEstimator
  from sklearn.base import RegressorMixin
  from greykite.algo.common.partial_regularize_regression import constant_col_finder
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
label_desc: Use image node_id 2 for calling the QuantileRegression obj's underlying member method code with example usage: obj._process_input(x, y) and returns: x,  y