pass fmatrix as const
This commit is contained in:
parent
d9dbd1efc6
commit
ac1cc15b90
@ -46,7 +46,7 @@ class IGradBooster {
|
||||
* root_index.size() can be 0 which indicates that no pre-partition involved
|
||||
*/
|
||||
virtual void DoBoost(const std::vector<bst_gpair> &gpair,
|
||||
FMatrix &fmat,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index) = 0;
|
||||
/*!
|
||||
* \brief generate predictions for given feature matrix
|
||||
|
||||
@ -83,7 +83,7 @@ class GBTree : public IGradBooster<FMatrix> {
|
||||
utils::Assert(trees.size() == 0, "GBTree: model already initialized");
|
||||
}
|
||||
virtual void DoBoost(const std::vector<bst_gpair> &gpair,
|
||||
FMatrix &fmat,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index) {
|
||||
if (mparam.num_output_group == 1) {
|
||||
this->BoostNewTrees(gpair, fmat, root_index, 0);
|
||||
@ -174,7 +174,7 @@ class GBTree : public IGradBooster<FMatrix> {
|
||||
}
|
||||
// do group specific group
|
||||
inline void BoostNewTrees(const std::vector<bst_gpair> &gpair,
|
||||
FMatrix &fmat,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index,
|
||||
int bst_group) {
|
||||
this->InitUpdater();
|
||||
|
||||
@ -37,7 +37,7 @@ class IUpdater {
|
||||
* there can be multiple trees when we train random forest style model
|
||||
*/
|
||||
virtual void Update(const std::vector<bst_gpair> &gpair,
|
||||
FMatrix &fmat,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index,
|
||||
const std::vector<RegTree*> &trees) = 0;
|
||||
// destructor
|
||||
|
||||
@ -24,7 +24,7 @@ class ColMaker: public IUpdater<FMatrix> {
|
||||
param.SetParam(name, val);
|
||||
}
|
||||
virtual void Update(const std::vector<bst_gpair> &gpair,
|
||||
FMatrix &fmat,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index,
|
||||
const std::vector<RegTree*> &trees) {
|
||||
|
||||
@ -71,7 +71,8 @@ class ColMaker: public IUpdater<FMatrix> {
|
||||
// constructor
|
||||
explicit Builder(const TrainParam ¶m) : param(param) {}
|
||||
// update one tree, growing
|
||||
virtual void Update(const std::vector<bst_gpair> &gpair, FMatrix &fmat,
|
||||
virtual void Update(const std::vector<bst_gpair> &gpair,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index,
|
||||
RegTree *p_tree) {
|
||||
this->InitData(gpair, fmat, root_index, *p_tree);
|
||||
@ -100,7 +101,8 @@ class ColMaker: public IUpdater<FMatrix> {
|
||||
|
||||
private:
|
||||
// initialize temp data structure
|
||||
inline void InitData(const std::vector<bst_gpair> &gpair, FMatrix &fmat,
|
||||
inline void InitData(const std::vector<bst_gpair> &gpair,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index, const RegTree &tree) {
|
||||
utils::Assert(tree.param.num_nodes == tree.param.num_roots, "ColMaker: can only grow new tree");
|
||||
{// setup position
|
||||
|
||||
@ -21,7 +21,8 @@ class TreePruner: public IUpdater<FMatrix> {
|
||||
param.SetParam(name, val);
|
||||
}
|
||||
// update the tree, do pruning
|
||||
virtual void Update(const std::vector<bst_gpair> &gpair, FMatrix &fmat,
|
||||
virtual void Update(const std::vector<bst_gpair> &gpair,
|
||||
const FMatrix &fmat,
|
||||
const std::vector<unsigned> &root_index,
|
||||
const std::vector<RegTree*> &trees) {
|
||||
for (size_t i = 0; i < trees.size(); ++i) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user