Calculate metrics. Parameters ---------- data : catboost.Pool Data to evaluate metrics on. metrics : list of strings or catboost.metrics.BuiltinMetric List of evaluated metrics. ntree_start: int, optional (default=0)
(self, data, metrics, ntree_start=0, ntree_end=0, eval_period=1, thread_count=-1, tmp_dir=None, plot=False, plot_file=None, log_cout=None, log_cerr=None)
| 3232 | return dict(zip(metric_names, metrics_score)) |
| 3233 | |
| 3234 | def eval_metrics(self, data, metrics, ntree_start=0, ntree_end=0, eval_period=1, thread_count=-1, tmp_dir=None, plot=False, plot_file=None, log_cout=None, log_cerr=None): |
| 3235 | """ |
| 3236 | Calculate metrics. |
| 3237 | |
| 3238 | Parameters |
| 3239 | ---------- |
| 3240 | data : catboost.Pool |
| 3241 | Data to evaluate metrics on. |
| 3242 | |
| 3243 | metrics : list of strings or catboost.metrics.BuiltinMetric |
| 3244 | List of evaluated metrics. |
| 3245 | |
| 3246 | ntree_start: int, optional (default=0) |
| 3247 | Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing). |
| 3248 | |
| 3249 | ntree_end: int, optional (default=0) |
| 3250 | Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing). |
| 3251 | If value equals to 0 this parameter is ignored and ntree_end equal to tree_count_. |
| 3252 | |
| 3253 | eval_period: int, optional (default=1) |
| 3254 | Model is applied on the interval [ntree_start, ntree_end) with the step eval_period (zero-based indexing). |
| 3255 | |
| 3256 | thread_count : int (default=-1) |
| 3257 | The number of threads to use when applying the model. |
| 3258 | Allows you to optimize the speed of execution. This parameter doesn't affect results. |
| 3259 | If -1, then the number of threads is set to the number of CPU cores. |
| 3260 | |
| 3261 | tmp_dir : string or os.PathLike (default=None) |
| 3262 | The name of the temporary directory for intermediate results. |
| 3263 | If None, then the name will be generated. |
| 3264 | |
| 3265 | plot : bool, optional (default=False) |
| 3266 | If True, draw train and eval error in Jupyter notebook |
| 3267 | |
| 3268 | plot_file : file-like or str, optional (default=None) |
| 3269 | If not None, save train and eval error graphs to file |
| 3270 | |
| 3271 | log_cout: output stream or callback for logging (default=None) |
| 3272 | If None is specified, sys.stdout is used |
| 3273 | |
| 3274 | log_cerr: error stream or callback for logging (default=None) |
| 3275 | If None is specified, sys.stderr is used |
| 3276 | |
| 3277 | Returns |
| 3278 | ------- |
| 3279 | prediction : dict: metric -> array of shape [(ntree_end - ntree_start) / eval_period] |
| 3280 | """ |
| 3281 | return self._eval_metrics(data, metrics, ntree_start, ntree_end, eval_period, thread_count, _get_train_dir(self._init_params), tmp_dir, plot, plot_file, log_cout, log_cerr) |
| 3282 | |
| 3283 | def compare(self, model, data, metrics, ntree_start=0, ntree_end=0, eval_period=1, thread_count=-1, tmp_dir=None, plot_file=None, log_cout=None, log_cerr=None): |
| 3284 | """ |