-
Notifications
You must be signed in to change notification settings - Fork 6
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
xgboost output not matching #6
Comments
Also compiled xgboost c-api. The margin output matches correctly. Any idea what could be the issue is greatly appreciated. |
@hcho3 I have looked at similar issue you commented on, and tried everything. Am using the following package versions :
|
@kumarsameer Can you post your XGBoost model here? I'll try to debug the issue |
please find the replication example and modelfile(zip) attached. import xgboost as xgb
import treelite
import treelite_runtime
import numpy as np
test_data = [-1.62e+02, 3.63e+01, 1.00e+01, 6.00e+00, 1.10e+01, 7.00e+00,
1.00e+00, 3.00e+00, 0.00e+00, 2.00e+00, -1.00e+00, 3.30e+01,
7.70e+01, 3.90e+01, 1.11e+01, 1.30e+01, -9.00e+00, 0.00e+00,
-6.80e+01, 5.40e+01, 1.09e+02, -7.00e-01, -7.00e-01, -3.00e+00,
9.10e+01, -9.00e+00, -2.00e+00, 1.10e+01, 9.00e+00, 1.50e+01,
-1.20e+01, -1.80e+01, -6.20e+01, 6.55e+01, 4.50e+01, 5.90e+01,
1.00e-01, -2.00e+00, 3.00e+00, 1.80e+01, -6.00e+00, -1.80e+01,
-1.00e+00, 1.00e-01, -2.40e+00, 0.00e+00, 0.00e+00, 0.00e+00,
0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00,
0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00,
0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00, 0.00e+00]
modelfile = 'model9.bin'
model = treelite.Model.load(modelfile, model_format='xgboost')
model.export_lib('gcc', 'compiled.dylib', params={'parallel_comp': model.num_tree}, verbose=False)
predictor = treelite_runtime.Predictor(libpath='./compiled.dylib')
dmat = treelite_runtime.DMatrix(test_data)
print(f'Treelite: {predictor.predict(dmat,pred_margin=True)}')
bst = xgb.Booster()
bst.load_model('model9.bin')
dtrain = xgb.DMatrix(data=np.expand_dims(test_data,0))
print("bin :",bst.predict(dtrain,output_margin=True)) This is the output I get on my machine
|
The output matches if |
@hcho3 let me know if you need any help in replicating the issue ? |
Not sure if it helps, but one of the things i noticed is that the c++ xgboost api also matched only after i set the |
Hi y'all, Seeing the same issue here. Attaching a CSV of data and labels. The predictions for the first twenty rows are below - XGB at left, Treelite at right. I'm running Treelite version 3.1.0. I attached the XGBoost JSON and generated C code in the zip file. models.zip
|
The model was built in XGBoost with
|
And here's full replication code
|
I'm facing the same issue. Did you found any walkaround? |
output:
Every alternate margin output it matching.
The text was updated successfully, but these errors were encountered: