(self, data_instances, validate_data=None)
Train poisson regression model of role host
        Parameters
        ----------
        data_instances: Table of Instance, input data
Train poisson regression model of role host
        Parameters
        ----------
        data_instances: Table of Instance, input data
Train poisson regression model of role host Parameters ---------- data_instances : Table of Instance input data
def fit(self, data_instances, validate_data=None):
        """
        Train poisson regression model of role host
        Parameters
        ----------
        data_instances: Table of Instance, input data
        """

        LOGGER.info("Enter hetero_poisson host")
        self._abnormal_detection(data_instances)
        # self.validation_strategy = self.init_validation_strategy(data_instances, validate_data)

        self.header = self.get_header(data_instances)
        self.callback_list.on_train_begin(data_instances, validate_data)

        self.cipher_operator = self.cipher.gen_paillier_cipher_operator()

        self.batch_generator.initialize_batch_generator(data_instances)

        self.encrypted_calculator = [EncryptModeCalculator(self.cipher_operator,
                                                           self.encrypted_mode_calculator_param.mode,
                                                           self.encrypted_mode_calculator_param.re_encrypted_rate) for _
                                     in range(self.batch_generator.batch_nums)]

        LOGGER.info("Start initialize model.")
        model_shape = self.get_features_shape(data_instances)
        if self.init_param_obj.fit_intercept:
            self.init_param_obj.fit_intercept = False
        if not self.component_properties.is_warm_start:
            w = self.initializer.init_model(model_shape, init_params=self.init_param_obj)
            self.model_weights = LinearModelWeights(w, fit_intercept=self.fit_intercept, raise_overflow_error=False)
        else:
            self.callback_warm_start_init_iter(self.n_iter_)

        while self.n_iter_ < self.max_iter:
            LOGGER.info("iter:" + str(self.n_iter_))

            batch_data_generator = self.batch_generator.generate_batch_data()
            self.optimizer.set_iters(self.n_iter_)

            batch_index = 0
            for batch_data in batch_data_generator:
                self.callback_list.on_epoch_begin(self.n_iter_)
                LOGGER.info("iter:" + str(self.n_iter_))
                optim_host_gradient = self.gradient_loss_operator.compute_gradient_procedure(
                    batch_data,
                    self.encrypted_calculator,
                    self.model_weights,
                    self.optimizer,
                    self.n_iter_,
                    batch_index)

                self.gradient_loss_operator.compute_loss(batch_data, self.model_weights,
                                                         self.encrypted_calculator, self.optimizer,
                                                         self.n_iter_, batch_index, self.cipher_operator)

                self.model_weights = self.optimizer.update_model(self.model_weights, optim_host_gradient)
                batch_index += 1

            self.is_converged = self.converge_procedure.sync_converge_info(suffix=(self.n_iter_,))

            LOGGER.info("Get is_converged flag from arbiter:{}".format(self.is_converged))

            self.callback_list.on_epoch_end(self.n_iter_)
            self.n_iter_ += 1
            if self.stop_training:
                break

            LOGGER.info("iter: {}, is_converged: {}".format(self.n_iter_, self.is_converged))
            if self.is_converged:
                break
        self.callback_list.on_train_end()
        self.set_summary(self.get_model_summary())
def fit ( self , data_instances , validate_data = None ) : LOGGER . info ( "Enter hetero_poisson host" ) self . _abnormal_detection ( data_instances ) # self.validation_strategy = self.init_validation_strategy(data_instances, validate_data) self . header = self . get_header ( data_instances ) self . callback_list . on_train_begin ( data_instances , validate_data ) self . cipher_operator = self . cipher . gen_paillier_cipher_operator ( ) self . batch_generator . initialize_batch_generator ( data_instances ) self . encrypted_calculator = [ EncryptModeCalculator ( self . cipher_operator , self . encrypted_mode_calculator_param . mode , self . encrypted_mode_calculator_param . re_encrypted_rate ) for _ in range ( self . batch_generator . batch_nums ) ] LOGGER . info ( "Start initialize model." ) model_shape = self . get_features_shape ( data_instances ) if self . init_param_obj . fit_intercept : self . init_param_obj . fit_intercept = False if not self . component_properties . is_warm_start : w = self . initializer . init_model ( model_shape , init_params = self . init_param_obj ) self . model_weights = LinearModelWeights ( w , fit_intercept = self . fit_intercept , raise_overflow_error = False ) else : self . callback_warm_start_init_iter ( self . n_iter_ ) while self . n_iter_ < self . max_iter : LOGGER . info ( "iter:" + str ( self . n_iter_ ) ) batch_data_generator = self . batch_generator . generate_batch_data ( ) self . optimizer . set_iters ( self . n_iter_ ) batch_index = 0 for batch_data in batch_data_generator : self . callback_list . on_epoch_begin ( self . n_iter_ ) LOGGER . info ( "iter:" + str ( self . n_iter_ ) ) optim_host_gradient = self . gradient_loss_operator . compute_gradient_procedure ( batch_data , self . encrypted_calculator , self . model_weights , self . optimizer , self . n_iter_ , batch_index ) self . gradient_loss_operator . compute_loss ( batch_data , self . model_weights , self . encrypted_calculator , self . optimizer , self . n_iter_ , batch_index , self . cipher_operator ) self . model_weights = self . optimizer . update_model ( self . model_weights , optim_host_gradient ) batch_index += 1 self . is_converged = self . converge_procedure . sync_converge_info ( suffix = ( self . n_iter_ , ) ) LOGGER . info ( "Get is_converged flag from arbiter:{}" . format ( self . is_converged ) ) self . callback_list . on_epoch_end ( self . n_iter_ ) self . n_iter_ += 1 if self . stop_training : break LOGGER . info ( "iter: {}, is_converged: {}" . format ( self . n_iter_ , self . is_converged ) ) if self . is_converged : break self . callback_list . on_train_end ( ) self . set_summary ( self . get_model_summary ( ) )