catboost.get_object_importance

catboost.get_object_importance(model,
                               pool,
                               train_pool,
                               top_size = -1,
                               ostr_type = 'Average',
                               update_method = 'SinglePoint',
                               thread_count = -1)

Purpose

Calculate the effect of objects from the train dataset on the optimized metric values for the objects from the input dataset:
  • Positive values reflect that the optimized metric increases.
  • Negative values reflect that the optimized metric decreases.

The higher the deviation from 0, the bigger the impact that an object has on the optimized metric.

The method is an implementation of the approach described in the Finding Influential Training Samples for Gradient Boosted Decision Trees paper .

Arguments

ArgumentDescriptionDefault value
model

The model obtained as the result of training.

Required argument
pool

The input dataset.

Required argument
train_pool

The dataset used for training.

Required argument
top_size

Defines the number of most important objects from the training dataset. The number of returned objects is limited to this number.

-1 (top size is not limited)
ostr_type

The method for calculating the object importances.

Possible values:
  • Average — The average of scores of objects from the training dataset for every object from the input dataset.
  • PerObject — The scores of each object from the training dataset for each object from the input dataset.
Average
update_method

The algorithm accuracy method.

Possible values:
  • SinglePoint — The fastest and least accurate method.
  • TopKLeaves — Specify the number of leaves. The higher the value, the more accurate and the slower the calculation.
  • AllPoints — The slowest and most accurate method.
Supported parameters:
For example, the following value sets the method to TopKLeaves and limits the number of leaves to 3:
TopKLeaves:top=3
SinglePoint
thread_count

The number of threads to use during training.

Optimizes the speed of execution. This parameter doesn't affect results.

-1 (the number of threads is equal to the number of cores)The number of processor cores)

Examples

Calculate the object strength:
library(catboost)

column_description_path = system.file("extdata", "adult.cd", package = "catboost")
train_pool <- catboost.load_pool(
    system.file("extdata", "adult_train.1000", package = "catboost"),
    column_description = column_description_path
)
test_pool <- catboost.load_pool(
    system.file("extdata", "adult_test.1000", package = "catboost"),
    column_description = column_description_path
)

cb <- catboost.train(train_pool, params = list(random_seed = 0, iterations = 10, logging_level = 'Silent'))
object_importance <- catboost.get_object_importance(
    cb,
    test_pool,
    train_pool,
    top_size=100,
    ostr_type='Average',
    update_method='SinglePoint',
    thread_count=-1
)
indices = object_importance$indices
scores = object_importance$scores