pub struct GradientBooster {
Show 15 fields pub objective_type: ObjectiveType, pub iterations: usize, pub learning_rate: f32, pub max_depth: usize, pub max_leaves: usize, pub l2: f32, pub gamma: f32, pub min_leaf_weight: f32, pub base_score: f64, pub nbins: u16, pub parallel: bool, pub allow_missing_splits: bool, pub impute_missing: bool, pub monotone_constraints: Option<ConstraintMap>, pub trees: Vec<Tree>,
}
Expand description

Gradient Booster object

  • objective_type - The name of objective function used to optimize. Valid options include “LogLoss” to use logistic loss as the objective function, or “SquaredLoss” to use Squared Error as the objective function.
  • iterations - Total number of trees to train in the ensemble.
  • learning_rate - Step size to use at each iteration. Each leaf weight is multiplied by this number. The smaller the value, the more conservative the weights will be.
  • max_depth - Maximum depth of an individual tree. Valid values are 0 to infinity.
  • max_leaves - Maximum number of leaves allowed on a tree. Valid values are 0 to infinity. This is the total number of final nodes.
  • l2 - L2 regularization term applied to the weights of the tree. Valid values are 0 to infinity.
  • gamma - The minimum amount of loss required to further split a node. Valid values are 0 to infinity.
  • min_leaf_weight - Minimum sum of the hessian values of the loss function required to be in a node.
  • base_score - The initial prediction value of the model.
  • nbins - Number of bins to calculate to partition the data. Setting this to a smaller number, will result in faster training time, while potentially sacrificing accuracy. If there are more bins, than unique values in a column, all unique values will be used.
  • allow_missing_splits - Allow for splits to be made such that all missing values go down one branch, and all non-missing values go down the other, if this results in the greatest reduction of loss. If this is false, splits will only be made on non missing values.
  • impute_missing - Automatically impute missing values, such that at every split the model learns the best direction to send missing values. If this is false, all missing values will default to right branch.

Fields

objective_type: ObjectiveTypeiterations: usizelearning_rate: f32max_depth: usizemax_leaves: usizel2: f32gamma: f32min_leaf_weight: f32base_score: f64nbins: u16parallel: boolallow_missing_splits: boolimpute_missing: boolmonotone_constraints: Option<ConstraintMap>trees: Vec<Tree>

Implementations

Gradient Booster object

  • objective_type - The name of objective function used to optimize. Valid options include “LogLoss” to use logistic loss as the objective function, or “SquaredLoss” to use Squared Error as the objective function.
  • iterations - Total number of trees to train in the ensemble.
  • learning_rate - Step size to use at each iteration. Each leaf weight is multiplied by this number. The smaller the value, the more conservative the weights will be.
  • max_depth - Maximum depth of an individual tree. Valid values are 0 to infinity.
  • max_leaves - Maximum number of leaves allowed on a tree. Valid values are 0 to infinity. This is the total number of final nodes.
  • l2 - L2 regularization term applied to the weights of the tree. Valid values are 0 to infinity.
  • gamma - The minimum amount of loss required to further split a node. Valid values are 0 to infinity.
  • min_leaf_weight - Minimum sum of the hessian values of the loss function required to be in a node.
  • base_score - The initial prediction value of the model.
  • nbins - Number of bins to calculate to partition the data. Setting this to a smaller number, will result in faster training time, while potentially sacrificing accuracy. If there are more bins, than unique values in a column, all unique values will be used.
  • monotone_constraints - Constraints that are used to enforce a specific relationship between the training features and the target variable.

Fit the gradient booster on a provided dataset.

  • data - Either a pandas DataFrame, or a 2 dimensional numpy array.
  • y - Either a pandas Series, or a 1 dimensional numpy array.
  • sample_weight - Instance weights to use when training the model. If None is passed, a weight of 1 will be used for every record.

Fit the gradient booster on a provided dataset without any weights.

  • data - Either a pandas DataFrame, or a 2 dimensional numpy array.
  • y - Either a pandas Series, or a 1 dimensional numpy array.

Generate predictions on data using the gradient booster.

  • data - Either a pandas DataFrame, or a 2 dimensional numpy array.

Given a value, return the partial dependence value of that value for that feature in the model.

  • feature - The index of the feature.
  • value - The value for which to calculate the partial dependence.

Save a booster as a json object to a file.

  • path - Path to save booster.

Dump a booster as a json object

Load a booster from Json string

  • json_str - String object, which can be serialized to json.

Load a booster from a path to a json booster object.

  • path - Path to load booster from.

Set the objective_type on the booster.

  • objective_type - The objective type of the booster.

Set the iterations on the booster.

  • iterations - The number of iterations of the booster.

Set the learning_rate on the booster.

  • learning_rate - The learning rate of the booster.

Set the max_depth on the booster.

  • max_depth - The maximum tree depth of the booster.

Set the max_leaves on the booster.

  • max_leaves - The maximum number of leaves of the booster.

Set the l2 on the booster.

  • l2 - The l2 regulation term of the booster.

Set the gamma on the booster.

  • gamma - The gamma value of the booster.

Set the min_leaf_weight on the booster.

  • min_leaf_weight - The minimum sum of the hession values allowed in the node of a tree of the booster.

Set the base_score on the booster.

  • base_score - The base score of the booster.

Set the nbins on the booster.

  • nbins - The nummber of bins used for partitioning the data of the booster.

Set the parallel on the booster.

  • parallel - Set if the booster should be trained in parallels.

Set the allow_missing_splits on the booster.

  • allow_missing_splits - Set if missing splits are allowed for the booster.

Set the impute_missing on the booster.

  • impute_missing - Set if missing values should be imputed when training the booster.

Set the monotone_constraints on the booster.

  • monotone_constraints - The monotone constraints of the booster.

Trait Implementations

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 alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. 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.