py-why / py-why/EconML

Saved DRBest model pickle doesn't work at another server

Open
#1,018 0 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

Hi

I got trained DRLearner model here:

dr_best = DRLearner( 
 model_propensity=propensity_best, 
 model_regression=outcome_best, 
 model_final=final_best, 
 categories='auto', 
 discrete_outcome=True, 
 random_state=1, 
 cv=1 ) 

dr_best.fit(Y=Y_full, T=T_fulli, X=X_full)

I got 3 treatments and 1 control group.

After training I saved model with pickle.

At that point, everything is fine.

So whenever I try to load the model on differenet server I got this error:

NotFittedError: Estimator not fitted, call fit before exploiting the model.

After that I try to save models one by one (extracting sklearn wrapper and reach the models) but I couldnt get the same predictions (I use model.effect() in order to get scores).

I asked this situation to ChatGPT and I got this answer:

Because:

LightGBM booster C++ binary
Pickle doesn't guarantee binary compatibility

Therefore, this happens:
"The model was fitted, but it's not considered fitted here"
This is a transport problem, not a training problem.

I also checked the environment library versions of both server, everthing is same. So 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 provided DRLearner training, pickle save, and cross-server load sequence, then compare the reported library environments and the behavior of model.effect(). Done means identifying whether the failure is a supported serialization issue and documenting a reliable way to preserve predictions across servers, or documenting the compatibility limitation.

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.