(self, X, y, cat_features, text_features, embedding_features, pairs, graph, sample_weight, group_id, group_weight, subgroup_id,
pairs_weight, baseline, use_best_model, eval_set, verbose, logging_level, plot, plot_file,
column_description, verbose_eval, metric_period, silent, early_stopping_rounds,
save_snapshot, snapshot_file, snapshot_interval, init_model, callbacks, log_cout=None, log_cerr=None)
| 2687 | } |
| 2688 | |
| 2689 | def _fit(self, X, y, cat_features, text_features, embedding_features, pairs, graph, sample_weight, group_id, group_weight, subgroup_id, |
| 2690 | pairs_weight, baseline, use_best_model, eval_set, verbose, logging_level, plot, plot_file, |
| 2691 | column_description, verbose_eval, metric_period, silent, early_stopping_rounds, |
| 2692 | save_snapshot, snapshot_file, snapshot_interval, init_model, callbacks, log_cout=None, log_cerr=None): |
| 2693 | |
| 2694 | with log_fixup(log_cout, log_cerr): |
| 2695 | if X is None: |
| 2696 | raise CatBoostError("X must not be None") |
| 2697 | |
| 2698 | if y is None and not isinstance(X, PATH_TYPES + (Pool,)): |
| 2699 | raise CatBoostError("y may be None only when X is an instance of catboost.Pool or string") |
| 2700 | |
| 2701 | train_params = self._prepare_train_params( |
| 2702 | X=X, y=y, cat_features=cat_features, text_features=text_features, embedding_features=embedding_features, |
| 2703 | pairs=pairs, graph=graph, sample_weight=sample_weight, group_id=group_id, group_weight=group_weight, |
| 2704 | subgroup_id=subgroup_id, pairs_weight=pairs_weight, baseline=baseline, use_best_model=use_best_model, |
| 2705 | eval_set=eval_set, verbose=verbose, logging_level=logging_level, plot=plot, plot_file=plot_file, |
| 2706 | column_description=column_description, verbose_eval=verbose_eval, metric_period=metric_period, |
| 2707 | silent=silent, early_stopping_rounds=early_stopping_rounds, save_snapshot=save_snapshot, |
| 2708 | snapshot_file=snapshot_file, snapshot_interval=snapshot_interval, init_model=init_model, |
| 2709 | callbacks=callbacks |
| 2710 | ) |
| 2711 | params = train_params["params"] |
| 2712 | train_pool = train_params["train_pool"] |
| 2713 | allow_clear_pool = train_params["allow_clear_pool"] |
| 2714 | |
| 2715 | with plot_wrapper(plot, plot_file, 'Training plots', [_get_train_dir(params)]): |
| 2716 | self._train( |
| 2717 | train_pool, |
| 2718 | train_params["eval_sets"], |
| 2719 | params, |
| 2720 | allow_clear_pool, |
| 2721 | train_params["init_model"] |
| 2722 | ) |
| 2723 | |
| 2724 | # Have property feature_importance possibly set |
| 2725 | loss = self._object._get_loss_function_name() |
| 2726 | if loss and is_groupwise_metric(loss): |
| 2727 | pass # too expensive |
| 2728 | elif (len(self.get_embedding_feature_indices()) > 0): |
| 2729 | pass # is not implemented yet |
| 2730 | else: |
| 2731 | if not self._object._has_leaf_weights_in_model(): |
| 2732 | if allow_clear_pool: |
| 2733 | train_pool = _build_train_pool( |
| 2734 | X, |
| 2735 | y, |
| 2736 | cat_features, |
| 2737 | text_features, |
| 2738 | embedding_features, |
| 2739 | pairs, |
| 2740 | graph, |
| 2741 | sample_weight, |
| 2742 | group_id, |
| 2743 | group_weight, |
| 2744 | subgroup_id, |
| 2745 | pairs_weight, |
| 2746 | baseline, |
no test coverage detected