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

Save and load the bot detection model from modelforge #78

Closed
warenlg opened this issue Oct 14, 2019 · 6 comments
Closed

Save and load the bot detection model from modelforge #78

warenlg opened this issue Oct 14, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@warenlg
Copy link
Contributor

warenlg commented Oct 14, 2019

Once the bot detection model has been trained and has reached good performance, we have to save it to asdf format and upload the model to modelforge. The corresponding script has been PR here #73. The tree includes:

  • The booster XGBoost model
  • The dict of parameters used to train the model
  • The BPE model
@warenlg
Copy link
Contributor Author

warenlg commented Oct 14, 2019

Issue 1.

First pushing the model to modelforge failed with the following error message:

pkg_resources.VersionConflict: (semantic-version 2.8.2 (/home/waren/.local/lib/python3.6/site-packages), Requirement.parse('semantic-version<=2.6.0,>=2.3.1'))

The issue comes from asdf and is labelled with high-priority asdf-format/asdf#702.
A quick workaround is to downgrade semantic-version to version 2.6.0

@warenlg warenlg self-assigned this Oct 14, 2019
@warenlg warenlg added the enhancement New feature or request label Oct 14, 2019
@warenlg
Copy link
Contributor Author

warenlg commented Oct 14, 2019

Issue 2.

After saving the model using the sklearn API behind XGBClassifier, if we load the model with load_model xgboost native function, we hit the following error when trying to predict() something:
AttributeError: 'XGBClassifier' object has no attribute '_le'

The issue has already been raised here and the xgboost maintainers recommend to save the model using pickle for sklearn models objects like XGBClasssifier dmlc/xgboost#3829

@warenlg
Copy link
Contributor Author

warenlg commented Oct 15, 2019

Both issues above are overcome:

  1. by bumping asdf to 2.4.2 in modelforge Bump asdf version in requirements modelforge#107
  2. by adding the line xgb_cls._le = LabelEncoder().fit([False, True]) in the code snippet example usage in Add bot detection model models#28

@vmarkovtsev
Copy link
Collaborator

Shall we close then?

@warenlg
Copy link
Contributor Author

warenlg commented Oct 15, 2019

It is waiting for src-d/models#28 merging

@warenlg
Copy link
Contributor Author

warenlg commented Oct 16, 2019

src-d/models#28 is merged so we can close this.

@warenlg warenlg closed this as completed Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants