forked from dmlc/xgboost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dmitry Razdoburdin
committed
Feb 28, 2024
1 parent
761845f
commit f39ba8c
Showing
6 changed files
with
371 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/*! | ||
* Copyright 2017-2024 by Contributors | ||
* \file expand_entry.h | ||
*/ | ||
#ifndef PLUGIN_SYCL_TREE_EXPAND_ENTRY_H_ | ||
#define PLUGIN_SYCL_TREE_EXPAND_ENTRY_H_ | ||
|
||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wtautological-constant-compare" | ||
#include "../../src/tree/constraints.h" | ||
#pragma GCC diagnostic pop | ||
#include "../../src/tree/hist/expand_entry.h" | ||
|
||
namespace xgboost { | ||
namespace sycl { | ||
namespace tree { | ||
/* tree growing policies */ | ||
struct ExpandEntry : public xgboost::tree::ExpandEntryImpl<ExpandEntry> { | ||
static constexpr bst_node_t kRootNid = 0; | ||
|
||
xgboost::tree::SplitEntry split; | ||
|
||
ExpandEntry(int nid, int depth) : ExpandEntryImpl{nid, depth} {} | ||
|
||
inline bst_node_t GetSiblingId(const xgboost::RegTree* p_tree) const { | ||
CHECK_EQ((*p_tree)[nid].IsRoot(), false); | ||
const size_t parent_id = (*p_tree)[nid].Parent(); | ||
return GetSiblingId(p_tree, parent_id); | ||
} | ||
|
||
inline bst_node_t GetSiblingId(const xgboost::RegTree* p_tree, size_t parent_id) const { | ||
return p_tree->IsLeftChild(nid) ? p_tree->RightChild(parent_id) | ||
: p_tree->LeftChild(parent_id); | ||
} | ||
|
||
bool IsValidImpl(xgboost::tree::TrainParam const ¶m, int32_t num_leaves) const { | ||
if (split.loss_chg <= kRtEps) return false; | ||
if (split.loss_chg < param.min_split_loss) return false; | ||
if (param.max_depth > 0 && depth == param.max_depth) return false; | ||
if (param.max_leaves > 0 && num_leaves == param.max_leaves) return false; | ||
|
||
return true; | ||
} | ||
}; | ||
|
||
} // namespace tree | ||
} // namespace sycl | ||
} // namespace xgboost | ||
|
||
#endif // PLUGIN_SYCL_TREE_EXPAND_ENTRY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.