Comments (6)
meet the same error
from m2cgen.
Debugging into m2cgen
code, maybe I managed to find a workaround for my case (export a native Booster
to C and Python code), but I do not know if it works for other cases.
If the base_score
parameter of the classifier is forced to 0 (the default value in the latest version is None
), the check is passed and both Python and C code are generated.
# booster is already trained
temp_file = "temp.ubj"
booster.save_model(temp_file)
xgbclf = xgb.XGBClassifier()
xgbclf.load_model(temp_file)
os.remove(temp_file)
xgbclf.base_score = 0 # workaround
c_code = m2c.export_to_c(xgbclf)
py_code = m2c.export_to_python(xgbclf)
from m2cgen.
Encountering the same error. This is a breaking change for my pipeline. Any ideas here?
from m2cgen.
Encountering the same error. This is a breaking change for my pipeline. Any ideas here?
Yep, it is breaking for me too, I hope for some updates from the developer...
from m2cgen.
Taking a look at m2cgen/assemblers/boosting.py
(line 78:80), I think the problem depends on self._base_score
being None
for some reason in the latest XGBoost model version, so the check if self._base_score != 0.0
is passed and the next instruction fails base_score = -math.log(1.0 / self._base_score - 1.0)
.
Maybe this model field has been renamed or removed, I will check it out and update this issue.
from m2cgen.
Debugging into
m2cgen
code, maybe I managed to find a workaround for my case (export a nativeBooster
to C and Python code), but I do not know if it works for other cases.If the
base_score
parameter of the classifier is forced to 0 (the default value in the latest version isNone
), the check is passed and both Python and C code are generated.# booster is already trained temp_file = "temp.ubj" booster.save_model(temp_file) xgbclf = xgb.XGBClassifier() xgbclf.load_model(temp_file) os.remove(temp_file) xgbclf.base_score = 0 # workaround c_code = m2c.export_to_c(xgbclf) py_code = m2c.export_to_python(xgbclf)
This works for me. Thanks!
from m2cgen.
Related Issues (20)
- The converted C model compiles very slow,how can i fix it?
- Unable to export LGBM model that uses `categorical_feature` HOT 2
- Convert ML model to c# HOT 2
- Issue with xgboost export in python: not same values splits HOT 1
- Getting predict_prob when convert m2cgen to different languages
- Feature Request: support for multioutput regression HOT 1
- Process ended with exit code -1073741571 (0xC00000FD) HOT 1
- Results dont match
- Add Fortran
- LightGBM models
- How to use model for jpg photo?
- Issue while Exporting a LightGBM Model to C#
- XGBoost exported to C generates wrong indices for input array
- Logitraw objective function ignored for xgb.Booster
- Cannot export XGBClassifier model: TypeError: unsupported operand type(s) for /: 'float' and 'NoneType' HOT 4
- Memory overflow in program run after compilation of C code transformed by the xgboost model HOT 1
- Cannot export XGBClassifier model: TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
- XGBoost GCC Memory Allocation Error: cc1plus.exe: out of memory allocating 65536 bytes
- xgbmodel is larger than 500M, convert to c, always Segmentation fault
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m2cgen.