27 int num_cat_threshold = 0;
42 std::vector<uint32_t> cat_threshold;
45 int8_t monotone_type = 0;
46 double min_constraint = -std::numeric_limits<double>::max();
47 double max_constraint = std::numeric_limits<double>::max();
48 inline static int Size(
int max_cat_threshold) {
49 return 2 *
sizeof(int) +
sizeof(uint32_t) +
sizeof(bool) +
sizeof(
double) * 9 +
sizeof(
data_size_t) * 2 + max_cat_threshold *
sizeof(uint32_t) +
sizeof(int8_t);
52 inline void CopyTo(
char* buffer)
const {
59 std::memcpy(buffer, &
gain,
sizeof(
gain));
60 buffer +=
sizeof(
gain);
77 std::memcpy(buffer, &monotone_type,
sizeof(monotone_type));
78 buffer +=
sizeof(monotone_type);
79 std::memcpy(buffer, &min_constraint,
sizeof(min_constraint));
80 buffer +=
sizeof(min_constraint);
81 std::memcpy(buffer, &max_constraint,
sizeof(max_constraint));
82 buffer +=
sizeof(max_constraint);
83 std::memcpy(buffer, &num_cat_threshold,
sizeof(num_cat_threshold));
84 buffer +=
sizeof(num_cat_threshold);
85 std::memcpy(buffer, cat_threshold.data(),
sizeof(uint32_t) * num_cat_threshold);
88 void CopyFrom(
const char* buffer) {
95 std::memcpy(&
gain, buffer,
sizeof(
gain));
96 buffer +=
sizeof(
gain);
113 std::memcpy(&monotone_type, buffer,
sizeof(monotone_type));
114 buffer +=
sizeof(monotone_type);
115 std::memcpy(&min_constraint, buffer,
sizeof(min_constraint));
116 buffer +=
sizeof(min_constraint);
117 std::memcpy(&max_constraint, buffer,
sizeof(max_constraint));
118 buffer +=
sizeof(max_constraint);
119 std::memcpy(&num_cat_threshold, buffer,
sizeof(num_cat_threshold));
120 buffer +=
sizeof(num_cat_threshold);
121 cat_threshold.resize(num_cat_threshold);
122 std::memcpy(cat_threshold.data(), buffer,
sizeof(uint32_t) * num_cat_threshold);
125 inline void Reset() {
131 inline bool operator > (
const SplitInfo& si)
const {
132 double local_gain = this->
gain;
133 double other_gain = si.gain;
135 if (local_gain == NAN) {
136 local_gain = kMinScore;
139 if (other_gain == NAN) {
140 other_gain = kMinScore;
142 int local_feature = this->
feature;
143 int other_feature = si.feature;
145 if (local_feature == -1) {
146 local_feature = INT32_MAX;
149 if (other_feature == -1) {
150 other_feature = INT32_MAX;
152 if (local_gain != other_gain) {
153 return local_gain > other_gain;
156 return local_feature < other_feature;
160 inline bool operator == (
const SplitInfo& si)
const {
161 double local_gain = this->
gain;
162 double other_gain = si.gain;
164 if (local_gain == NAN) {
165 local_gain = kMinScore;
168 if (other_gain == NAN) {
169 other_gain = kMinScore;
171 int local_feature = this->
feature;
172 int other_feature = si.feature;
174 if (local_feature == -1) {
175 local_feature = INT32_MAX;
178 if (other_feature == -1) {
179 other_feature = INT32_MAX;
181 if (local_gain != other_gain) {
182 return local_gain == other_gain;
185 return local_feature == other_feature;
201 inline void Reset() {
214 void CopyFrom(
const char* buffer) {
221 std::memcpy(&
gain, buffer,
sizeof(
gain));
222 buffer +=
sizeof(
gain);
225 inline bool operator > (
const LightSplitInfo& si)
const {
226 double local_gain = this->
gain;
227 double other_gain = si.gain;
229 if (local_gain == NAN) {
230 local_gain = kMinScore;
233 if (other_gain == NAN) {
234 other_gain = kMinScore;
236 int local_feature = this->
feature;
237 int other_feature = si.feature;
239 if (local_feature == -1) {
240 local_feature = INT32_MAX;
243 if (other_feature == -1) {
244 other_feature = INT32_MAX;
246 if (local_gain != other_gain) {
247 return local_gain > other_gain;
250 return local_feature < other_feature;
254 inline bool operator == (
const LightSplitInfo& si)
const {
255 double local_gain = this->
gain;
256 double other_gain = si.gain;
258 if (local_gain == NAN) {
259 local_gain = kMinScore;
262 if (other_gain == NAN) {
263 other_gain = kMinScore;
265 int local_feature = this->
feature;
266 int other_feature = si.feature;
268 if (local_feature == -1) {
269 local_feature = INT32_MAX;
272 if (other_feature == -1) {
273 other_feature = INT32_MAX;
275 if (local_gain != other_gain) {
276 return local_gain == other_gain;
279 return local_feature == other_feature;