popcorn / xgb2cpp

Converts XGBoost raw model dumps to C++ code.
MIT License
64 stars 26 forks source link

Wrong feature indices from dump.raw. #1

Closed p-siegel closed 7 years ago

p-siegel commented 7 years ago

your regular expression seems not to get the right feature, instead it uses the note id.

feature_index = re.search('[^f]', level[0]).group(0)

which should be:

feature_index = re.search('f(\d+)', level[0]).group(1)

to use the feature index from sample.

ghost commented 7 years ago

Wow, I can't believe I had such an oversight. I'll accept your pull request right away.

ghost commented 7 years ago

Solved by merging pull request https://github.com/drag0/xgb2cpp/pull/2