Medial Code Documentation
Loading...
Searching...
No Matches
validation.h
1
4#ifndef XGBOOST_DATA_VALIDATION_H_
5#define XGBOOST_DATA_VALIDATION_H_
6#include <cmath>
7#include <vector>
8
9#include "xgboost/base.h"
10#include "xgboost/logging.h"
11
12namespace xgboost {
13namespace data {
15 XGBOOST_DEVICE bool operator()(float y) {
16#if defined(__CUDA_ARCH__)
17 return ::isnan(y) || ::isinf(y);
18#else
19 return std::isnan(y) || std::isinf(y);
20#endif
21 }
22};
23
25 XGBOOST_DEVICE bool operator()(float w) { return LabelsCheck{}(w) || w < 0; } // NOLINT
26};
27
28inline void ValidateQueryGroup(std::vector<bst_group_t> const &group_ptr_) {
29 bool valid_query_group = true;
30 for (size_t i = 1; i < group_ptr_.size(); ++i) {
31 valid_query_group = valid_query_group && group_ptr_[i] >= group_ptr_[i - 1];
32 if (XGBOOST_EXPECT(!valid_query_group, false)) {
33 break;
34 }
35 }
36 CHECK(valid_query_group) << "Invalid group structure.";
37}
38} // namespace data
39} // namespace xgboost
40#endif // XGBOOST_DATA_VALIDATION_H_
Copyright 2015-2023 by XGBoost Contributors.
#define XGBOOST_DEVICE
Tag function as usable by device.
Definition base.h:64
defines console logging options for xgboost. Use to enforce unified print behavior.
namespace of xgboost
Definition base.h:90
Definition validation.h:14
Definition validation.h:24