Skip to content

Commit

Permalink
Lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Jun 5, 2021
1 parent bf1af8f commit 21bb93d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/predictor/predict_fn.h
Expand Up @@ -3,27 +3,29 @@
*/
#ifndef XGBOOST_PREDICTOR_PREDICT_FN_H_
#define XGBOOST_PREDICTOR_PREDICT_FN_H_
#include "xgboost/tree_model.h"
#include "../common/categorical.h"
#include "xgboost/tree_model.h"

namespace xgboost {
namespace predictor {
template <bool has_missing, bool has_categorical>
inline XGBOOST_DEVICE bst_node_t GetNextNode(
const RegTree::Node& node, const bst_node_t nid, float fvalue,
bool is_missing, RegTree::CategoricalSplitMatrix const& cats) {
inline XGBOOST_DEVICE bst_node_t
GetNextNode(const RegTree::Node &node, const bst_node_t nid, float fvalue,
bool is_missing, RegTree::CategoricalSplitMatrix const &cats) {
if (has_missing && is_missing) {
return node.DefaultChild();
} else {
if (has_categorical && common::IsCat(cats.split_type, nid)) {
auto node_categories = cats.categories.subspan(cats.node_ptr[nid].beg,
cats.node_ptr[nid].size);
return Decision(node_categories, common::AsCat(fvalue)) ? node.LeftChild() : node.RightChild();
return Decision(node_categories, common::AsCat(fvalue))
? node.LeftChild()
: node.RightChild();
} else {
return node.LeftChild() + !(fvalue < node.SplitCond());
}
}
}
} // namespace predictor
} // namespace xgboost
} // namespace predictor
} // namespace xgboost
#endif // XGBOOST_PREDICTOR_PREDICT_FN_H_

0 comments on commit 21bb93d

Please sign in to comment.