Closed Vihagle closed 1 year ago
Can you "Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Jupyter notebook."?
OK, I have sent an email to lixf@sovon.net
with attachment, plz check~
I found code in your notebook:
treatment = ['CRIM']
instrument = ['RM']
why = Why(random_state=2022)
why.fit(data, 'Price', treatment = treatment, instrument = instrument)
The reason for this exception is that you set argument instrument
but not covariate
.
If you set any of the adjustment/covariate/instrument during fiting, Why
will skip identify
step, so you should also set the others.
try code below
treatment = ['CRIM']
instrument = ['RM']
covariate = [c for c in data.columns.tolist() if c not in treatment+instrument+['Price'] ]
why = Why(random_state=2022)
why.fit(data, 'Price', treatment = treatment, instrument = instrument, covariate=covariate)
Please make sure that this is a bug.
System information
pip list
):Describe the current behavior
instrument
, it prints bug as below:ValueError: Expected 2D array, got scalar array instead:
array=None.
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Describe the expected behavior
Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Jupyter notebook.
Are you willing to submit PR?(Yes/No)
Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.