pub struct Config {
    pub feature_size: usize,
    pub max_depth: u32,
    pub iterations: usize,
    pub shrinkage: ValueType,
    pub feature_sample_ratio: f64,
    pub data_sample_ratio: f64,
    pub min_leaf_size: usize,
    pub loss: Loss,
    pub debug: bool,
    pub initial_guess_enabled: bool,
    pub training_optimization_level: u8,
}
Expand description

The config for the gradient boosting algorithm.

Fields

feature_size: usize

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

max_depth: u32

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

iterations: usize

The iterations to train, which is also the number of trees in the gradient boosting algorithm. (default = 2)

shrinkage: ValueType

The learning rate parameter of the gradient boosting algorithm.(default = 1.0)

feature_sample_ratio: f64

Portion of features to be splited. (default = 1.0)

data_sample_ratio: f64

Portion of data to be splited. (default = 1.0)

min_leaf_size: usize

The minimum number of samples required to be at a leaf node during training. (default = 1.0)

loss: Loss

The loss function type. (default = SquareError)

debug: bool

Whether the debug information should be outputed. (default = false)

initial_guess_enabled: bool

Whether initial guess for test data is enabled. (default = false)

training_optimization_level: u8

Training optimization level (default = 2).

0: least memory, slowest speed.

1: more memory usage, faster speed.

2: most memory usage, fastest speed.

Implementations

Return a new config with default settings.

Example
use gbdt::config::Config;
let mut cfg = Config::new();

Set feature size.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_feature_size(10);

Set learning rate.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_shrinkage(1.0);

Set training optimization level (default = 2).

0: least memory, slowest speed.

1: more memory usage, faster speed.

2: most memory usage, fastest speed.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_training_optimization_level(2);

Set max depth of the tree.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_max_depth(5);

Set iterations of the algorithm.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_iterations(5);

Set feature sample ratio.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_feature_sample_ratio(0.9);

Set data sample ratio.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_data_sample_ratio(0.9);

Set minimal leaf size.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_min_leaf_size(3);

Set loss type: “SquaredError”, “LogLikelyhood”, “LAD”, “reg:linear”, “binary:logistic”, “reg:logistic”, “binary:logitraw”, “multi:softprob”, “multi:softmax”, “rank:pairwise”

Example
use gbdt::config::{Config, Loss, loss2string};
let mut cfg = Config::new();
cfg.set_loss("LAD");
// Alternative way
cfg.set_loss(&loss2string(&Loss::SquaredError));

Set debug mode.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.set_debug(true);

Set whether initial guess of test data is enabled.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
cfg.enabled_initial_guess(false);

Dump the config to string for presentation.

Example
use gbdt::config::Config;
let mut cfg = Config::new();
println!("{}", cfg.to_string());

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.