metalearners.outcome_functions module

metalearners.outcome_functions.constant_treatment_effect(dim, tau, ulow=0, uhigh=1, rng=None)[source]

Generate a potential outcomes function with constant treatment effect.

\[f(x_i, w_i) = x_i' \beta_{control} + \sum_{k=1}^{n_v-1} \tau_k \cdot \mathcal{I}(\{w_i = k\})\]

where \(x_i\) is a vector of features, \(\tau\) a vector of treatment effects, \(w_i\) the treatment indicator, \(n_v\) the number of variants and

\[\beta_{control} \sim \mathcal{U}[u_l, u_h]\]

dim indicates the dimension of \(\beta\) and therefore it should be the number of numerical features plus the number of categories in all of the categorical features.

tau expects to be of size \(n_v-1\).

Parameters:
  • dim (int)

  • tau (float | ndarray)

  • ulow (float)

  • uhigh (float)

  • rng (Generator | None)

Return type:

Callable

metalearners.outcome_functions.no_treatment_effect(dim, n_variants=2, ulow=0, uhigh=1, rng=None)[source]

Generate a potential outcomes function with no treatment effect.

\[f(x_i, w_i) = x_i' \beta\]

where \(x_i\) is a vector of features and

\[\beta \sim \mathcal{U}[u_l, u_h]\]

dim indicates the dimension of \(\beta\) and therefore the number of numerical features plus the number of categories in all of the categorical features.

Parameters:
  • dim (int)

  • n_variants (int)

  • ulow (float)

  • uhigh (float)

  • rng (Generator | None)

Return type:

Callable

metalearners.outcome_functions.linear_treatment_effect(dim, n_variants=2, ulow=0, uhigh=1, rng=None)[source]

Generate a potential outcomes function with linear treatment effect.

\[f(x_i, w_i) = x_i' \beta_{control} + \sum_{k=1}^{n_v-1} \mathcal{I}(\{w_i = k\}) \cdot x_i' \beta^{(k)}\]

where \(x_i\) is a vector of features, \(w_i\) the treatment indicator, and

\[\beta_{control} \sim \mathcal{U}[u_l, u_h] \beta_{(k)} \sim \mathcal{U}[u_l, u_h]\]

dim indicates the dimension of \(\beta_{control}\) and \(\beta_{(k)}\) therefore it should be the number of numerical features plus the number of categories in all of the categorical features.

Parameters:
  • dim (int)

  • n_variants (int)

  • ulow (float)

  • uhigh (float)

  • rng (Generator | None)

Return type:

Callable