有没有一种方法可以遍历2D C ++向量来创建XGDMatrix?

时间:2019-05-20 21:45:20

标签: xgboost

我想从C ++ 2D向量创建一个XGDMatrix。我的数据输入位于vector<vector<float>>中,并且我不想将它们转换为2D浮点数组以能够使用XGDMatrixCreateFromMathttps://github.com/dmlc/xgboost/blob/master/include/xgboost/c_api.h#L177)。有没有一种方法可以对向量使用迭代器来构造XGDMatrix

我正在浏览https://github.com/dmlc/xgboost/blob/master/include/xgboost/c_api.h中的API,并遇到了XGDMatrixCreateFromDataIter https://github.com/dmlc/xgboost/blob/master/include/xgboost/c_api.h#L12。但是我不知道如何使用它,有人可以帮忙举一个使用XGDMatrixCreateFromDataIter的例子吗?

我想以相同的方式在https://stackoverflow.com/a/45790765中加载数据。但是,我不想从float[][]加载数据,而是想从vector<vector<float>>加载数据,而无需将2D向量转换为2D浮点数组。

0 个答案:

没有答案
相关问题