sample_strategy.cpp 761 Bytes
Newer Older
1
2
3
4
5
6
/*!
 * Copyright (c) 2021 Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See LICENSE file in the project root for license information.
 */

#include <LightGBM/sample_strategy.h>
7
8
9

#include <string>

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "goss.hpp"
#include "bagging.hpp"

namespace LightGBM {

SampleStrategy* SampleStrategy::CreateSampleStrategy(
  const Config* config,
  const Dataset* train_data,
  const ObjectiveFunction* objective_function,
  int num_tree_per_iteration) {
  if (config->data_sample_strategy == std::string("goss")) {
    return new GOSSStrategy(config, train_data, num_tree_per_iteration);
  } else {
    return new BaggingSampleStrategy(config, train_data, objective_function, num_tree_per_iteration);
  }
}

}  // namespace LightGBM