Inconsistent behavior between dowhy wrapper and wrapped model
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.8k
- Forks
- 827
- PR merge metrics
- No merged PRs in 30d
Description
For some reason the trained T and Y models exposed by the dowhy wrapper do not accept input of the correct shape, seeming to expect twice as many X columns as they should (e.g. with 3 X columns and 5 W columns, the error message will complain that 8 columns were supplied but 11 were expected):
model_dml = LinearDML(model_y=LinearRegression(),
model_t=LinearRegression())
d_x = 2
d_w = 5
N_SHAPE = 1000
Y = np.random.normal(size=N_SHAPE)
T = np.random.randint(2, size=N_SHAPE)
X = np.random.normal(size=(N_SHAPE, d_x))
W = np.random.randint(2, size=(N_SHAPE, d_w))
model_dml = model_dml.fit(Y=Y, T=T, X=X, W=W, inference='auto', cache_values=False)
model_dml_dowhy = model_dml.dowhy.fit(Y=Y, T=T, X=X, W=W, inference='auto', cache_values=False)
# works
model_dml.models_y[0][0].predict(np.concatenate((X, W), axis=1))
# This will error!
model_dml_dowhy.models_y[0][0].predict(np.concatenate((X, W), axis=1))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided LinearDML example, comparing predictions from models_y before and after accessing the dowhy wrapper. Trace the dowhy.fit path and the models_y predict entry point to identify why the wrapped model expects extra columns; done means correctly shaped X and W input behaves consistently in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100