GithubHelp home page GithubHelp logo

Comments (4)

izeigerman avatar izeigerman commented on June 16, 2024

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.

beojan avatar beojan commented on June 16, 2024

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.

izeigerman avatar izeigerman commented on June 16, 2024

@beojan I've attempted to reproduce the issue in the following way:

  1. 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)
  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)
  1. 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
  1. I also tested the same source with clang on Mac and it worked after I increased the bracket-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.

izeigerman avatar izeigerman commented on June 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.