class_docstr: Implements a data generating process that returns data having quadratic relationship between the treatment, outcome and confounders
class_docstr_tok: ["Implements","a","data","generating","process","that","returns","data","having","quadratic","relationship","between","the","treatment",",","outcome","and","confounders"]
code: def generate_data(self, sample_size):
      self.weights = {}
      self.bias = {}
      weights = []
      bias = []
      treatment = []
      outcome = []
      y_treatment = []
      y_control = []
      confounder = np.random.randn(sample_size, len(self.confounder))
      effect_modifier = np.random.randn(
          sample_size, len(self.effect_modifier)
      )
      control_value = np.zeros((sample_size, len(self.treatment)))
      treatment_value = np.ones((sample_size, len(self.treatment)))
  
      if self.auto_gen:
          self.generation_process()
      treatment.append(
          np.matmul(confounder, self.weights["confounder=>treatment"])
          + np.random.randn(sample_size, len(self.treatment))
          + self.bias["confounder=>treatment"]
      )
  
      for i in range(QuadraticDataGeneratingProcess.POWER):
          outcome.append(
              np.matmul(confounder, self.weights["confounder=>outcome"])
              + np.matmul(
                  effect_modifier,
                  self.weights["effect_modifier=>outcome"],
              )
              + np.matmul(
                  treatment[0], self.weights["treatment=>outcome"]
              )
              + self.bias["confounder=>outcome"]
          )
          y_control.append(
              np.matmul(confounder, self.weights["confounder=>outcome"])
              + np.matmul(
                  effect_modifier,
                  self.weights["effect_modifier=>outcome"],
              )
              + np.matmul(
                  control_value, self.weights["treatment=>outcome"]
              )
              + self.bias["confounder=>outcome"]
          )
          y_treatment.append(
              np.matmul(confounder, self.weights["confounder=>outcome"])
              + np.matmul(
                  effect_modifier,
                  self.weights["effect_modifier=>outcome"],
              )
              + np.matmul(
                  treatment_value, self.weights["treatment=>outcome"]
              )
              + self.bias["confounder=>outcome"]
          )
  
          weights.append(self.weights)
          bias.append(self.bias)
          if self.auto_gen:
              self.generation_process()
  
      treatment = treatment[0]  # treatment[1]
      if self.treatment_is_binary:
          treatment = self.convert_to_binary(treatment)
  
      outcome = outcome[0] * outcome[1]
      y_control = y_control[0] * y_control[1]
      y_treatment = y_treatment[0] * y_treatment[1]
      self.true_value = np.mean(y_treatment - y_control, axis=0)
  
      self.weights = weights
      self.bias = bias
  
      return pd.DataFrame(
          np.hstack((effect_modifier, confounder, treatment, outcome)),
          columns=self.effect_modifier
          + self.confounder
          + self.treatment
          + self.outcome,
      )
  
file_path: dowhy/dowhy/utils/dgps/quadratic_dgp.py
imports: import numpy
  import pandas
  from dowhy.utils.dgp import DataGeneratingProcess
label_desc: Use image node_id 2 for calling the QuadraticDataGeneratingProcess obj's underlying member method code with example usage: obj.generate_data(sample_size) and returns: pd