| 156 | } |
| 157 | |
| 158 | void CheckRankingObjFunction(std::unique_ptr<xgboost::ObjFunction> const& obj, |
| 159 | std::vector<xgboost::bst_float> preds, |
| 160 | std::vector<xgboost::bst_float> labels, |
| 161 | std::vector<xgboost::bst_float> weights, |
| 162 | std::vector<xgboost::bst_uint> groups, |
| 163 | std::vector<xgboost::bst_float> out_grad, |
| 164 | std::vector<xgboost::bst_float> out_hess) { |
| 165 | xgboost::MetaInfo info; |
| 166 | info.num_row_ = labels.size(); |
| 167 | info.labels = xgboost::linalg::Matrix<float>{labels.cbegin(), |
| 168 | labels.cend(), |
| 169 | {labels.size(), static_cast<std::size_t>(1)}, |
| 170 | xgboost::DeviceOrd::CPU()}; |
| 171 | info.weights_.HostVector() = weights; |
| 172 | info.group_ptr_ = groups; |
| 173 | |
| 174 | CheckObjFunctionImpl(obj, preds, labels, weights, info, out_grad, out_hess); |
| 175 | } |
| 176 | |
| 177 | xgboost::bst_float GetMetricEval(xgboost::Metric* metric, |
| 178 | xgboost::HostDeviceVector<xgboost::bst_float> const& preds, |