tree_learner.cpp 743 Bytes
Newer Older
Guolin Ke's avatar
Guolin Ke committed
1
2
3
4
5
6
7
#include <LightGBM/tree_learner.h>

#include "serial_tree_learner.h"
#include "parallel_tree_learner.h"

namespace LightGBM {

Guolin Ke's avatar
Guolin Ke committed
8
TreeLearner* TreeLearner::CreateTreeLearner(TreeLearnerType type, const TreeConfig* tree_config) {
Guolin Ke's avatar
Guolin Ke committed
9
10
11
12
13
14
  if (type == TreeLearnerType::kSerialTreeLearner) {
    return new SerialTreeLearner(tree_config);
  } else if (type == TreeLearnerType::kFeatureParallelTreelearner) {
    return new FeatureParallelTreeLearner(tree_config);
  } else if (type == TreeLearnerType::kDataParallelTreeLearner) {
    return new DataParallelTreeLearner(tree_config);
Guolin Ke's avatar
Guolin Ke committed
15
16
  } else if (type == TreeLearnerType::KVotingParallelTreeLearner) {
    return new VotingParallelTreeLearner(tree_config);
Guolin Ke's avatar
Guolin Ke committed
17
18
19
20
21
  }
  return nullptr;
}

}  // namespace LightGBM