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

Enhance inplace prediction. #6653

Merged
merged 3 commits into from Feb 2, 2021
Merged

Conversation

trivialfis
Copy link
Member

  • Accept array interface for csr and array.
  • Accept an optional proxy dmatrix for metainfo.

Extracted from #6638 .

@trivialfis
Copy link
Member Author

trivialfis commented Jan 28, 2021

The old adapters for dense and csr are kept to preserve API for DMatrix.

The proxy dmatrix was used internally for device quantile dmatrix, now we reuse it for inplace predict.

@codecov-io
Copy link

Codecov Report

Merging #6653 (2b65884) into master (0ad6e18) will increase coverage by 0.13%.
The diff coverage is 68.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6653      +/-   ##
==========================================
+ Coverage   81.12%   81.25%   +0.13%     
==========================================
  Files          13       13              
  Lines        3698     3729      +31     
==========================================
+ Hits         3000     3030      +30     
- Misses        698      699       +1     
Impacted Files Coverage Δ
python-package/xgboost/core.py 82.77% <67.85%> (+0.65%) ⬆️
python-package/xgboost/data.py 59.87% <100.00%> (ø)
python-package/xgboost/sklearn.py 90.63% <0.00%> (-0.46%) ⬇️
python-package/xgboost/dask.py 82.47% <0.00%> (+0.13%) ⬆️

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 0ad6e18...2b65884. Read the comment docs.

@trivialfis trivialfis mentioned this pull request Jan 29, 2021
23 tasks
missing: float = np.nan,
validate_features: bool = True,
base_margin: Any = None,
strict_shape: bool = False
Copy link
Member Author

Choose a reason for hiding this comment

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

This parameter may needs more thought. It's meant to be a placeholder for #6638 . It affects only the leaf prediction.

Copy link
Member

@RAMitchell RAMitchell left a comment

Choose a reason for hiding this comment

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

There is a lot of effort to support base margin here. Why is it so important? Couldnt you just add it to the out prediction in numpy?

python-package/xgboost/core.py Outdated Show resolved Hide resolved
src/data/adapter.h Show resolved Hide resolved
@trivialfis
Copy link
Member Author

@RAMitchell no, there's predict transform. It isn't a lots of effort I think, all the needed tools are there, the PR is just gluing them together.

* Accept array interface for csr and array.
* Accept an optional proxy dmatrix for metainfo.

This constructs an explicit `_ProxyDMatrix` type in Python.
@trivialfis trivialfis merged commit 411592a into dmlc:master Feb 2, 2021
@trivialfis trivialfis deleted the inplace-predict branch February 2, 2021 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants