dmlc / dmlc/tl2cgen

xgboost output not matching

Open
#6 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
55
Forks
11
PR merge metrics
No merged PRs in 30d

Description

```python
if True:
filename = "ind/test/" + 'bnifty'+'_'+str(today)+".ind.ade"
adf = pd.read_csv(filename,index_col=False)
tdf = createTrainDf(adf)
dtrain = xgb.DMatrix(data=tdf[train_cols])
y_pred = model.predict(dtrain,output_margin=True)
print("live :",y_pred)

if True:
model.save_model("model.bin")
bst = xgb.Booster()
bst.load_model('model.bin')
print("bin :",bst.predict(dtrain,output_margin=True))

if True:
from treelite_runtime import Predictor,DMatrix
model_path="./tlite2"
bst_lite = treelite.Model.from_xgboost(model)
bst_lite.export_lib(toolchain='gcc',params = {},libpath=model_path, verbose=False)
predictor = Predictor(model_path, verbose=False)
dmat = DMatrix(tdf[train_cols])
print("treelite :",predictor.predict(dmat,pred_margin=True))
```

output:
```
live : [-1.0892507 -0.2221069 -0.28209284 0.01806552 0.16996847 -0.9235258 ]
bin : [-1.0892507 -0.2221069 -0.28209284 0.01806552 0.16996847 -0.9235258 ]
treelite : [-0.08823351 -0.2221069 -0.3661577 0.01806552 0.30945933 -0.9235258 ]
```

Every alternate margin output it matching.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.