I’m trying to replicate the counterfactual fairness paper( https://arxiv.org/pdf/1703.06856.pdf ) in Pyro. I have found a tutorial that mentioned the following steps: Convert the above model to an SCM. Call this "GroundTruthModel". It should explicitly represent K. In SCMs endogenous variables are deterministic functions of exogenous variables and parent endogenous variables. So sample the endogenous […]

Categories

## Train a model on synthetic data using Pyro

- Post author By Full Stack
- Post date December 14, 2020
- No Comments on Train a model on synthetic data using Pyro

- Tags 'f': 'F', 'p']) all_samples=[] for i in range(1000): trace = trace_handler.get_trace() R = trace.nodes['R']['value'] S = trace.nodes['S'][, 'p']) ProposedModel def ProposedModel(): #Nr = pyro.sample("Nr", "%s %s", (k) => (k, { l:l, 0.25]))) Ns = pyro.sample("Ns", 0.4]))) Nk = pyro.sample("Nk", dist.Categorical(torch.tensor([0.6, dist.Categorical(torch.tensor([0.75, dist.Delta(chi_1)) S = pyro.sample("S", dist.Delta(chi_2)) K = pyro.sample("K", dist.Delta(chi_3)) #Gval = K + 2.1* R + 3.3 * S + 0.5 * pyro.sample("g", dist.Delta(Gval)) Lval = K + 5.8 * R + 0.7 * S + 0.1 * pyro.sample("l", dist.Delta(Gval)) Lval = K + alpha_2 * R + beta_2 * S + gama_2 * pyro.sample("l", dist.Delta(Lval)) Fval = K + 2.3 * R + 1.0 * S + 0.3 * pyro.sample("f", dist.Delta(Lval)) Fval = K + alpha_3 * R + beta_3 * S + gama_3 * pyro.sample("f", dist.Delta(Lval)) trace_handler = pyro.poutine.trace(GroundTruthModel) samples = pd.DataFrame(columns=['R', dist.Delta(Lval)) trace_handler = pyro.poutine.trace(ProposedModel) samples = pd.DataFrame(columns=['R', dist.Delta(Nk)) Gval = K + 2.1* R + 3.3 * S + 0.5 * pyro.sample("g", dist.Delta(Nr)) S = pyro.sample("S", dist.Delta(Ns)) K = pyro.sample("K", dist.Normal(torch.tensor(0.), f: '' }, F]) samples.head() Can someone help me understand how to work on points 3 through 5, for the "abduction" part of the algorithm, g, G: 'G', gradient-based inference in Pyro will have problems with dist.Delta. So i suggest replacing it with PseudoDelta = partial(Normal, I'm trying to replicate the counterfactual fairness paper( https://arxiv.org/pdf/1703.06856.pdf ) in Pyro. I have found a tutorial that menti, ignore_index=True) all_samples.append([R, K, L)?, namely (https://latex.codecogs.com/png.latex?dpi150bg_whitefn_cmPU_RrSsLlGg, PP, s, scale=tensor(0.1)) but using the same weights you got during training (do this conversion before training if it makes it easier). Here is my, torch.tensor(1.))) F = pyro.sample("F", torch.tensor(1.))) G = pyro.sample("G", torch.tensor(1.))) Gval = K + alpha_1* R + beta_1 * S + gama_1 * pyro.sample("g", torch.tensor(1.))) L = pyro.sample("L", torch.tensor(1.))) Nr = Nr.type(torch.FloatTensor) Ns = Ns.type(torch.FloatTensor) Nk = Nk.type(torch.FloatTensor), use the action-abduction-inference algorithm (use both the condition operator and the do operator) to infer the counterfactual quantities of