Add dump_format=json option (#1726)
* 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()
This commit is contained in:
@@ -43,22 +43,22 @@ class SparsePageSource : public DataSource {
|
||||
/*!
|
||||
* \brief Create source by taking data from parser.
|
||||
* \param src source parser.
|
||||
* \param cache_prefix The cache_prefix of cache file location.
|
||||
* \param cache_info The cache_info of cache file location.
|
||||
*/
|
||||
static void Create(dmlc::Parser<uint32_t>* src,
|
||||
const std::string& cache_prefix);
|
||||
const std::string& cache_info);
|
||||
/*!
|
||||
* \brief Create source cache by copy content from DMatrix.
|
||||
* \param cache_prefix The cache_prefix of cache file location.
|
||||
* \param cache_info The cache_info of cache file location.
|
||||
*/
|
||||
static void Create(DMatrix* src,
|
||||
const std::string& cache_prefix);
|
||||
const std::string& cache_info);
|
||||
/*!
|
||||
* \brief Check if the cache file already exists.
|
||||
* \param cache_prefix The cache prefix of files.
|
||||
* \param cache_info The cache prefix of files.
|
||||
* \return Whether cache file already exists.
|
||||
*/
|
||||
static bool CacheExist(const std::string& cache_prefix);
|
||||
static bool CacheExist(const std::string& cache_info);
|
||||
/*! \brief page size 32 MB */
|
||||
static const size_t kPageSize = 32UL << 20UL;
|
||||
/*! \brief magic number used to identify Page */
|
||||
|
||||
Reference in New Issue
Block a user