class_docstr: Class to perform sensitivity analysis for partially linear model.
  
  An efficient version of the non parametric sensitivity analyzer that works for estimators that return residuals of regression from confounders on treatment and outcome, such as the DML method. For all other methods (or when the partially linear assumption is not guaranteed to be satisfied), use the non-parametric sensitivity analysis.
  
  Based on this work:
      Chernozhukov, V., Cinelli, C., Newey, W., Sharma, A., & Syrgkanis, V. (2022). Long Story Short: Omitted Variable Bias in Causal Machine Learning (No. w30302). National Bureau of Economic Research.
  
  :param estimator: estimator of the causal model
  :param num_splits: number of splits for cross validation. (default = 5)
  :param shuffle_data : shuffle data or not before splitting into folds (default = False)
  :param shuffle_random_seed: seed for randomly shuffling data
  :param effect_strength_treatment: C^2_T, list of plausible sensitivity parameters for effect of confounder on treatment
  :param effect_strength_outcome: C^2_Y, list of plausible sensitivity parameters for effect of confounder on outcome
  :param benchmark_common_causes: names of variables for bounding strength of confounders
  :param significance_level: confidence interval for statistical inference(default = 0.05)
  :param frac_strength_treatment: strength of association between unobserved confounder and treatment compared to benchmark covariate
  :param frac_strength_outcome: strength of association between unobserved confounder and outcome compared to benchmark covariate
  :param g_s_estimator_list: list of estimator objects for finding g_s. These objects should have fit() and predict() functions.
  :param g_s_estimator_param_list: list of dictionaries with parameters for tuning respective estimators in "g_s_estimator_list".
  :param alpha_s_estimator_list: list of estimator objects for finding the treatment predictor which is used for alpha_s estimation. These objects should have fit() and predict_proba() functions.
  :param alpha_s_estimator_param_list: list of dictionaries with parameters for tuning respective estimators in "alpha_s_estimator_list".
                                   The order of the dictionaries in the list should be consistent with the estimator objects order in "g_s_estimator_list"
  :param observed_common_causes: common causes dataframe
  :param outcome: outcome dataframe
  :param treatment: treatment dataframe
class_docstr_tok: ["Class","to","perform","sensitivity","analysis","for","partially","linear","model",".","An","efficient","version","of","the","non","parametric","sensitivity","analyzer","that","works","for","estimators","that","return","residuals","of","regression","from","confounders","on","treatment","and","outcome",",","such","as","the","DML","method",".","For","all","other","methods","(","or","when","the","partially","linear","assumption","is","not","guaranteed","to","be","satisfied",")",",","use","the","non-parametric","sensitivity","analysis",".","Based","on","this","work",":","Chernozhukov",",","V.",",","Cinelli",",","C.",",","Newey",",","W.",",","Sharma",",","A.",",","&","Syrgkanis",",","V.","(","2022",")",".","Long","Story","Short",":","Omitted","Variable","Bias","in","Causal","Machine","Learning","(","No",".","w30302",")",".","National","Bureau","of","Economic","Research",".",":","param","estimator",":","estimator","of","the","causal","model",":","param","num_splits",":","number","of","splits","for","cross","validation",".","(","default","=","5",")",":","param","shuffle_data",":","shuffle","data","or","not","before","splitting","into","folds","(","default","=","False",")",":","param","shuffle_random_seed",":","seed","for","randomly","shuffling","data",":","param","effect_strength_treatment",":","C^2_T",",","list","of","plausible","sensitivity","parameters","for","effect","of","confounder","on","treatment",":","param","effect_strength_outcome",":","C^2_Y",",","list","of","plausible","sensitivity","parameters","for","effect","of","confounder","on","outcome",":","param","benchmark_common_causes",":","names","of","variables","for","bounding","strength","of","confounders",":","param","significance_level",":","confidence","interval","for","statistical","inference","(","default","=","0.05",")",":","param","frac_strength_treatment",":","strength","of","association","between","unobserved","confounder","and","treatment","compared","to","benchmark","covariate",":","param","frac_strength_outcome",":","strength","of","association","between","unobserved","confounder","and","outcome","compared","to","benchmark","covariate",":","param","g_s_estimator_list",":","list","of","estimator","objects","for","finding","g_s",".","These","objects","should","have","fit","(",")","and","predict","(",")","functions",".",":","param","g_s_estimator_param_list",":","list","of","dictionaries","with","parameters","for","tuning","respective","estimators","in","``","g_s_estimator_list","''",".",":","param","alpha_s_estimator_list",":","list","of","estimator","objects","for","finding","the","treatment","predictor","which","is","used","for","alpha_s","estimation",".","These","objects","should","have","fit","(",")","and","predict_proba","(",")","functions",".",":","param","alpha_s_estimator_param_list",":","list","of","dictionaries","with","parameters","for","tuning","respective","estimators","in","``","alpha_s_estimator_list","''",".","The","order","of","the","dictionaries","in","the","list","should","be","consistent","with","the","estimator","objects","order","in","``","g_s_estimator_list","''",":","param","observed_common_causes",":","common","causes","dataframe",":","param","outcome",":","outcome","dataframe",":","param","treatment",":","treatment","dataframe"]
docstr: Plots and summarizes the sensitivity bounds as a contour plot, as they vary with the partial R^2 of the unobserved confounder(s) with the treatment and the outcome
  Two types of plots can be generated, based on adjusted estimates or adjusted t-values
  X-axis: Partial R^2 of treatment and unobserved confounder(s)
  Y-axis: Partial R^2 of outcome and unobserved confounder(s)
  We also plot bounds on the partial R^2 of the unobserved confounders obtained from observed covariates
  
  :param plot_type: possible values are 'bias','lower_ate_bound','upper_ate_bound','lower_confidence_bound','upper_confidence_bound'
  :param plot_size: tuple denoting the size of the plot (default = (7,7))
  :param contours_color: color of contour line (default = blue)
                  String or array. If array, lines will be plotted with the specific color in ascending order.
  :param critical_contour_color: color of threshold line (default = red)
  :param label_fontsize: fontsize for labelling contours (default = 9)
  :param contour_linewidths: linewidths for contours (default = 0.75)
  :param contour_linestyles: linestyles for contours (default = "solid")
                          See : https://matplotlib.org/3.5.0/gallery/lines_bars_and_markers/linestyles.html for more examples
  :param contours_label_color: color of contour line label (default = black)
  :param critical_label_color: color of threshold line label (default = red)
  :param unadjusted_estimate_marker: marker type for unadjusted estimate in the plot (default = 'D')
                                  See: https://matplotlib.org/stable/api/markers_api.html
  :param unadjusted_estimate_color: marker color for unadjusted estimate in the plot (default = "black")
  :param adjusted_estimate_marker: marker type for bias adjusted estimates in the plot (default = '^')
  :parm adjusted_estimate_color: marker color for bias adjusted estimates in the plot (default = "red")
  :param legend_position:tuple denoting the position of the legend (default = (1.6, 0.6))
docstr_tok: ["Plots","and","summarizes","the","sensitivity","bounds","as","a","contour","plot",",","as","they","vary","with","the","partial","R^2","of","the","unobserved","confounder","(","s",")","with","the","treatment","and","the","outcome","Two","types","of","plots","can","be","generated",",","based","on","adjusted","estimates","or","adjusted","t-values","X-axis",":","Partial","R^2","of","treatment","and","unobserved","confounder","(","s",")","Y-axis",":","Partial","R^2","of","outcome","and","unobserved","confounder","(","s",")","We","also","plot","bounds","on","the","partial","R^2","of","the","unobserved","confounders","obtained","from","observed","covariates",":","param","plot_type",":","possible","values","are","'bias","'",",","'lower_ate_bound","'",",","'upper_ate_bound","'",",","'lower_confidence_bound","'",",","'upper_confidence_bound'",":","param","plot_size",":","tuple","denoting","the","size","of","the","plot","(","default","=","(","7,7",")",")",":","param","contours_color",":","color","of","contour","line","(","default","=","blue",")","String","or","array",".","If","array",",","lines","will","be","plotted","with","the","specific","color","in","ascending","order",".",":","param","critical_contour_color",":","color","of","threshold","line","(","default","=","red",")",":","param","label_fontsize",":","fontsize","for","labelling","contours","(","default","=","9",")",":","param","contour_linewidths",":","linewidths","for","contours","(","default","=","0.75",")",":","param","contour_linestyles",":","linestyles","for","contours","(","default","=","``","solid","''",")","See",":","https",":","\/\/matplotlib.org\/3.5.0\/gallery\/lines_bars_and_markers\/linestyles.html","for","more","examples",":","param","contours_label_color",":","color","of","contour","line","label","(","default","=","black",")",":","param","critical_label_color",":","color","of","threshold","line","label","(","default","=","red",")",":","param","unadjusted_estimate_marker",":","marker","type","for","unadjusted","estimate","in","the","plot","(","default","=","'D","'",")","See",":","https",":","\/\/matplotlib.org\/stable\/api\/markers_api.html",":","param","unadjusted_estimate_color",":","marker","color","for","unadjusted","estimate","in","the","plot","(","default","=","``","black","''",")",":","param","adjusted_estimate_marker",":","marker","type","for","bias","adjusted","estimates","in","the","plot","(","default","=","'^","'",")",":","parm","adjusted_estimate_color",":","marker","color","for","bias","adjusted","estimates","in","the","plot","(","default","=","``","red","''",")",":","param","legend_position",":","tuple","denoting","the","position","of","the","legend","(","default","=","(","1.6",",","0.6",")",")"]
code: def plot(
      self,
      plot_type="lower_confidence_bound",
      plot_size=(7, 7),
      contours_color="blue",
      critical_contour_color="red",
      label_fontsize=9,
      contour_linewidths=0.75,
      contour_linestyles="solid",
      contours_label_color="black",
      critical_label_color="red",
      unadjusted_estimate_marker="D",
      unadjusted_estimate_color="black",
      adjusted_estimate_marker="^",
      adjusted_estimate_color="red",
      legend_position=(1.05, 1),
  ):
      """
      Plots and summarizes the sensitivity bounds as a contour plot, as they vary with the partial R^2 of the unobserved confounder(s) with the treatment and the outcome
      Two types of plots can be generated, based on adjusted estimates or adjusted t-values
      X-axis: Partial R^2 of treatment and unobserved confounder(s)
      Y-axis: Partial R^2 of outcome and unobserved confounder(s)
      We also plot bounds on the partial R^2 of the unobserved confounders obtained from observed covariates
  
      :param plot_type: possible values are 'bias','lower_ate_bound','upper_ate_bound','lower_confidence_bound','upper_confidence_bound'
      :param plot_size: tuple denoting the size of the plot (default = (7,7))
      :param contours_color: color of contour line (default = blue)
                      String or array. If array, lines will be plotted with the specific color in ascending order.
      :param critical_contour_color: color of threshold line (default = red)
      :param label_fontsize: fontsize for labelling contours (default = 9)
      :param contour_linewidths: linewidths for contours (default = 0.75)
      :param contour_linestyles: linestyles for contours (default = "solid")
                              See : https://matplotlib.org/3.5.0/gallery/lines_bars_and_markers/linestyles.html for more examples
      :param contours_label_color: color of contour line label (default = black)
      :param critical_label_color: color of threshold line label (default = red)
      :param unadjusted_estimate_marker: marker type for unadjusted estimate in the plot (default = 'D')
                                      See: https://matplotlib.org/stable/api/markers_api.html
      :param unadjusted_estimate_color: marker color for unadjusted estimate in the plot (default = "black")
      :param adjusted_estimate_marker: marker type for bias adjusted estimates in the plot (default = '^')
      :parm adjusted_estimate_color: marker color for bias adjusted estimates in the plot (default = "red")
      :param legend_position:tuple denoting the position of the legend (default = (1.6, 0.6))
      """
      critical_value = 0
  
      fig, ax = plt.subplots(1, 1, figsize=plot_size)
      ax.set_title("Sensitivity contour plot of %s" % plot_type)
      if self.is_partial_linear:
          ax.set_xlabel(
              "Partial R^2 of unobserved confounder with treatment"
          )
      else:
          ax.set_xlabel(
              "Fraction of the variance in Reisz function explained by unobserved confounder"
          )
      ax.set_ylabel("Partial R^2 of unobserved confounder with outcome")
      if self.effect_strength_treatment is None:
          # adding 1.1 as plotting margin  ensure that the benchmarked part is shown fully in plot
          x_limit = (1.1 * self.r2tu_w) if self.benchmarking else 0.99
          r2tu_w = np.arange(
              0.0, x_limit, x_limit / self.num_points_per_contour
          )
      else:
          x_limit = max(self.r2tu_w)
          r2tu_w = self.r2tu_w
      if self.effect_strength_outcome is None:
          # adding 1.1 as plotting margin  ensure that the benchmarked part is shown fully in plot
          y_limit = (1.1 * self.r2yu_tw) if self.benchmarking else 0.99
          r2yu_tw = np.arange(
              0.0, y_limit, y_limit / self.num_points_per_contour
          )
      else:
          y_limit = self.r2yu_tw[-1]
          r2yu_tw = self.r2yu_tw
      ax.set_xlim(-x_limit / 20, x_limit)
      ax.set_ylim(-y_limit / 20, y_limit)
  
      undjusted_estimates = None
      contour_values = np.zeros((len(r2yu_tw), len(r2tu_w)))
  
      for i in range(len(r2yu_tw)):
          y = r2yu_tw[i]
          for j in range(len(r2tu_w)):
              x = r2tu_w[j]
              benchmarking_results = self.perform_benchmarking(
                  r2yu_tw=y,
                  r2tu_w=x,
                  significance_level=self.significance_level,
                  is_partial_linear=self.is_partial_linear,
              )
              contour_values[i][j] = benchmarking_results[plot_type]
  
      contour_plot = ax.contour(
          r2tu_w,
          r2yu_tw,
          contour_values,
          colors=contours_color,
          linewidths=contour_linewidths,
          linestyles=contour_linestyles,
      )
      ax.clabel(
          contour_plot,
          inline=1,
          fontsize=label_fontsize,
          colors=contours_label_color,
      )
  
      if (
          critical_value >= contour_values.min()
          and critical_value <= contour_values.max()
          and plot_type != "bias"
      ):
          contour_plot = ax.contour(
              r2tu_w,
              r2yu_tw,
              contour_values,
              colors=critical_contour_color,
              linewidths=contour_linewidths,
              levels=[critical_value],
          )
          ax.clabel(
              contour_plot,
              [critical_value],
              inline=1,
              fontsize=label_fontsize,
              colors=critical_label_color,
          )
  
      # Adding unadjusted point estimate
      if (
          plot_type == "lower_confidence_bound"
          or plot_type == "upper_confidence_bound"
          or plot_type == "lower_ate_bound"
          or plot_type == "upper_ate_bound"
      ):
          ax.scatter(
              [0],
              [0],
              marker=unadjusted_estimate_marker,
              color=unadjusted_estimate_color,
              label="Unadjusted({:1.2f})".format(self.theta_s),
          )
  
      # Adding bounds to partial R^2 values for given strength of confounders
      if self.benchmarking:
          if self.frac_strength_treatment == self.frac_strength_outcome:
              signs = str(round(self.frac_strength_treatment, 2))
          else:
              signs = (
                  str(round(self.frac_strength_treatment, 2))
                  + "/"
                  + str(round(self.frac_strength_outcome, 2))
              )
          label = (
              signs
              + " X "
              + str(self.benchmark_common_causes)
              + " ({:1.2f}) ".format(self.results[plot_type][0])
          )
          ax.scatter(
              self.r2tu_w,
              self.r2yu_tw,
              color=adjusted_estimate_color,
              marker=adjusted_estimate_marker,
              label=label,
          )
  
      plt.margins()
      ax.legend(bbox_to_anchor=legend_position, loc="upper left")
      plt.show()
  
imports: import logging
  import matplotlib.pyplot
  import numpy
  import pandas
  import scipy
  from sklearn.compose import ColumnTransformer
  from sklearn.linear_model import Lasso, LinearRegression, Ridge, RidgeCV, SGDRegressor
  from sklearn.model_selection import KFold
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import StandardScaler
  from dowhy.causal_refuters.reisz import get_generic_regressor
  from dowhy.utils.regression import get_numeric_features
label_desc: Use image node_id 10 for calling the PartialLinearSensitivityAnalyzer obj's underlying member method code with example usage: obj.plot(plot_type, plot_size, contours_color, critical_contour_color, label_fontsize, contour_linewidths, contour_linestyles, contours_label_color, critical_label_color, unadjusted_estimate_marker, unadjusted_estimate_color, adjusted_estimate_marker, adjusted_estimate_color, legend_position) without return types