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: Calculates the pearson non parametric partial R^2 from a regression function.
  
  :param X: numpy array containing set of regressors
  :param Y: outcome variable in regression
  :param numeric_features: list of indices of columns with numeric features
  :param split_indices: training and testing data indices obtained after cross folding
  
  :returns: partial R^2 value
docstr_tok: ["Calculates","the","pearson","non","parametric","partial","R^2","from","a","regression","function",".",":","param","X",":","numpy","array","containing","set","of","regressors",":","param","Y",":","outcome","variable","in","regression",":","param","numeric_features",":","list","of","indices","of","columns","with","numeric","features",":","param","split_indices",":","training","and","testing","data","indices","obtained","after","cross","folding",":","returns",":","partial","R^2","value"]
code: def get_regression_r2(
      self, X, Y, numeric_features, split_indices, regression_model=None
  ):
      """
      Calculates the pearson non parametric partial R^2 from a regression function.
  
      :param X: numpy array containing set of regressors
      :param Y: outcome variable in regression
      :param numeric_features: list of indices of columns with numeric features
      :param split_indices: training and testing data indices obtained after cross folding
  
      :returns: partial R^2 value
      """
      if regression_model is None:
          regression_model = get_generic_regressor(
              cv=split_indices,
              X=X,
              Y=Y,
              max_degree=self.reisz_polynomial_max_degree,
              estimator_list=self.g_s_estimator_list,
              estimator_param_list=self.g_s_estimator_param_list,
              numeric_features=numeric_features,
          )
  
      num_samples = X.shape[0]
      regression_pred = np.zeros(num_samples)
      for train, test in split_indices:
          reg_fn_fit = regression_model.fit(X[train], Y[train])
          regression_pred[test] = reg_fn_fit.predict(X[test])
  
      r2 = np.var(regression_pred) / np.var(Y)
  
      return r2
  
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 7 for calling the PartialLinearSensitivityAnalyzer obj's underlying member method code with example usage: obj.get_regression_r2(X, Y, numeric_features, split_indices, regression_model) and returns: r2