code: def _infer_default_kappa_y(
      data: pd.DataFrame,
      target_estimand: IdentifiedEstimand,
      outcome_name: List[str],
      effect_on_y: str,
      frac_strength_outcome: float,
      len_kappa_y: int = 10,
  ):
      """Infer default effect strength of simulated confounder on treatment."""
      observed_common_causes_names = (
          target_estimand.get_backdoor_variables()
      )
      if len(observed_common_causes_names) > 0:
          observed_common_causes = data[observed_common_causes_names]
          observed_common_causes = pd.get_dummies(
              observed_common_causes, drop_first=True
          )
      else:
          raise ValueError(
              "There needs to be at least one common cause to"
              + "automatically compute the default value of kappa_y."
              + " Provide a value for kappa_y"
          )
      y = data[outcome_name]
      # Standardizing the data
      observed_common_causes = StandardScaler().fit_transform(
          observed_common_causes
      )
      if effect_on_y == "binary_flip":
          # Fit a model containing all confounders and compare predictions
          # using all features compared to all features except a given
          # confounder.
          ymodel = LogisticRegression().fit(observed_common_causes, y)
          ypred = ymodel.predict(observed_common_causes).astype(int)
          flips = []
          for i in range(observed_common_causes.shape[1]):
              oldval = np.copy(observed_common_causes[:, i])
              observed_common_causes[:, i] = 0
              ycap = ymodel.predict(observed_common_causes).astype(int)
              observed_common_causes[:, i] = oldval
              flips.append(np.sum(abs(ycap - ypred)) / ypred.shape[0])
          min_coeff, max_coeff = min(flips), max(flips)
      elif effect_on_y == "linear":
          corrcoef_var_y = np.corrcoef(
              observed_common_causes, y, rowvar=False
          )[-1, :-1]
          std_dev_y = np.std(y)[0]
          max_coeff = max(corrcoef_var_y) * std_dev_y
          min_coeff = min(corrcoef_var_y) * std_dev_y
      else:
          raise NotImplementedError(
              "'"
              + effect_on_y
              + "' method not supported for confounders' effect on outcome"
          )
      min_coeff, max_coeff = _compute_min_max_coeff(
          min_coeff, max_coeff, frac_strength_outcome
      )
      # By default, return a plot with 10 points
      # consider 10 values of the effect of the unobserved confounder
      step = (max_coeff - min_coeff) / len_kappa_y
      logger.info(
          "(Min, Max) kappa_y for observed common causes, ({0}, {1})".format(
              min_coeff, max_coeff
          )
      )
      if np.equal(max_coeff, min_coeff):
          return max_coeff
      else:
          return np.arange(min_coeff, max_coeff, step)
  
imports: import copy
  import logging
  import math
  from typing import Dict, List, Optional, Union
  import numpy
  import pandas
  import scipy.stats
  import statsmodels.api
  from sklearn.linear_model import LogisticRegression
  from sklearn.preprocessing import StandardScaler
  from tqdm.auto import tqdm
  from dowhy.causal_estimator import CausalEstimate
  from dowhy.causal_estimators.econml import Econml
  from dowhy.causal_estimators.linear_regression_estimator import LinearRegressionEstimator
  from dowhy.causal_estimators.regression_estimator import RegressionEstimator
  from dowhy.causal_identifier.identified_estimand import IdentifiedEstimand
  from dowhy.causal_refuter import CausalRefutation, CausalRefuter, choose_variables
  from dowhy.causal_refuters.evalue_sensitivity_analyzer import EValueSensitivityAnalyzer
  from dowhy.causal_refuters.linear_sensitivity_analyzer import LinearSensitivityAnalyzer
label_desc: Use image node_id 3 for calling a global function with example usage: _infer_default_kappa_y(data, target_estimand, outcome_name, effect_on_y, frac_strength_outcome, len_kappa_y) and returns: max_coeff, np