dmlc / dmlc/xgboost

[FEATURE] enable output_margin, pred_contribs in sklearn API

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

Description

We maintain a slightly adjusted version of xgboost for our own purposes, but one thing that is common are some trivial features that are not exposed. I've mentioned this to @trivialfis before, but wanted to bring up since it's been several months and we are applying latest changes to ours.

Here's what I'd recommend:

1) sklearn.py pred_leaf, pred_contribs, approximate_contribs

diffs here:
(some here, but not all): https://github.com/h2oai/xgboost/commit/bfff9ab50084eaf3311379d7ae194cca3b6f94f0
i.e. at: https://github.com/h2oai/xgboost/blob/bfff9ab50084eaf3311379d7ae194cca3b6f94f0/python-package/xgboost/sklearn.py
i.e. API related ones (not label encoder ones): ![image](https://user-images.githubusercontent.com/2249614/119048238-cf95a300-b973-11eb-8dc2-593a4e731fad.png)

2) output_margin de-hard-code and use:

https://github.com/h2oai/xgboost/commit/355e415c1c8a5a148b5a4fef545d0ccc7b44b29c

As-is, output_margin now can no longer be chosen independently. And pred_contribs etc. are not accessible still.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in python-package/xgboost/sklearn.py and compare the referenced h2oai/xgboost commits, focusing on the sklearn API changes rather than label-encoder changes. Trace how output_margin is currently constrained and how pred_leaf, pred_contribs, and approximate_contribs are exposed. Done means these options are independently available through the sklearn API.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.