Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different score after compiling a lightgbm model #115

Closed
AlexQie opened this issue Sep 17, 2019 · 5 comments
Closed

Different score after compiling a lightgbm model #115

AlexQie opened this issue Sep 17, 2019 · 5 comments

Comments

@AlexQie
Copy link

AlexQie commented Sep 17, 2019

I have a lightgbm model and I use treelite to compile a .so file, but they have different predict results:
image

and here is my code:

predictor = treelite.runtime.Predictor('./mymodel.so', verbose=True)
data = np.loadtxt('service/sample.txt')

batch = treelite.runtime.Batch.from_npy2d(data)
out_pred = predictor.predict(batch)

lgb_model = lgb.Booster(model_file=tree_file_path)
lgb_pred = lgb_model.predict(data)
print(out_pred)
print(lgb_pred)

and I have the following configuration:

>>> import treelite
>>> treelite.__version__
'0.32'
>>> import lightgbm
>>> lightgbm.__version__
'2.2.3'
>>> 
@hcho3
Copy link
Collaborator

hcho3 commented Sep 18, 2019

This is probably the same issue as #98 and #95. Treelite currently uses single-precision float (float) to store thresholds, whereas LightGBM models require double-precision floats (double). I'm working to fix the issue as part of 1.0 release (#111)

@eddy-avanan
Copy link

I have same issue with XGBoost

@shashankg7
Copy link

shashankg7 commented Jan 6, 2020

Hi,

I am facing the same issue (with a LightGBM ranking model).

Did we get this issue resolved?

Thanks

@xcTorres
Copy link

Also happened

@hcho3
Copy link
Collaborator

hcho3 commented Oct 24, 2020

The recent refactor (#196, #198, #199, #201, #203) added an option to use float64 data type, so that LightGBM models can be faithfully represented.

@hcho3 hcho3 closed this as completed Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants