tabular/src/autogluon/tabular/task/tabular_prediction/predictor_v2.py
def fit(self,
            train_data,
            tuning_data=None,
            time_limit=None,
            presets=None,
            hyperparameters=None,
            feature_metadata=None,
            **kwargs):
        """
        Fit models to predict a column of data table based on the other columns.

        # TODO: Move documentation from TabularPrediction.fit to here
        # TODO: Move num_cpu/num_gpu to AG_args_fit
        # TODO: AG_args -> ag_args? +1 -> Will change after replacing original TabularPredictor to avoid extra API breaks.
        # TODO: consider adding kwarg option for data which has already been preprocessed by feature generator to skip feature generation.

        """
        if self._learner.is_fit:
            raise AssertionError('Predictor is already fit! To fit additional models, refer to `predictor.fit_extra`.')
        kwargs_orig = kwargs.copy()
        kwargs = self._validate_fit_kwargs(kwargs)

        verbosity = kwargs.get('verbosity', self.verbosity)
        set_logger_verbosity(verbosity, logger=logger)

        if verbosity >= 3:
            logger.log(20, '============ fit kwarg info ============')
            logger.log(20, 'User Specified kwargs:')
            logger.log(20, f'{pprint.pformat(kwargs_orig)}')
            logger.log(20, 'Full kwargs:')
            logger.log(20, f'{pprint.pformat(kwargs)}')
            logger.log(20, '========================================')

        holdout_frac = kwargs['holdout_frac']
        num_bag_folds = kwargs['num_bag_folds']
        num_bag_sets = kwargs['num_bag_sets']
        num_stack_levels = kwargs['num_stack_levels']
        auto_stack = kwargs['auto_stack']
        hyperparameter_tune_kwargs = kwargs['hyperparameter_tune_kwargs']
        num_cpus = kwargs['num_cpus']
        num_gpus = kwargs['num_gpus']
        feature_generator = kwargs['feature_generator']
        unlabeled_data = kwargs['unlabeled_data']
        save_bagged_folds = kwargs['save_bagged_folds']

        ag_args = kwargs['AG_args']
        ag_args_fit = kwargs['AG_args_fit']
        ag_args_ensemble = kwargs['AG_args_ensemble']
        excluded_model_types = kwargs['excluded_model_types']

        self._set_feature_generator(feature_generator=feature_generator, feature_metadata=feature_metadata)
        train_data, tuning_data, unlabeled_data = self._validate_fit_data(train_data=train_data, tuning_data=tuning_data, unlabeled_data=unlabeled_data)

        if hyperparameters is None:
            hyperparameters = 'default'
        if isinstance(hyperparameters, str):
            hyperparameters = get_hyperparameter_config(hyperparameters)

        # Process kwargs to create trainer, schedulers, searchers:
        num_bag_folds, num_bag_sets, num_stack_levels = self._sanitize_stack_args(
            num_bag_folds=num_bag_folds, num_bag_sets=num_bag_sets, num_stack_levels=num_stack_levels,
            time_limit=time_limit, auto_stack=auto_stack, num_train_rows=len(train_data),
        )

        if hyperparameter_tune_kwargs is not None:
            scheduler_options = self._init_scheduler(hyperparameter_tune_kwargs, time_limit, hyperparameters, num_cpus, num_gpus, num_bag_folds, num_stack_levels)
        else:
            scheduler_options = None
        hyperparameter_tune = scheduler_options is not None
        if hyperparameter_tune:
            logger.log(30, 'Warning: hyperparameter tuning is currently experimental and may cause the process to hang. Setting `auto_stack=True` instead is recommended to achieve maximum quality models.')

        if holdout_frac is None:
            holdout_frac = default_holdout_frac(len(train_data), hyperparameter_tune)

        if ag_args_fit is None:
            ag_args_fit = dict()
        # TODO: v0.1: Update to be 'auto' or None by default to give full control to individual models.
        if 'num_cpus' not in ag_args_fit and num_cpus is not None:
            ag_args_fit['num_cpus'] = num_cpus
        if 'num_gpus' not in ag_args_fit and num_gpus is not None:
            ag_args_fit['num_gpus'] = num_gpus

        # TODO: v0.1: make core_kwargs a kwargs argument to predictor.fit, add aux_kwargs to predictor.fit
        core_kwargs = {'ag_args': ag_args, 'ag_args_ensemble': ag_args_ensemble, 'ag_args_fit': ag_args_fit, 'excluded_model_types': excluded_model_types}
        self._learner.fit(X=train_data, X_val=tuning_data, X_unlabeled=unlabeled_data,
                          hyperparameter_tune_kwargs=scheduler_options,
                          holdout_frac=holdout_frac, num_bagging_folds=num_bag_folds, num_bagging_sets=num_bag_sets, stack_ensemble_levels=num_stack_levels,
                          hyperparameters=hyperparameters, core_kwargs=core_kwargs,
                          time_limit=time_limit, save_bagged_folds=save_bagged_folds, verbosity=verbosity)
        self._set_post_fit_vars()

        self._post_fit(
            keep_only_best=kwargs['keep_only_best'],
            refit_full=kwargs['refit_full'],
            set_best_to_refit_full=kwargs['set_best_to_refit_full'],
            save_space=kwargs['save_space'],
        )
        self.save()
        return self

        Fit models to predict a column of data table based on the other columns.

        # TODO: Move documentation from TabularPrediction.fit to here
        # TODO: Move num_cpu/num_gpu to AG_args_fit
        # TODO: AG_args -> ag_args? +1 -> Will change after replacing original TabularPredictor to avoid extra API breaks.
        # TODO: consider adding kwarg option for data which has already been preprocessed by feature generator to skip feature generation.

        
Fit models to predict a column of data table based on the other columns.
Fit models to predict a column of data table based on the other columns .
def fit(self,
            train_data,
            tuning_data=None,
            time_limit=None,
            presets=None,
            hyperparameters=None,
            feature_metadata=None,
            **kwargs):
        if self._learner.is_fit:
            raise AssertionError('Predictor is already fit! To fit additional models, refer to `predictor.fit_extra`.')
        kwargs_orig = kwargs.copy()
        kwargs = self._validate_fit_kwargs(kwargs)
        verbosity = kwargs.get('verbosity', self.verbosity)
        set_logger_verbosity(verbosity, logger=logger)
        if verbosity >= 3:
            logger.log(20, '============ fit kwarg info ============')
            logger.log(20, 'User Specified kwargs:')
            logger.log(20, f'{pprint.pformat(kwargs_orig)}')
            logger.log(20, 'Full kwargs:')
            logger.log(20, f'{pprint.pformat(kwargs)}')
            logger.log(20, '========================================')
        holdout_frac = kwargs['holdout_frac']
        num_bag_folds = kwargs['num_bag_folds']
        num_bag_sets = kwargs['num_bag_sets']
        num_stack_levels = kwargs['num_stack_levels']
        auto_stack = kwargs['auto_stack']
        hyperparameter_tune_kwargs = kwargs['hyperparameter_tune_kwargs']
        num_cpus = kwargs['num_cpus']
        num_gpus = kwargs['num_gpus']
        feature_generator = kwargs['feature_generator']
        unlabeled_data = kwargs['unlabeled_data']
        save_bagged_folds = kwargs['save_bagged_folds']
        ag_args = kwargs['AG_args']
        ag_args_fit = kwargs['AG_args_fit']
        ag_args_ensemble = kwargs['AG_args_ensemble']
        excluded_model_types = kwargs['excluded_model_types']
        self._set_feature_generator(feature_generator=feature_generator, feature_metadata=feature_metadata)
        train_data, tuning_data, unlabeled_data = self._validate_fit_data(train_data=train_data, tuning_data=tuning_data, unlabeled_data=unlabeled_data)
        if hyperparameters is None:
            hyperparameters = 'default'
        if isinstance(hyperparameters, str):
            hyperparameters = get_hyperparameter_config(hyperparameters)
        num_bag_folds, num_bag_sets, num_stack_levels = self._sanitize_stack_args(
            num_bag_folds=num_bag_folds, num_bag_sets=num_bag_sets, num_stack_levels=num_stack_levels,
            time_limit=time_limit, auto_stack=auto_stack, num_train_rows=len(train_data),
        )
        if hyperparameter_tune_kwargs is not None:
            scheduler_options = self._init_scheduler(hyperparameter_tune_kwargs, time_limit, hyperparameters, num_cpus, num_gpus, num_bag_folds, num_stack_levels)
        else:
            scheduler_options = None
        hyperparameter_tune = scheduler_options is not None
        if hyperparameter_tune:
            logger.log(30, 'Warning: hyperparameter tuning is currently experimental and may cause the process to hang. Setting `auto_stack=True` instead is recommended to achieve maximum quality models.')
        if holdout_frac is None:
            holdout_frac = default_holdout_frac(len(train_data), hyperparameter_tune)
        if ag_args_fit is None:
            ag_args_fit = dict()
        if 'num_cpus' not in ag_args_fit and num_cpus is not None:
            ag_args_fit['num_cpus'] = num_cpus
        if 'num_gpus' not in ag_args_fit and num_gpus is not None:
            ag_args_fit['num_gpus'] = num_gpus
        core_kwargs = {'ag_args': ag_args, 'ag_args_ensemble': ag_args_ensemble, 'ag_args_fit': ag_args_fit, 'excluded_model_types': excluded_model_types}
        self._learner.fit(X=train_data, X_val=tuning_data, X_unlabeled=unlabeled_data,
                          hyperparameter_tune_kwargs=scheduler_options,
                          holdout_frac=holdout_frac, num_bagging_folds=num_bag_folds, num_bagging_sets=num_bag_sets, stack_ensemble_levels=num_stack_levels,
                          hyperparameters=hyperparameters, core_kwargs=core_kwargs,
                          time_limit=time_limit, save_bagged_folds=save_bagged_folds, verbosity=verbosity)
        self._set_post_fit_vars()
        self._post_fit(
            keep_only_best=kwargs['keep_only_best'],
            refit_full=kwargs['refit_full'],
            set_best_to_refit_full=kwargs['set_best_to_refit_full'],
            save_space=kwargs['save_space'],
        )
        self.save()
        return self
def fit ( self , train_data , tuning_data = None , time_limit = None , presets = None , hyperparameters = None , feature_metadata = None , ** kwargs ) : if self . _learner . is_fit : raise AssertionError ( 'Predictor is already fit! To fit additional models, refer to `predictor.fit_extra`.' ) kwargs_orig = kwargs . copy ( ) kwargs = self . _validate_fit_kwargs ( kwargs ) verbosity = kwargs . get ( 'verbosity' , self . verbosity ) set_logger_verbosity ( verbosity , logger = logger ) if verbosity >= 3 : logger . log ( 20 , '============ fit kwarg info ============' ) logger . log ( 20 , 'User Specified kwargs:' ) logger . log ( 20 , f'{pprint.pformat(kwargs_orig)}' ) logger . log ( 20 , 'Full kwargs:' ) logger . log ( 20 , f'{pprint.pformat(kwargs)}' ) logger . log ( 20 , '========================================' ) holdout_frac = kwargs [ 'holdout_frac' ] num_bag_folds = kwargs [ 'num_bag_folds' ] num_bag_sets = kwargs [ 'num_bag_sets' ] num_stack_levels = kwargs [ 'num_stack_levels' ] auto_stack = kwargs [ 'auto_stack' ] hyperparameter_tune_kwargs = kwargs [ 'hyperparameter_tune_kwargs' ] num_cpus = kwargs [ 'num_cpus' ] num_gpus = kwargs [ 'num_gpus' ] feature_generator = kwargs [ 'feature_generator' ] unlabeled_data = kwargs [ 'unlabeled_data' ] save_bagged_folds = kwargs [ 'save_bagged_folds' ] ag_args = kwargs [ 'AG_args' ] ag_args_fit = kwargs [ 'AG_args_fit' ] ag_args_ensemble = kwargs [ 'AG_args_ensemble' ] excluded_model_types = kwargs [ 'excluded_model_types' ] self . _set_feature_generator ( feature_generator = feature_generator , feature_metadata = feature_metadata ) train_data , tuning_data , unlabeled_data = self . _validate_fit_data ( train_data = train_data , tuning_data = tuning_data , unlabeled_data = unlabeled_data ) if hyperparameters is None : hyperparameters = 'default' if isinstance ( hyperparameters , str ) : hyperparameters = get_hyperparameter_config ( hyperparameters ) num_bag_folds , num_bag_sets , num_stack_levels = self . _sanitize_stack_args ( num_bag_folds = num_bag_folds , num_bag_sets = num_bag_sets , num_stack_levels = num_stack_levels , time_limit = time_limit , auto_stack = auto_stack , num_train_rows = len ( train_data ) , ) if hyperparameter_tune_kwargs is not None : scheduler_options = self . _init_scheduler ( hyperparameter_tune_kwargs , time_limit , hyperparameters , num_cpus , num_gpus , num_bag_folds , num_stack_levels ) else : scheduler_options = None hyperparameter_tune = scheduler_options is not None if hyperparameter_tune : logger . log ( 30 , 'Warning: hyperparameter tuning is currently experimental and may cause the process to hang. Setting `auto_stack=True` instead is recommended to achieve maximum quality models.' ) if holdout_frac is None : holdout_frac = default_holdout_frac ( len ( train_data ) , hyperparameter_tune ) if ag_args_fit is None : ag_args_fit = dict ( ) if 'num_cpus' not in ag_args_fit and num_cpus is not None : ag_args_fit [ 'num_cpus' ] = num_cpus if 'num_gpus' not in ag_args_fit and num_gpus is not None : ag_args_fit [ 'num_gpus' ] = num_gpus core_kwargs = { 'ag_args' : ag_args , 'ag_args_ensemble' : ag_args_ensemble , 'ag_args_fit' : ag_args_fit , 'excluded_model_types' : excluded_model_types } self . _learner . fit ( X = train_data , X_val = tuning_data , X_unlabeled = unlabeled_data , hyperparameter_tune_kwargs = scheduler_options , holdout_frac = holdout_frac , num_bagging_folds = num_bag_folds , num_bagging_sets = num_bag_sets , stack_ensemble_levels = num_stack_levels , hyperparameters = hyperparameters , core_kwargs = core_kwargs , time_limit = time_limit , save_bagged_folds = save_bagged_folds , verbosity = verbosity ) self . _set_post_fit_vars ( ) self . _post_fit ( keep_only_best = kwargs [ 'keep_only_best' ] , refit_full = kwargs [ 'refit_full' ] , set_best_to_refit_full = kwargs [ 'set_best_to_refit_full' ] , save_space = kwargs [ 'save_space' ] , ) self . save ( ) return self
Fit models to predict a column of data table based on the other columns.
Fit models to predict a column of data table based on the other columns .
"""
        Fit models to predict a column of data table based on the other columns.

        # TODO: Move documentation from TabularPrediction.fit to here
        # TODO: Move num_cpu/num_gpu to AG_args_fit
        # TODO: AG_args -> ag_args? +1 -> Will change after replacing original TabularPredictor to avoid extra API breaks.
        # TODO: consider adding kwarg option for data which has already been preprocessed by feature generator to skip feature generation.

        """ # Process kwargs to create trainer, schedulers, searchers: # TODO: v0.1: Update to be 'auto' or None by default to give full control to individual models. # TODO: v0.1: make core_kwargs a kwargs argument to predictor.fit, add aux_kwargs to predictor.fit
self
train_data
tuning_data
time_limit
presets
hyperparameters
feature_metadata