Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #396, xgboost converter for xgboost >= 1.0.2 #397

Merged
merged 2 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion onnxmltools/convert/xgboost/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ def get_xgb_params(xgb_node):
else:
# XGBoost < 0.7
params = xgb_node.__dict__


if ('n_estimators' not in params and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to have ()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check because I'm not sure which versions of python support this. I use that because that's what's done in scikit-learn.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not work without () for me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it due to parenthesis has to enclose the (not in)? not the full statement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parenthesis are used to write the test over two lines, otherwise, I would have to use symbol . Apparently, if ( … \n ...): seems to be the preferred one.

hasattr(xgb_node, 'n_estimators')):
# xgboost >= 1.0.2
params['n_estimators'] = xgb_node.n_estimators
return params
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ scikit-learn
scipy
svm
wheel
xgboost<=1.0.2
xgboost