Ejemplo n.º 1
0
    def train(self):
        """
            ## Auto Grid Search Parameters ##

            Model Name:
            'lr':           Logistic Regression
            'rf':           Random Forest
            'et':           Extra Trees
            'ab':           AdaBoost
            'gb':           GradientBoosting
            'xgb':          XGBoost
            'xgb_sk':       XGBoost using scikit-learn module
            'lgb':          LightGBM
            'lgb_sk':       LightGBM using scikit-learn module
            'cb':           CatBoost
            'dnn':          Deep Neural Networks
            'stack_lgb':    LightGBM for stack layer
            'christar':     Christar1991
            'prejudge_b':   PrejudgeBinary
            'prejudge_m':   PrejudgeMultiClass
            'stack_t':      StackTree
        """
        TM = TrainingMode()
        """
            Training Arguments
        """
        train_args = {
            'prescale': False,
            'postscale': True,
            'use_scale_pos_weight': False,
            'use_global_valid': False,
            'use_custom_obj': False,
            'show_importance': False,
            'show_accuracy': False,
            'save_final_pred': True,
            'save_final_prob_train': False,
            'save_cv_pred': False,
            'save_cv_prob_train': False,
            'save_csv_log': True,
            'append_info': 'forward_window_postscale'
        }
        """
            Cross Validation Arguments
        """
        # cv_args = {'n_valid': 4,
        #            'n_cv': 20,
        #            'n_era': 20}

        cv_args = self.get_cv_args('lgb_fi')
        """
            Reduced Features
        """
        reduced_feature_list = None
        """
            Base Parameters
        """
        base_parameters = self.get_base_params('xgb_fw')

        # base_parameters = None
        """
            Auto Grid Search Parameters
        """
        pg_list = [[
            ['max_depth', (8, 9, 10)],
            ['min_child_weight', (2, 4, 6, 8)],
            ['subsample', (0.81, 0.84, 0.87, 0.9)],
            ['colsample_bytree', (0.8, 0.85, 0.9)],
            ['colsample_bylevel', (0.7, 0.75, 0.8)],
        ]]
        train_seed_list = [999]
        cv_seed_list = [95]
        # train_seed_list = None
        # cv_seed_list = None
        TM.auto_grid_search('xgb',
                            num_boost_round=95,
                            n_epoch=1,
                            full_grid_search=True,
                            use_multi_group=False,
                            train_seed_list=train_seed_list,
                            cv_seed_list=cv_seed_list,
                            parameter_grid_list=pg_list,
                            base_parameters=base_parameters,
                            save_final_pred=False,
                            reduced_feature_list=reduced_feature_list,
                            train_args=train_args,
                            cv_args=cv_args)
Ejemplo n.º 2
0
    def train(self):
        """
            ## Auto Grid Search Parameters ##

            Model Name:
            'lr':           Logistic Regression
            'rf':           Random Forest
            'et':           Extra Trees
            'gb':           GradientBoosting
            'xgb':          XGBoost
            'xgb_sk':       XGBoost using scikit-learn module
            'lgb':          LightGBM
            'lgb_sk':       LightGBM using scikit-learn module
            'cb':           CatBoost
        """
        TM = TrainingMode()
        """
            Training Arguments
        """
        train_args = {
            'use_global_valid': False,
            'use_custom_obj': False,
            'show_importance': False,
            'save_final_pred': True,
            'save_final_pred_train': False,
            'save_cv_pred': False,
            'save_cv_pred_train': False,
            'save_csv_log': True,
            'loss_fuc': None,
            'append_info': 'forward_window_postscale_mdp-11_sub'
        }
        """
            Cross Validation Arguments
        """
        # cv_args = {'n_splits': 10,
        #            'n_cv': 10}

        cv_args = self.get_cv_args('xgb')
        """
            Base Parameters
        """
        # base_parameters = self.get_base_params('xgb')
        base_parameters = None
        """
            Auto Grid Search Parameters
        """
        pg_list = [[
            ['max_depth', (8, 9, 10)],
            ['min_child_weight', (2, 4, 6, 8)],
            ['subsample', (0.81, 0.84, 0.87, 0.9)],
            ['colsample_bytree', (0.8, 0.85, 0.9)],
            ['colsample_bylevel', (0.7, 0.75, 0.8)],
        ]]
        train_seed_list = [999]
        cv_seed_list = [95]
        # train_seed_list = None
        # cv_seed_list = None
        TM.auto_grid_search('xgb',
                            num_boost_round=95,
                            n_epoch=1,
                            full_grid_search=True,
                            train_seed_list=train_seed_list,
                            cv_seed_list=cv_seed_list,
                            parameter_grid_list=pg_list,
                            base_parameters=base_parameters,
                            save_final_pred=False,
                            train_args=train_args,
                            cv_args=cv_args)