dmlc / dmlc/xgboost

Eliminate text parsing from feature importances and evaluation metrics

Open
#6,091 1 comment 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

Currently, important functions such as feature importances and evaluation metrics rely on parsing of text strings, specifically the text output from the model dump function. For example:

https://github.com/dmlc/xgboost/blob/68c55a37d9bb680fe435f1d011e5fea62be97d22/python-package/xgboost/core.py#L1797-L1832

https://github.com/dmlc/xgboost/blob/68c55a37d9bb680fe435f1d011e5fea62be97d22/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/Booster.java#L509-L540

https://github.com/dmlc/xgboost/blob/68c55a37d9bb680fe435f1d011e5fea62be97d22/python-package/xgboost/training.py#L85-L91

https://github.com/dmlc/xgboost/blob/68c55a37d9bb680fe435f1d011e5fea62be97d22/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/Booster.java#L240-L255

Also see https://github.com/dmlc/xgboost/issues/4665#issuecomment-532932603 https://github.com/dmlc/xgboost/issues/4665#issuecomment-532945623

We should aim to eliminate all such uses of text parsing, since a slight change in the text dump will cause all these functions to break.

Proposed replacement:
* Feature importances: Implement a new C++ function that returns a JSON string representing features and their importances.
* Evaluation metrics: Implement a new C++ function that returns a JSON string representing eval set names and their eval metrics.

Now that we have a functioning JSON library as well as numeric printing function (`charconv`) in XGBoost, it should be doable.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.