code: def _check_args(
      problem,
      X,
      Y,
      max_order,
      poly_order,
      bootstrap,
      subset,
      max_iter,
      l2_penalty,
      alpha,
      extended_base,
  ):
      """Validates all parameters to ensure that they are within the limits"""
      # Make sure Y, output array, is a matrix
      Y = Y.reshape(-1, 1)
  
      # Get dimensions of input-output
      N, d = X.shape
      y_row = Y.shape[0]
  
      # If parameter names are not defined
      if "names" not in problem:
          problem["names"] = [f"x_{i}" for i in range(d)]
  
      # If parameter bounds are not defined
      if "bounds" not in problem:
          problem["bounds"] = [
              [X[:, i].min(), X[:, i].max()] for i in range(d)
          ]
  
      # If parameter num_vars are not defined
      if "num_vars" not in problem:
          problem["num_vars"] = d
  
      # If the length of 'num_vars' in ProblemSpec != Columns in X matrix
      if "num_vars" in problem and problem["num_vars"] != d:
          raise ValueError(
              "Problem definition must be consistent with the number of dimension in matrix X"
          )
  
      # If the length of 'names' in ProblemSpec != Columns in X matrix
      if "names" in problem and len(problem["names"]) != d:
          raise ValueError(
              "Problem definition must be consistent with the number of dimension in matrix X"
          )
  
      # If the length of 'bounds' in ProblemSpec != Columns in X matrix
      if "bounds" in problem and len(problem["bounds"]) != d:
          raise ValueError(
              "Problem definition must be consistent with the number of dimension in matrix X"
          )
  
      # Now check input-output mismatch
      if d == 1:
          raise RuntimeError(
              "Matrix X contains only a single column: No point to do"
              " sensitivity analysis when d = 1."
          )
  
      if N < 300:
          raise RuntimeError(
              f"Number of samples in the input matrix X, {N}, is insufficient. Need at least 300."
          )
  
      if N != y_row:
          raise ValueError(
              f"Dimension mismatch. The number of outputs ({y_row}) should match"
              f" number of samples ({N})"
          )
  
      if max_order not in (1, 2, 3):
          raise ValueError(
              f"'max_order' key of options should be an integer with values of"
              f" 1, 2 or 3, got {max_order}"
          )
  
      # Important next check for max_order - as max_order relates to d
      if (d == 2) and (max_order > 2):
          max_order = 2
          warnings.warn(
              "max_order is set to 2 due to lack of third input factor"
          )
  
      if poly_order not in np.arange(1, 11):
          raise ValueError(
              "'poly_order' key of options should be an integer between 1 to 10."
          )
  
      if bootstrap not in np.arange(1, 101):
          raise ValueError(
              "'bootstrap' key of options should be an integer between 1 to 100."
          )
  
      if (bootstrap == 1) and (subset != y_row):
          subset = y_row
          warnings.warn(f"subset is set to {y_row} due to no bootstrap")
  
      if subset is None:
          subset = y_row // 2
      elif subset not in np.arange(300, N + 1):
          raise ValueError(
              f"'subset' key of options should be an integer between 300 and {N}, "
              f"the number of rows matrix X."
          )
  
      if alpha < 0.5 or alpha > 1.0:
          raise ValueError(
              "'alpha' key of options should be a float between 0.5 to 1.0"
          )
  
      if extended_base:
          max_iter = None
      else:
          if max_iter not in np.arange(100, 1000):
              raise ValueError(
                  "'max_iter' key of options should be between 100 and 1000"
              )
  
      if l2_penalty < 0.0 or l2_penalty > 10:
          raise ValueError(
              "'l2_penalty' key of options should be in between 0 and 10"
          )
  
      return Y, problem, subset, max_iter
  
imports: import math
  import warnings
  from typing import Dict, Tuple
  from types import MethodType
  from itertools import combinations, product
  from collections import defaultdict, namedtuple
  import numpy
  from pandas import DataFrame
  from numpy.linalg import det, pinv, matrix_rank
  from scipy.linalg import svd, LinAlgError, solve
  from scipy import stats, special
  from .None import common_args
  from ..util import read_param_file, ResultDict
label_desc: Use image node_id 2 for calling a global function with example usage: _check_args(problem, X, Y, max_order, poly_order, bootstrap, subset, max_iter, l2_penalty, alpha, extended_base) and returns: Y,  problem,  subset,  max_iter