class_docstr: Represents an post nonlinear FCM, i.e. models of the form:
      Y = g(f(X) + N),
  where X are parent nodes of the target node Y, f an arbitrary prediction model expecting inputs from the
  parents X, N a noise variable and g an invertible function.
class_docstr_tok: ["Represents","an","post","nonlinear","FCM",",","i.e",".","models","of","the","form",":","Y","=","g","(","f","(","X",")","+","N",")",",","where","X","are","parent","nodes","of","the","target","node","Y",",","f","an","arbitrary","prediction","model","expecting","inputs","from","the","parents","X",",","N","a","noise","variable","and","g","an","invertible","function","."]
docstr: Reconstruct the noise given samples from (X, Y). This is done by:
  
      1. Transform Y via the inverse of g: g^-1(Y) = f(X) + N
      2. Return the residual g^-1(Y) - f(X)
  
  :param target_samples: Samples from the input X.
  :param parent_samples: Samples from the target Y.
  :return: The reconstructed noise based on the given samples.
docstr_tok: ["Reconstruct","the","noise","given","samples","from","(","X",",","Y",")",".","This","is","done","by",":","1",".","Transform","Y","via","the","inverse","of","g",":","g^-1","(","Y",")","=","f","(","X",")","+","N","2",".","Return","the","residual","g^-1","(","Y",")","-","f","(","X",")",":","param","target_samples",":","Samples","from","the","input","X.",":","param","parent_samples",":","Samples","from","the","target","Y.",":","return",":","The","reconstructed","noise","based","on","the","given","samples","."]
code: def estimate_noise(
      self, target_samples: np.ndarray, parent_samples: np.ndarray
  ) -> np.ndarray:
      """Reconstruct the noise given samples from (X, Y). This is done by:
  
          1. Transform Y via the inverse of g: g^-1(Y) = f(X) + N
          2. Return the residual g^-1(Y) - f(X)
  
      :param target_samples: Samples from the input X.
      :param parent_samples: Samples from the target Y.
      :return: The reconstructed noise based on the given samples.
      """
      target_samples, parent_samples = shape_into_2d(
          target_samples, parent_samples
      )
  
      return self._invertible_function.evaluate_inverse(
          target_samples
      ) - self._prediction_model.predict(parent_samples)
  
imports: import copy
  from abc import ABC, abstractmethod
  from typing import List, Optional
  import numpy
  from dowhy.gcm.ml import ClassificationModel, PredictionModel
  from dowhy.gcm.ml.regression import InvertibleFunction, SklearnRegressionModel
  from dowhy.gcm.util.general import is_categorical, is_discrete, shape_into_2d
label_desc: Use image node_id 3 for calling the PostNonlinearModel obj's underlying member method code with example usage: obj.estimate_noise(target_samples, parent_samples) and returns: unknown