catenets.models.torch.utils.transformations module

Unbiased Transformations for CATE

dr_transformation_cate(y: torch.Tensor, w: torch.Tensor, p: torch.Tensor, mu_0: torch.Tensor, mu_1: torch.Tensor) torch.Tensor

Transforms data to efficient influence function/aipw pseudo-outcome for CATE estimation

Parameters
  • y (array-like of shape (n_samples,) or (n_samples, )) – The observed outcome variable

  • w (array-like of shape (n_samples,)) – The observed treatment indicator

  • p (array-like of shape (n_samples,)) – The treatment propensity, estimated or known. Can be None, then p=0.5 is assumed

  • mu_0 (array-like of shape (n_samples,)) – Estimated or known potential outcome mean of the control group

  • mu_1 (array-like of shape (n_samples,)) – Estimated or known potential outcome mean of the treatment group

Returns

EIF transformation for CATE

Return type

d_hat

pw_transformation_cate(y: torch.Tensor, w: torch.Tensor, p: Optional[torch.Tensor] = None, mu_0: Optional[torch.Tensor] = None, mu_1: Optional[torch.Tensor] = None) torch.Tensor

Transform data to Horvitz-Thompson transformation for CATE :param y: The observed outcome variable :type y: array-like of shape (n_samples,) or (n_samples, ) :param w: The observed treatment indicator :type w: array-like of shape (n_samples,) :param p: The treatment propensity, estimated or known. Can be None, then p=0.5 is assumed :type p: array-like of shape (n_samples,) :param mu_0: Estimated or known potential outcome mean of the control group. Placeholder, not used. :type mu_0: array-like of shape (n_samples,) :param mu_1: Estimated or known potential outcome mean of the treatment group. Placeholder, not used. :type mu_1: array-like of shape (n_samples,)

Returns

res – Horvitz-Thompson transformed data

Return type

array-like of shape (n_samples,)

ra_transformation_cate(y: torch.Tensor, w: torch.Tensor, p: torch.Tensor, mu_0: torch.Tensor, mu_1: torch.Tensor) torch.Tensor

Transform data to regression adjustment for CATE

Parameters
  • y (array-like of shape (n_samples,) or (n_samples, )) – The observed outcome variable

  • w (array-like of shape (n_samples,)) – The observed treatment indicator

  • p (array-like of shape (n_samples,)) – Placeholder, not used. The treatment propensity, estimated or known.

  • mu_0 (array-like of shape (n_samples,)) – Estimated or known potential outcome mean of the control group

  • mu_1 (array-like of shape (n_samples,)) – Estimated or known potential outcome mean of the treatment group

Returns

res – Regression adjusted transformation

Return type

array-like of shape (n_samples,)

u_transformation_cate(y: torch.Tensor, w: torch.Tensor, p: torch.Tensor, mu: torch.Tensor) torch.Tensor

Transform data to U-transformation (described in Kuenzel et al, 2019, Nie & Wager, 2017) which underlies both R-learner and U-learner

Parameters
  • y (array-like of shape (n_samples,) or (n_samples, )) – The observed outcome variable

  • w (array-like of shape (n_samples,)) – The observed treatment indicator

  • p (array-like of shape (n_samples,)) – Placeholder, not used. The treatment propensity, estimated or known.

  • mu_0 (array-like of shape (n_samples,)) – Estimated or known potential outcome mean of the control group

  • mu_1 (array-like of shape (n_samples,)) – Estimated or known potential outcome mean of the treatment group

Returns

res – Regression adjusted transformation

Return type

array-like of shape (n_samples,)