Text Input Format of DMatrix
Here we will briefly describe the text input formats for XGBoost. However, for users with access to a supported language environment like Python or R, it’s recommended to use data parsers from that ecosystem instead. For instance, sklearn.datasets.load_svmlight_file().
Basic Input Format
XGBoost currently supports two text formats for ingesting data: LIBSVM and CSV. The rest of this document will describe the LIBSVM format. (See this Wikipedia article for a description of the CSV format.). Please be careful that, XGBoost does not understand file extensions, nor try to guess the file format, as there is no universal agreement upon file extension of LIBSVM or CSV. Instead it employs URI format for specifying the precise input file type. For example if you provide a file as input, XGBoost will blindly use the default LIBSVM parser to digest it and generate a parser error. Instead, users need to provide an URI in the form of or . For external memory input, the URI should of a form similar to . See and also.