pub enum ContributionsMethod {
Weight,
Average,
BranchDifference,
MidpointDifference,
ModeDifference,
ProbabilityChange,
}Variants§
Weight
This method will use the internal leaf weights, to calculate the contributions. This is the same as what is described by Saabas here.
Average
If this option is specified, the average internal node values are calculated, this is equivalent to the approx_contribs parameter in XGBoost.
BranchDifference
This method will calculate contributions by subtracting the weight of the node the record will travel down by the weight of the other non-missing branch. This method does not have the property where the contributions summed is equal to the final prediction of the model.
MidpointDifference
This method will calculate contributions by subtracting the weight of the node the record will travel down by the mid-point between the right and left node weighted by the cover of each node. This method does not have the property where the contributions summed is equal to the final prediction of the model.
ModeDifference
This method will calculate contributions by subtracting the weight of the node the record will travel down by the weight of the node with the largest cover (the mode node). This method does not have the property where the contributions summed is equal to the final prediction of the model.
ProbabilityChange
This method is only valid when the objective type is set to “LogLoss”. This method will calculate contributions as the change in a records probability of being 1 moving from a parent node to a child node. The sum of the returned contributions matrix, will be equal to the probability a record will be 1. For example, given a model, model.predict_contributions(X, method="ProbabilityChange") == 1 / (1 + np.exp(-model.predict(X)))