Join GitHub today
second step in building a Shapley's decomposition framework (also address many tweaks, typos, etc.) #16
Folks, this is a second step to build a decomposition framework for the segregation module. Since each of the three counterfactual approaches are very different in terms of generation of the counterfactual populations, I chose to slightly change the previous function building a function (_generate_counterfactual) that returns always the counterfactual group population and the counterfactual total population (note that each of these variables can be generated differently in the generation of each approach, so this facilitates). With this, the _decompose_index can have a more generic structure that facilitates each of the approaches. Finally, I chose to build a 'Decompose_Segregation' class with c_s and c_a attribute of the shapley's decomposition.
I put the "auxiliary" function that generates the counterfactuals in the util.py, because I think we can derive all the methods from the 'mother' class I'm proposing.
I tested all functions with the data of our comparative paper and everything is matching. The way we're recovering the counterfactual value is that elegant one with the
I think the next step is to build appropriate doctests, plotting method for this class (maps and cfds) (taking advantage of the plotting function already built), notebooks, etc.
It also addresses
Please, let me know if you're ok with this structure I'm proposing.
ps.: you can ignore the first two commits cause this was to just to check my github syncronization.
Hey, folks, could any of you take a look at this PR to see if it is ok the merge it (@sjsrey or @knaaptime )? I wanted to open another PR for a different task (related to centralization indexes) but I accidentally committed in this branch (but didn't push yet), I should have created a specific branch for this more recent task...
BTW, Eli, the typo of tracks -> tracts is already contemplated in this current PR.