How to use the catboost.python-package.catboost.eval.factor_utils.FactorUtils.create_label function in catboost

To help you get started, we’ve selected a few catboost examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github catboost / catboost / catboost / python-package / catboost / eval / catboost_evaluation.py View on Github external
features_to_eval,
                                                                     label_mode=label_mode)
                                      )
        # test
        if eval_type == EvalType.All or eval_type == EvalType.SeqAddAndAll or len(features_to_eval) == 1:
            test_cases.append(ExecutionCase(params,
                                            ignored_features=[],
                                            label=FactorUtils.create_label(features_to_eval,
                                                                           [],
                                                                           label_mode=label_mode)
                                            ))
        elif eval_type == EvalType.SeqRem:
            for feature_num in features_to_eval:
                test_cases.append(ExecutionCase(params,
                                                ignored_features=[feature_num],
                                                label=FactorUtils.create_label(features_to_eval,
                                                                               [feature_num],
                                                                               label_mode=label_mode)
                                                ))
        elif eval_type == EvalType.SeqAdd or eval_type == EvalType.SeqAddAndAll:
            for feature_num in features_to_eval:
                cur_features = copy(features_to_eval)
                cur_features.remove(feature_num)
                test_cases.append(ExecutionCase(params,
                                                label=FactorUtils.create_label(features_to_eval,
                                                                               cur_features,
                                                                               label_mode=label_mode),
                                                ignored_features=list(cur_features)))
        elif eval_type != EvalType.All:
            raise AttributeError("Don't support {} mode.", eval_type.value)
        return baseline_case, test_cases
github catboost / catboost / catboost / python-package / catboost / eval / catboost_evaluation.py View on Github external
def _create_eval_feature_cases(params, features_to_eval, eval_type, label_mode):
        if len(features_to_eval) == 0:
            raise CatBoostError("Provide at least one feature to evaluation")

        # baseline
        test_cases = list()
        baseline_case = ExecutionCase(params,
                                      ignored_features=list(features_to_eval),
                                      label=FactorUtils.create_label(features_to_eval,
                                                                     features_to_eval,
                                                                     label_mode=label_mode)
                                      )
        # test
        if eval_type == EvalType.All or eval_type == EvalType.SeqAddAndAll or len(features_to_eval) == 1:
            test_cases.append(ExecutionCase(params,
                                            ignored_features=[],
                                            label=FactorUtils.create_label(features_to_eval,
                                                                           [],
                                                                           label_mode=label_mode)
                                            ))
        elif eval_type == EvalType.SeqRem:
            for feature_num in features_to_eval:
                test_cases.append(ExecutionCase(params,
                                                ignored_features=[feature_num],
                                                label=FactorUtils.create_label(features_to_eval,
github catboost / catboost / catboost / python-package / catboost / eval / catboost_evaluation.py View on Github external
if len(features_to_eval) == 0:
            raise CatBoostError("Provide at least one feature to evaluation")

        # baseline
        test_cases = list()
        baseline_case = ExecutionCase(params,
                                      ignored_features=list(features_to_eval),
                                      label=FactorUtils.create_label(features_to_eval,
                                                                     features_to_eval,
                                                                     label_mode=label_mode)
                                      )
        # test
        if eval_type == EvalType.All or eval_type == EvalType.SeqAddAndAll or len(features_to_eval) == 1:
            test_cases.append(ExecutionCase(params,
                                            ignored_features=[],
                                            label=FactorUtils.create_label(features_to_eval,
                                                                           [],
                                                                           label_mode=label_mode)
                                            ))
        elif eval_type == EvalType.SeqRem:
            for feature_num in features_to_eval:
                test_cases.append(ExecutionCase(params,
                                                ignored_features=[feature_num],
                                                label=FactorUtils.create_label(features_to_eval,
                                                                               [feature_num],
                                                                               label_mode=label_mode)
                                                ))
        elif eval_type == EvalType.SeqAdd or eval_type == EvalType.SeqAddAndAll:
            for feature_num in features_to_eval:
                cur_features = copy(features_to_eval)
                cur_features.remove(feature_num)
                test_cases.append(ExecutionCase(params,
github catboost / catboost / catboost / python-package / catboost / eval / catboost_evaluation.py View on Github external
label_mode=label_mode)
                                            ))
        elif eval_type == EvalType.SeqRem:
            for feature_num in features_to_eval:
                test_cases.append(ExecutionCase(params,
                                                ignored_features=[feature_num],
                                                label=FactorUtils.create_label(features_to_eval,
                                                                               [feature_num],
                                                                               label_mode=label_mode)
                                                ))
        elif eval_type == EvalType.SeqAdd or eval_type == EvalType.SeqAddAndAll:
            for feature_num in features_to_eval:
                cur_features = copy(features_to_eval)
                cur_features.remove(feature_num)
                test_cases.append(ExecutionCase(params,
                                                label=FactorUtils.create_label(features_to_eval,
                                                                               cur_features,
                                                                               label_mode=label_mode),
                                                ignored_features=list(cur_features)))
        elif eval_type != EvalType.All:
            raise AttributeError("Don't support {} mode.", eval_type.value)
        return baseline_case, test_cases