13 using json = ::nlohmann::json;
20 const ::CNum::DataStructs::Matrix<double> y) ->
void {
21 if (low == 0 && high == n_samples) {
22 ::std::iota(pos_ptr, pos_ptr + n_samples, low);
39 struct TreeBoosterNode;
51 template <
typename TreeType>
55 ::std::string _loss_type;
58 double _learning_rate;
64 ::std::string _activation;
77 void copy_hyperparams(
const GBModel &other)
noexcept;
80 void copy(
const GBModel &other)
noexcept;
83 void move(
GBModel &&other)
noexcept;
112 int n_learners = 200,
118 ::std::string activation_func =
"",
119 double weight_decay = 0.0,
182 bool verbose =
true);
199#include "GBModel.tpp"
2d array abstraction
Definition Matrix.h:43
GBModel< TreeType > & operator=(const GBModel &other) noexcept
Copy assignment.
Definition GBModel.h:112
void fit(::CNum::DataStructs::Matrix< double > &X, ::CNum::DataStructs::Matrix< double > &y, bool verbose=true)
Train the model.
Definition GBModel.h:138
static GBModel< TreeType > load_model(std::string path)
Load Model from JSON encoded ".cmod" file.
Definition GBModel.h:270
GBModel(std::string lt="MSE", int n_learners=200, double lr=0.1, double ss=0.25, int md=5, int ms=3, SplitAlg sa=HIST, ::std::string activation_func="", double weight_decay=0.0, double rl=1.0, double gamma=0.0, SubsampleFunction ssf=default_subsample)
Overloaded default constructor.
~GBModel()
Destructor.
Definition GBModel.h:129
void save_model(std::string path)
Save Model to JSON encoded ".cmod" file.
Definition GBModel.h:222
GBModel(::CNum::Model::Loss::LossProfile loss_profile, int n_learners, double lr, double ss, int md, int ms, SplitAlg sa, ::CNum::Model::Activation::ActivationFunc activation_func, double weight_decay, double rl, double gamma, SubsampleFunction ssf=default_subsample)
Parameterized constructor.
::CNum::DataStructs::Matrix< double > predict(::CNum::DataStructs::Matrix< double > &data)
Inference (making predictions).
Definition GBModel.h:202
A node used in a TreeBooster used for gather and storing information about the decision making proces...
Definition TreeBoosterNode.h:25
std::function< double(double) > ActivationFunc
Definition Activation.h:16
Tree-based models.
Definition GBModel.h:11
::nlohmann::json json
Definition GBModel.h:13
::std::function< void(size_t *, size_t, size_t, size_t, ::CNum::DataStructs::Matrix< double >) > SubsampleFunction
Definition GBModel.h:14
SplitAlg
The algorithm used for tree finding splits in tree building.
Definition GBModel.h:34
@ HIST
Definition GBModel.h:36
@ GREEDY
Definition GBModel.h:35
SubsampleFunction default_subsample
Definition GBModel.h:16
void generate_n_unique_rand_in_range(size_t low_bound, size_t high_bound, T *out, size_t n, uint64_t logical_id=0)
Generate n unique random integers.
Definition RandUtils.h:3
The loss, gradient, and hessian functions associated with a loss function.
Definition Loss.h:22
Holds data associated with the decision making process in a TreeBoosterNode.
Definition TreeDefs.h:50