code: def generate_numerical_condition(
      X_ohe: np.ndarray,
      feature_names: List[str],
      category_map: Dict[int, List[str]],
      ranges: Dict[str, List[float]],
      immutable_features: List[str],
      conditional: bool = True,
  ) -> np.ndarray:
      """
      Generates numerical features conditional vector. For numerical features with a minimum value `a_min` and a
      maximum value `a_max`, we include in the conditional vector the values `-p_min`, `p_max`, where `p_min, p_max`
      are in [0, 1]. The range `[-p_min, p_max]` encodes a shift and scale-invariant representation of the interval
      `[a - p_min * (a_max - a_min), a + p_max * (a_max - a_min)], where `a` is the original feature value. During
      training, `p_min` and `p_max` are sampled from `Beta(2, 2)` for each unconstrained feature. Immutable features
      can be encoded by `p_min = p_max = 0` or listed in `immutable_features` list. Features allowed to increase or
      decrease only correspond to setting `p_min = 0` or `p_max = 0`, respectively. For example, allowing the ``'Age'``
      feature to increase by up to 5 years is encoded by taking `p_min = 0`, `p_max=0.1`, assuming the minimum age of
      10 and the maximum age of 60 years in the training set: `5 = 0.1 * (60 - 10)`.
  
      Parameters
      ----------
      X_ohe
          One-hot encoding representation of the element(s) for which the conditional vector will be generated.
          This argument is used to extract the number of conditional vector. The choice of `X_ohe` instead of a
          `size` argument is for consistency purposes with `categorical_cond` function.
      feature_names
          List of feature names. This should be provided by the dataset.
      category_map
          Dictionary of category mapping. The keys are column indexes and the values are lists containing the
          possible feature values.
      ranges:
          Dictionary of ranges for numerical features. Each value is a list containing two elements, first one
          negative and the second one positive.
      immutable_features
          Dictionary of immutable features. The keys are the column indexes and the values are booleans: ``True`` if
          the feature is immutable, ``False`` otherwise.
      conditional
          Boolean flag to generate a conditional vector. If ``False`` the conditional vector does not impose any
          restrictions on the feature value.
  
      Returns
      -------
      Conditional vector for numerical features.
      """
      num_cond = []
      size = X_ohe.shape[0]
  
      for feature_id, feature_name in enumerate(feature_names):
          # skip categorical features
          if feature_id in category_map:
              continue
  
          if feature_name in immutable_features:
              # immutable feature
              range_low, range_high = 0.0, 0.0
          else:
              range_low = (
                  ranges[feature_name][0]
                  if feature_name in ranges
                  else -1.0
              )
              range_high = (
                  ranges[feature_name][1]
                  if feature_name in ranges
                  else 1.0
              )
  
          # Check if the ranges are valid.
          if range_low > 0:
              raise ValueError(
                  f"Lower bound range for {feature_name} should be negative."
              )
          if range_high < 0:
              raise ValueError(
                  f"Upper bound range for {feature_name} should be positive."
              )
  
          # Generate lower and upper bound coefficients.
          coeff_lower = (
              np.random.beta(a=2, b=2, size=size).reshape(-1, 1)
              if conditional
              else np.ones((size, 1))
          )
          coeff_upper = (
              np.random.beta(a=2, b=2, size=size).reshape(-1, 1)
              if conditional
              else np.ones((size, 1))
          )
  
          # Generate lower and upper bound conditionals.
          num_cond.append(coeff_lower * range_low)
          num_cond.append(coeff_upper * range_high)
  
      # Construct numerical conditional vector by concatenating all numerical conditions.
      return np.concatenate(num_cond, axis=1)
  
imports: from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  from scipy.special import softmax
  from sklearn.compose import ColumnTransformer
  from sklearn.preprocessing import OneHotEncoder, StandardScaler
label_desc: Use image node_id 3 for calling a global function with example usage: generate_numerical_condition(X_ohe, feature_names, category_map, ranges, immutable_features, conditional) and returns: np