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

Fix loading latest XGBoost binary model. #144

Merged
merged 4 commits into from
Feb 14, 2020

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented Feb 11, 2020

For XGBoost >= 1.0.0, depends on dmlc/xgboost#5281 .

@codecov-io
Copy link

codecov-io commented Feb 11, 2020

Codecov Report

Merging #144 into master will decrease coverage by 1.42%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #144      +/-   ##
============================================
- Coverage     40.77%   39.35%   -1.43%     
- Complexity       51       53       +2     
============================================
  Files            80       80              
  Lines          5913     5946      +33     
  Branches         37       37              
============================================
- Hits           2411     2340      -71     
- Misses         3476     3579     +103     
- Partials         26       27       +1     
Impacted Files Coverage Δ Complexity Δ
tests/python/test_xgboost_integration.py 16.85% <0.00%> (-83.15%) 0.00% <0.00%> (ø%)
python/treelite/frontend.py 69.44% <0.00%> (-5.91%) 0.00% <0.00%> (ø%)
tests/python/util.py 81.63% <0.00%> (-4.09%) 0.00% <0.00%> (ø%)
python/treelite/libpath.py 66.66% <0.00%> (-3.34%) 0.00% <0.00%> (ø%)
runtime/native/python/treelite_runtime/libpath.py 67.74% <0.00%> (-3.23%) 0.00% <0.00%> (ø%)
python/treelite/contrib/util.py 84.04% <0.00%> (-3.20%) 0.00% <0.00%> (ø%)
python/treelite/contrib/__init__.py 63.91% <0.00%> (-2.07%) 0.00% <0.00%> (ø%)
...4j/src/main/java/ml/dmlc/treelite4j/Predictor.java 77.89% <0.00%> (+6.31%) 16.00% <0.00%> (+2.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f772480...60d54fb. Read the comment docs.

@trivialfis trivialfis requested a review from hcho3 February 12, 2020 05:26
@trivialfis
Copy link
Member Author

@hcho3 Could you please take a look and test it yourself with dmlc/xgboost#5281 when time allows? I want to merge 2 PRs together, making sure that everything works as expected.

@hcho3
Copy link
Collaborator

hcho3 commented Feb 12, 2020

@trivialfis The Treelite CI is using XGBoost 0.90 for integration tests. We need to test 1.0.0. Should I try the models you gave me earlier?

@trivialfis
Copy link
Member Author

trivialfis commented Feb 12, 2020

@hcho3 For loading 0.90 the CI tests should be sufficient. Just testing treelite in combination with dmlc/xgboost#5281 . I tested it myself, but it would be great if you can test it too.

@trivialfis
Copy link
Member Author

Running the test I added in treelite should be sufficient.

Copy link

@JohnZed JohnZed left a comment

Choose a reason for hiding this comment

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

Two small questions below but otherwise looks good to me.

@@ -390,6 +399,17 @@ inline treelite::Model ParseStream(dmlc::Stream* fi) {

// set global bias
model.param.global_bias = static_cast<float>(mparam_.base_score);
std::vector<std::string> exponential_family {
"count:poisson", "reg:gamma", "reg:tweedie"
Copy link

Choose a reason for hiding this comment

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

do we need to do something special for survival:cox? or assert that it is not supported?

Copy link
Collaborator

@hcho3 hcho3 Feb 13, 2020

Choose a reason for hiding this comment

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

No, it is not necessary, since the label is not in log scale for survival:cox. For survival:cox, the convention is to use negative label to represent right-censored data.

Copy link
Member Author

Choose a reason for hiding this comment

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

@hcho3 has better understanding of survival model than me.


def test_logistic(self):
np.random.seed(0)
kRows = 16
Copy link

Choose a reason for hiding this comment

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

Is there a similar test for the exponential families? You could parametrize and reuse this with just a different randint limit for count:poisson probably.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding it.

Copy link
Collaborator

@hcho3 hcho3 left a comment

Choose a reason for hiding this comment

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

I ran the XGB integration test on my machine successfully with dmlc/xgboost#5281.

@trivialfis
Copy link
Member Author

I ran the XGB integration test on my machine successfully with dmlc/xgboost#5281.

Great!

@trivialfis
Copy link
Member Author

@hcho3 Shall I merge the PR in XGBoost ?

@hcho3
Copy link
Collaborator

hcho3 commented Feb 13, 2020

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants