MCPcopy Create free account
hub / github.com/catboost/catboost / _eval_metrics

Method _eval_metrics

catboost/python-package/catboost/core.py:3212–3232  ·  view source on GitHub ↗
(self, data, metrics, ntree_start, ntree_end, eval_period, thread_count, res_dir, tmp_dir, plot, plot_file, log_cout=None, log_cerr=None)

Source from the content-addressed store, hash-verified

3210 return self._get_embedding_feature_indices()
3211
3212 def _eval_metrics(self, data, metrics, ntree_start, ntree_end, eval_period, thread_count, res_dir, tmp_dir, plot, plot_file, log_cout=None, log_cerr=None):
3213 if not self.is_fitted():
3214 raise CatBoostError("There is no trained model to evaluate metrics on. Use fit() to train model. Then call this method.")
3215 if not isinstance(data, Pool):
3216 raise CatBoostError("Invalid data type={}, must be catboost.Pool.".format(type(data)))
3217 if data.is_empty_:
3218 raise CatBoostError("Data is empty.")
3219 if not isinstance(metrics, ARRAY_TYPES) and not isinstance(metrics, STRING_TYPES) and not isinstance(metrics, BuiltinMetric):
3220 raise CatBoostError("Invalid metrics type={}, must be array like, str or one of builtin catboost.metrics.* class instances.".format(type(metrics)))
3221 if not all(map(lambda metric: isinstance(metric, string_types) or isinstance(metric, BuiltinMetric), metrics)):
3222 raise CatBoostError("Invalid metric type: must be str or one of builtin catboost.metrics.* class instances.")
3223 if tmp_dir is None:
3224 tmp_dir = tempfile.mkdtemp()
3225
3226 if isinstance(metrics, STRING_TYPES) or isinstance(metrics, BuiltinMetric):
3227 metrics = [metrics]
3228 metrics = stringify_builtin_metrics_list(metrics)
3229 with log_fixup(log_cout, log_cerr), plot_wrapper(plot, plot_file, 'Eval metrics plot', [res_dir]):
3230 metrics_score, metric_names = self._base_eval_metrics(data, metrics, ntree_start, ntree_end, eval_period, thread_count, res_dir, tmp_dir)
3231
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 """

Callers 2

eval_metricsMethod · 0.95
compareMethod · 0.95

Calls 12

isinstanceFunction · 0.85
mapClass · 0.85
plot_wrapperFunction · 0.85
dictClass · 0.85
is_fittedMethod · 0.80
_base_eval_metricsMethod · 0.80
log_fixupFunction · 0.70
CatBoostErrorClass · 0.50
typeClass · 0.50
allFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected