matheusfacure / python-causality-handbook

Causal Inference for the Brave and True. A light-hearted yet rigorous approach to learning about impact estimation and causality.
https://matheusfacure.github.io/python-causality-handbook/landing-page.html
MIT License
2.74k stars 475 forks source link

Chapter 15 #201

Closed dimitris1ps closed 2 years ago

dimitris1ps commented 2 years ago

There is an issue on chapter 15, at making-inference the function synthetic_control has a redundant parameter. More specifically you don't need the pool parameter in

def synthetic_control(state: int, pool: List[int], data: pd.DataFrame) -> np.array:

Also, it needs to be removed from the subsequent calls

control_pool = cigar["state"].unique()

synthetic_control(1, control_pool, cigar).head()

parallel_fn = delayed(partial(synthetic_control, pool=control_pool, data=cigar))

All control_pool are not needed since they are not used within the synthetic_control function.

the function should just be

def synthetic_control(state: int,  data: pd.DataFrame) -> np.array:
matheusfacure commented 2 years ago

Nice! Thanks for the tip!