eval_metrics

Calculate the specified metrics for the specified dataset.

Method call format

eval_metrics(data, 
             metrics, 
             ntree_start=0, 
             ntree_end=0, 
             eval_period=1, 
             thread_count=-1)

Parameters

ParameterPossible valuesDescriptionDefault value
datacatboost.Pool

A file or matrix with the input dataset.

Required parameter
metricslist of strings

The list of metrics to be calculated.

Possible values:
  • RMSE
  • Logloss
  • MAE
  • CrossEntropy
  • Quantile
  • LogLinQuantile
  • Lq
  • MultiClass
  • MultiClassOneVsAll
  • MAPE
  • Poisson
  • PairLogit
  • PairLogitPairwise
  • QueryRMSE
  • QuerySoftMax
  • SMAPE
  • Recall
  • Precision
  • F1
  • TotalF1
  • Accuracy
  • BalancedAccuracy
  • BalancedErrorRate
  • Kappa
  • WKappa
  • LogLikelihoodOfPrediction
  • AUC
  • R2
  • MCC
  • BrierScore
  • HingeLoss
  • HammingLoss
  • ZeroOneLoss
  • MSLE
  • MedianAbsoluteError
  • PairAccuracy
  • AverageGain
  • PFound
  • NDCG
  • PrecisionAt
  • RecallAt
  • MAP
  • CtrFactor

For example, if the AUC and Logloss metrics should be calculated, use the following construction:

['Logloss', 'AUC']
Required parameter
ntree_startint

To reduce the number of trees to use when the model is applied or the metrics are calculated, set the range of the tree indices to [ntree_start; ntree_end).

This parameter defines the index of the first tree to be used when applying the model or calculating the metrics (the inclusive left border of the range). Indices are zero-based.

0
ntree_endint

To reduce the number of trees to use when the model is applied or the metrics are calculated, set the range of the tree indices to [ntree_start; ntree_end) and the the step of the trees to use to eval_period.

This parameter defines the index of the first tree not to be used when applying the model or calculating the metrics (the exclusive right border of the range). Indices are zero-based.

0 (the index of the last tree to use equals to the number of trees in the model minus one)
eval_periodint

To reduce the number of trees to use when the model is applied or the metrics are calculated, set the range of the tree indices to [ntree_start; ntree_end) and the step of the trees to use to eval_period.

This parameter defines the step of the trees to use for the staged prediction mode. In this mode the results for the (n*i)-th tree of the model are calculated taking into consideration only the trees in the range [ntree_start; ntree_start + n*i]. The specified value n defines the size of the range of trees to use. The approximate values for the last period are calculated using all trees in the provided segment.

1 (the trees are applied sequentially: the first tree, then the first two trees, etc.)
thread_countint

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)

Type of return value

A dictionary of calculated metrics in the following format:

metric -> array of shape [(ntree_end – ntree_start) / eval_period]