Expand description

This module implements the config for gradient boosting.

Following hyperparameters are supported:

  1. feature_size: the size of features. Training data and test data should have the same feature size. (default = 1)

  2. max_depth: the max depth of a single decision tree. The root node is considered to be in the layer 0. (default = 2)

  3. iterations: the iterations for training, which is also the number of trees in the gradient boosting algorithm. (default = 2)

  4. shrinkage: the learning rate parameter of the gradient boosting algorithm. (default = 1.0)

  5. feature_sample_raio: portion of features to be splited. When spliting a node, a subset of the features (feature_size * feature_sample_ratio) will be randomly selected to calculate impurity. (default = 1.0)

  6. data_sample_ratio: portion of data used to train in a single iteration. Data will be randomly selected for the training. (default = 1.0)

  7. min_leaf_size: the minimum number of samples required to be at a leaf node during training. (default = 1)

  8. loss: the loss function type. SquaredError, LogLikelyhood and LAD are supported for training and inference. RegLinear, RegLogistic, BinaryLogistic, BinaryLogitraw, MultiSoftprob, MultiSoftmax, RankPairwise are supported for inference with xgboost’s model. See Loss. (default = SquareError)

  9. debug: whether the debug information should be outputed. (default = false)

  10. initial_guess_enabled: whether initial guess for test data is enabled. (default = false)

Example

use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_feature_size(4);
cfg.set_max_depth(3);
cfg.set_iterations(3);
cfg.set_loss("LAD");
println!("{}", cfg.to_string());

// output
// number of features = 4
// min leaf size = 1
// maximum depth = 3
// iterations = 3
// shrinkage = 1
// feature sample ratio = 1
// data sample ratio = 1
// debug enabled = false
// loss type = LAD
// initial guess enabled = false

Structs

The config for the gradient boosting algorithm.

Enums

This enum defines the loss type.

Functions