#ifndef XGBOOST_TESTS_CPP_HELPERS_H_ #define XGBOOST_TESTS_CPP_HELPERS_H_ #include #include #include #include #include #include #include #include #include #include #include #if defined(__CUDACC__) #define DeclareUnifiedTest(name) GPU ## name #else #define DeclareUnifiedTest(name) name #endif std::string TempFileName(); bool FileExists(const std::string name); long GetFileSize(const std::string filename); std::string CreateSimpleTestData(); std::string CreateBigTestData(size_t n_entries); void CheckObjFunction(xgboost::ObjFunction * obj, std::vector preds, std::vector labels, std::vector weights, std::vector out_grad, std::vector out_hess); void CheckRankingObjFunction(xgboost::ObjFunction * obj, std::vector preds, std::vector labels, std::vector weights, std::vector groups, std::vector out_grad, std::vector out_hess); xgboost::bst_float GetMetricEval( xgboost::Metric * metric, std::vector preds, std::vector labels, std::vector weights = std::vector ()); namespace xgboost { bool IsNear(std::vector::const_iterator _beg1, std::vector::const_iterator _end1, std::vector::const_iterator _beg2); } /** * \fn std::shared_ptr CreateDMatrix(int rows, int columns, float sparsity, int seed); * * \brief Creates dmatrix with uniform random data between 0-1. * * \param rows The rows. * \param columns The columns. * \param sparsity The sparsity. * \param seed The seed. * * \return The new d matrix. */ std::shared_ptr *CreateDMatrix(int rows, int columns, float sparsity, int seed = 0); #endif