dmlc / dmlc/xgboost

pred_contribs=True handling of base_margin

Open
#6,546 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
28.8k
Forks
8.9k
Avg merge
1d 12h
Merged PRs (30d)
54

Description

For models with binary:logistic or reg:linear objective functions,
the last column of the matrix obtained by
`model.predict(data, pred_contribs=True) `
, is equal to the mean of the predictions in training data.

But if I `set_base_margin()` on my training data. For a `'count:poisson'` objective, for example, then my last column is equal to
`data.get_base_margin() + 'bias'`

However, the 'bias' is not equal to the mean of predictions in training, i.e.

`bias != np.mean(model.predict(data,output_margin=True) - data.get_base_margin())`

Why is this, and how is base_margin handled together with pred_contribs=True?

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files or tests. Reproduce the comparison using model.predict(data, pred_contribs=True), model.predict(data, output_margin=True), and data.get_base_margin() for the listed objectives; done means the handling of base_margin and the final contribution column is explained or corrected and covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.