* Add format to the params accepted by DumpModel Currently, only the test format is supported when trying to dump a model. The plan is to add more such formats like JSON which are easy to read and/or parse by machines. And to make the interface for this even more generic to allow other formats to be added. Hence, we make some modifications to make these function generic and accept a new parameter "format" which signifies the format of the dump to be created. * Fix typos and errors in docs * plugin: Mention all the register macros available Document the register macros currently available to the plugin writers so they know what exactly can be extended using hooks. * sparce_page_source: Use same arg name in .h and .cc * gbm: Add JSON dump The dump_format argument can be used to specify what type of dump file should be created. Add functionality to dump gblinear and gbtree into a JSON file. The JSON file has an array, each item is a JSON object for the tree. For gblinear: - The item is the bias and weights vectors For gbtree: - The item is the root node. The root node has a attribute "children" which holds the children nodes. This happens recursively. * core.py: Add arg dump_format for get_dump()
22 lines
743 B
Markdown
22 lines
743 B
Markdown
XGBoost Plugin Example
|
|
======================
|
|
This folder provides an example of xgboost plugin.
|
|
|
|
There are three steps you need to do to add a plugin to xgboost
|
|
- Create your source .cc file, implement a new extension
|
|
- In this example [custom_obj.cc](custom_obj.cc)
|
|
- Register this extension to xgboost via a registration macro
|
|
- In this example ```XGBOOST_REGISTER_OBJECTIVE``` in [this line](custom_obj.cc#L75)
|
|
- Create a [plugin.mk](plugin.mk) on this folder
|
|
|
|
To add this plugin, add the following line to ```config.mk```(template in make/config.mk).
|
|
```makefile
|
|
# Add plugin by include the plugin in config
|
|
XGB_PLUGINS += plugin/plugin_a/plugin.mk
|
|
```
|
|
|
|
Then you can test this plugin by using ```objective=mylogistic``` parameter.
|
|
|
|
|
|
|