py-why / py-why/EconML

Memory error SparseLinearDML

Open
#351 2 comments 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

Try to make a model with SparseLinearDML but get a memory error:

import numpy as np
from sklearn.preprocessing import PolynomialFeatures
from econml.dml import SparseLinearDML
from catboost import CatBoostClassifier, CatBoostRegressor

est = SparseLinearDML(model_y=CatBoostClassifier(max_depth=4,
                                                 n_estimators=10,
                                                 verbose=False
                                                ),
                      model_t=CatBoostRegressor(max_depth=4,
                                                 n_estimators=10,
                                                 verbose=False
                                                ),
                      linear_first_stages=False,
                      n_splits=2,
                      random_state=1,
                      discrete_treatment=False
                    )
N=5000000
cols = 150
train = np.random.random(size=(N, cols))
target = np.random.choice([0, 1], size=N, replace=True)
treatment =  np.random.choice([0, 100, 500, 1000, 5000], size=N, replace=True)
est.fit(target, treatment, X=train)

KernelNotResponding: Kernel died unexpectedly and has been restarted. If it's not coming back, please, try restarting from the main menu.

Working on 64 kernel threads and 500gb
Is there a limit on row or column number? Or maybe catboost is not a good choice for T and Y models..? How can I solve this problem?

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 by reproducing the reported SparseLinearDML.fit call with the supplied dataset dimensions and CatBoost models. Inspect the SparseLinearDML entry point and determine whether the kernel failure comes from a documented row or column limit, model configuration, or memory use during fitting. Done means identifying a reproducible cause and documenting or resolving the failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.