py-why / py-why/EconML

Bug when passing featurizer that requires more than 1 row in SparseLinearDrLearner

Open
#905 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.8k
Forks
827
PR merge metrics
No merged PRs in 30d

Description

in file econml/utilities.py:75 (function name check_high_dimensional):

d_x = clone(featurizer, safe=False).fit_transform(X[[0], :]).shape[1]

when passing a transformer such as SplineTransformer, it raises an error:

ValueError: Found array with 1 sample(s) (shape=(1, 1)) while a minimum of 2 is required by SplineTransformer.

from what I understand this line only runs to infer the number of rows out, but it fails the whole fit process.
this would also fail for transformers as OneHotEncoder as the number of new rows is dependent on the data

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in econml/utilities.py at check_high_dimensional and trace how SparseLinearDrLearner calls it. Compare the behavior of the mentioned SplineTransformer and OneHotEncoder cases, then verify that fitting no longer fails for transformers requiring multiple rows and that the inferred output dimensionality remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, scikit-learn
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.