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

Method compare

catboost/python-package/catboost/core.py:3283–3352  ·  view source on GitHub ↗

Draw train and eval errors in Jupyter notebook for both models Parameters ---------- model: CatBoost model Another model to draw metrics data : catboost.Pool Data to evaluate metrics on. metrics : list of strings or catboost

(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)

Source from the content-addressed store, hash-verified

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 """
3285 Draw train and eval errors in Jupyter notebook for both models
3286
3287 Parameters
3288 ----------
3289 model: CatBoost model
3290 Another model to draw metrics
3291
3292 data : catboost.Pool
3293 Data to evaluate metrics on.
3294
3295 metrics : list of strings or catboost.metrics.BuiltinMetric
3296 List of evaluated metrics.
3297
3298 ntree_start: int, optional (default=0)
3299 Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing).
3300
3301 ntree_end: int, optional (default=0)
3302 Model is applied on the interval [ntree_start, ntree_end) (zero-based indexing).
3303 If value equals to 0 this parameter is ignored and ntree_end equal to tree_count_.
3304
3305 eval_period: int, optional (default=1)
3306 Model is applied on the interval [ntree_start, ntree_end) with the step eval_period (zero-based indexing).
3307
3308 thread_count : int (default=-1)
3309 The number of threads to use when applying the model.
3310 Allows you to optimize the speed of execution. This parameter doesn't affect results.
3311 If -1, then the number of threads is set to the number of CPU cores.
3312
3313 tmp_dir : string or os.PathLike (default=None)
3314 The name of the temporary directory for intermediate results.
3315 If None, then the name will be generated.
3316
3317 plot_file : file-like or str, optional (default=None)
3318 If not None, save eval error graphs to file
3319
3320 log_cout: output stream or callback for logging (default=None)
3321 If None is specified, sys.stdout is used
3322
3323 log_cerr: error stream or callback for logging (default=None)
3324 If None is specified, sys.stderr is used
3325 """
3326
3327 if model is None:
3328 raise CatBoostError("You should provide model for comparison.")
3329 if data is None:
3330 raise CatBoostError("You should provide data for comparison.")
3331 if metrics is None:
3332 raise CatBoostError("You should provide metrics for comparison.")
3333
3334 need_to_remove = False
3335 if tmp_dir is None:
3336 need_to_remove = True
3337 tmp_dir = tempfile.mkdtemp()
3338 first_dir = os.path.join(tmp_dir, 'first_model')
3339 second_dir = os.path.join(tmp_dir, 'second_model')
3340

Callers 4

test_cv_return_modelsFunction · 0.45
test_compareFunction · 0.45
ValidateColumnOutputFunction · 0.45
InitializeColumnWriterFunction · 0.45

Calls 5

_eval_metricsMethod · 0.95
create_dir_if_not_existFunction · 0.85
plot_wrapperFunction · 0.85
CatBoostErrorClass · 0.50
joinMethod · 0.45

Tested by 2

test_cv_return_modelsFunction · 0.36
test_compareFunction · 0.36