get_roc_curve

Return points of the ROC curve.

This information is used to plot the ROC curve.

Method call format

get_roc_curve(model, 
              data,
              thread_count=-1)

Parameters

ParameterPossible typesDescriptionDefault value
modelcatboost.CatBoostThe trained model.Required parameter
data
  • catboost.Pool
  • list of catboost.Pool

A set of samples to build the ROC curve with.

Required parameter
thread_countint

The number of threads to use.

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

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

Type of return value

tuple of three arrays (fpr, tpr, thresholds)

Usage examples

from catboost import CatBoostClassifier, Pool
from catboost.utils import get_roc_curve

train_data = [[1,3],
              [0,4],
              [1,7],
              [0,3]]
train_labels = [1,0,1,1]
catboost_pool = Pool(train_data, train_labels)
model = CatBoostClassifier(learning_rate=0.03)
model.fit(train_data, train_labels, verbose=False)
(fpr, tpr, thresholds) = get_roc_curve(model, catboost_pool)
print fpr
print tpr
print thresholds
Output:
[0. 0. 0. 0. 1.]
[0.         0.33333333 0.66666667 1.         1.        ]
[1.         0.53533186 0.52910032 0.50608183 0.        ]