(self)
return self.response
Set a parameter grid that will be used to optimize hyperparameters for the estimator.
        The parameters are used in the fit method to do a grid search.
Set a parameter grid that will be used to optimize hyperparameters for the estimator.
        The parameters are used in the fit method to do a grid search.
Set a parameter grid that will be used to optimize hyperparameters for the estimator . The parameters are used in the fit method to do a grid search .
def set_param_grid(self):
        """
        Set a parameter grid that will be used to optimize hyperparameters for the estimator.
        The parameters are used in the fit method to do a grid search.
        """

        # Interpret the request data based on the expected row and column structure
        row_template = ['strData', 'strData', 'strData']
        col_headers = ['model_name', 'estimator_args', 'grid_search_args']
        
        # Create a Pandas Data Frame for the request data
        self.request_df = utils.request_df(self.request, row_template, col_headers)
       
        # Initialize the persistent model
        self.model = PersistentModel()
        
        # Get the model name from the request dataframe
        self.model.name = self.request_df.loc[0, 'model_name']
        
        # Get the estimator's hyperparameter grid from the request dataframe
        param_grid = self.request_df.loc[:, 'estimator_args']

        # Get the grid search arguments from the request dataframe
        grid_search_args = self.request_df.loc[0, 'grid_search_args']

        # Get the model from cache or disk
        self._get_model()
        
        # Debug information is printed to the terminal and logs if the paramater debug = true
        if self.model.debug:
            self._print_log(3)

        self._set_grid_params(param_grid, grid_search_args)
        
        # Persist the model to disk
        self.model = self.model.save(self.model.name, self.path, overwrite=self.model.overwrite, compress=self.model.compress)
        
        # Update the cache to keep this model in memory
        self._update_cache()
              
        # Prepare the output
        message = [[self.model.name, 'Hyperparameter grid successfully saved to disk',\
                    time.strftime('%X %x %Z', time.localtime(self.model.state_timestamp))]]
        self.response = pd.DataFrame(message, columns=['model_name', 'result', 'time_stamp'])
        
        # Send the reponse table description to Qlik
        self._send_table_description("setup")
        
        # Debug information is printed to the terminal and logs if the paramater debug = true
        if self.model.debug:
            self._print_log(4)
        
        # Finally send the response
        return self.response
def set_param_grid ( self ) : # Interpret the request data based on the expected row and column structure row_template = [ 'strData' , 'strData' , 'strData' ] col_headers = [ 'model_name' , 'estimator_args' , 'grid_search_args' ] # Create a Pandas Data Frame for the request data self . request_df = utils . request_df ( self . request , row_template , col_headers ) # Initialize the persistent model self . model = PersistentModel ( ) # Get the model name from the request dataframe self . model . name = self . request_df . loc [ 0 , 'model_name' ] # Get the estimator's hyperparameter grid from the request dataframe param_grid = self . request_df . loc [ : , 'estimator_args' ] # Get the grid search arguments from the request dataframe grid_search_args = self . request_df . loc [ 0 , 'grid_search_args' ] # Get the model from cache or disk self . _get_model ( ) # Debug information is printed to the terminal and logs if the paramater debug = true if self . model . debug : self . _print_log ( 3 ) self . _set_grid_params ( param_grid , grid_search_args ) # Persist the model to disk self . model = self . model . save ( self . model . name , self . path , overwrite = self . model . overwrite , compress = self . model . compress ) # Update the cache to keep this model in memory self . _update_cache ( ) # Prepare the output message = [ [ self . model . name , 'Hyperparameter grid successfully saved to disk' , time . strftime ( '%X %x %Z' , time . localtime ( self . model . state_timestamp ) ) ] ] self . response = pd . DataFrame ( message , columns = [ 'model_name' , 'result' , 'time_stamp' ] ) # Send the reponse table description to Qlik self . _send_table_description ( "setup" ) # Debug information is printed to the terminal and logs if the paramater debug = true if self . model . debug : self . _print_log ( 4 ) # Finally send the response return self . response