Code generated from XGBoost model includes "None"
See original GitHub issueWhen transpiling XGBRegressor
and XGBClassifier
models such as the following basic example:
from xgboost import XGBRegressor
from sklearn import datasets
import m2cgen as m2c
iris_data = datasets.load_iris(return_X_y=True)
mod = XGBRegressor(booster="gblinear", max_depth=2)
X, y = iris_data
mod.fit(X[:120], y[:120])
code = m2c.export_to_c(mod)
print(code)
the resulting c-code includes a Pythonesque None
:
double score(double * input) {
return (None) + (((((-0.391196) + ((input[0]) * (-0.0196191))) + ((input[1]) * (-0.11313))) + ((input[2]) * (0.137024))) + ((input[3]) * (0.645197)));
}
Probably I am missing some basic step?
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Python API Reference — xgboost 1.7.2 documentation
None. Example. import xgboost as xgb # Show all messages, including ones ... warning caused by model generated with XGBoost version < 1.0.0...
Read more >How to Develop Your First XGBoost Model in Python
The XGBoost model for classification is called XGBClassifier. We can create and and fit it to our training dataset. Models are fit using...
Read more >XGboost python package gives feature names as none
I am using pickle to load xgboost model. ... This was working perfectly fine, however suddenly started throwing this error. ... I encountered...
Read more >Extensive hyperparameter tuning yields nothing, XGBoost ...
XGBoost is not the only machine learning model, ... Check your code for bugs, if there are no changes, maybe you are doing...
Read more >Using XGBoost in Python Tutorial - DataCamp
Wide variety of tuning parameters : XGBoost internally has parameters for ... The tree ensemble model is a set of classification and regression...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@robinvanemden the issue has been fixed in version
0.7.0
. Please feel free to reopen this issue if you notice it again.OK, they suggest using
get_params()
method to get actual values of parameters. Refer to https://github.com/dmlc/xgboost/blob/cfae247231e4977a78b255810565369c934fe1b5/tests/python/test_with_sklearn.py#L535-L537 I’ve created a PR with updates: #185.