Comments (4)
Hey @beojan, thanks for reporting this issue! Can you please provide a bit more info on what algorithm caused that with what set of hyperparameters so that we can attempt to reproduce it locally.
UPD: The error with which gcc fails will be helpful too!
from m2cgen.
I'm using an XGBClassifier
with max_depth=10
, n_estimators=500
, learning_rate=0.2
, max_delta_step=15
.
There are 5 floating point features.
from m2cgen.
@beojan I've attempted to reproduce the issue in the following way:
- I trained an XGBoost Classifier using the Breast Cancer dataset from
scikit-learn
(30 floating point features) and hyper parameters that you've provided:
>>> from sklearn import datasets
>>> import xgboost
>>> dataset = datasets.load_breast_cancer()
>>> X, y = dataset.data, dataset.target
>>> model = xgboost.XGBClassifier(max_depth=10, n_estimators=500, learning_rate=0.2, max_delta_step=15)
>>> model.fit(X, y)
XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,
colsample_bytree=1, gamma=0, learning_rate=0.2, max_delta_step=15,
max_depth=10, min_child_weight=1, missing=None, n_estimators=500,
n_jobs=1, nthread=None, objective='binary:logistic', random_state=0,
reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=None,
silent=True, subsample=1)
- I generated C code using
m2cgen
and stored it on a file system:
>>> import sys
>>> import m2cgen as m2c
>>> sys.setrecursionlimit(5000)
>>> code = m2c.export_to_c(model)
- I compiled the generated source using
gcc
of the following version:
sauser@iaroslav-vm:~$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
And it worked just fine:
sauser@iaroslav-vm:~$ gcc -c -o xgboost.o xgboost.c && echo $?
0
- I also tested the same source with
clang
on Mac and it worked after I increased thebracket-depth
:
$ gcc -c -o xgboost.o xgboost.c
xgboost.c:2977:291: fatal error: bracket nesting level exceeded maximum of 256
xgboost.c:2977:291: note: use -fbracket-depth=N to increase maximum nesting level
1 error generated.
$ gcc -fbracket-depth=1024 -c -o xgboost.o xgboost.c
@beojan As you may see - so far I couldn't reproduce the issue. Can you please share the version of gcc
using which issue reproduced? Can you please try the xgboost.c
source that I generated (in attachments) to see whether it compiles with your gcc
?
xgboost.c.txt
UPD knowing the number of classes in your target would also help since in a multi-class scenario XGBoost creates N (500 in your example) estimators per class which may lead to a pretty large source code output.
from m2cgen.
Closing this issue due to lack of activity and inability to reproduce it. Please feel free to reopen if necessary.
from m2cgen.
Related Issues (20)
- I am getting an error NotImplementedError: Model 'lightgbm_Booster' is not supported while loading a lightgbm model file. HOT 1
- Support for SAS - happy to open PR with some guidance HOT 4
- Accuracies totally different HOT 3
- 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
- Unable to export code from XGBoost 1.7.5 models HOT 6
- 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
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.