(self, advanced=False)
return self.response
Initialize the model with given parameters
        Arguments are retreived from the keyword argument columns in the request data
        Arguments should take the form of a comma separated string: 'arg1=value1, arg2=value2'
        For estimater, scaler and dimensionality reduction hyperparameters the type should also be specified
        Use the pipe | character to specify type: 'arg1=value1|str, arg2=value2|int, arg3=value3|bool'
Initialize the model with given parameters
        Arguments are retreived from the keyword argument columns in the request data
        Arguments should take the form of a comma separated string: 'arg1=value1, arg2=value2'
        For estimater, scaler and dimensionality reduction hyperparameters the type should also be specified
        Use the pipe | character to specify type: 'arg1=value1|str, arg2=value2|int, arg3=value3|bool'
Initialize the model with given parameters Arguments are retreived from the keyword argument columns in the request data Arguments should take the form of a comma separated string : arg1 = value1 arg2 = value2 For estimater scaler and dimensionality reduction hyperparameters the type should also be specified Use the pipe | character to specify type : arg1 = value1|str arg2 = value2|int arg3 = value3|bool
def setup(self, advanced=False):
        """
        Initialize the model with given parameters
        Arguments are retreived from the keyword argument columns in the request data
        Arguments should take the form of a comma separated string: 'arg1=value1, arg2=value2'
        For estimater, scaler and dimensionality reduction hyperparameters the type should also be specified
        Use the pipe | character to specify type: 'arg1=value1|str, arg2=value2|int, arg3=value3|bool' 
        """
        
        # Interpret the request data based on the expected row and column structure
        row_template = ['strData', 'strData', 'strData', 'strData']
        col_headers = ['model_name', 'estimator_args', 'scaler_args', 'execution_args']
        
        if advanced:
            # If specified, get dimensionality reduction arguments
            row_template = ['strData', 'strData', 'strData', 'strData', 'strData', 'strData']
            col_headers = ['model_name', 'estimator_args', 'scaler_args', 'metric_args', 'dim_reduction_args',\
                           'execution_args']
        
        # Create a Pandas Data Frame for the request data
        self.request_df = utils.request_df(self.request, row_template, col_headers)
               
        # Create a model that can be persisted to disk
        self.model = PersistentModel()
        
        # Get the model name from the request dataframe
        self.model.name = self.request_df.loc[0, 'model_name']
        
        # Get the argument strings from the request dataframe
        estimator_args = self.request_df.loc[0, 'estimator_args']
        scaler_args = self.request_df.loc[0, 'scaler_args']
        execution_args = self.request_df.loc[0, 'execution_args']
        if advanced:
            metric_args = self.request_df.loc[0, 'metric_args']
            dim_reduction_args = self.request_df.loc[0, 'dim_reduction_args']
            
            if len(dim_reduction_args) > 0:
                self.model.dim_reduction = True
            else:
                self.model.dim_reduction = False 
        
            # Set the relevant parameters using the argument strings
            self._set_params(estimator_args, scaler_args, execution_args, metric_args=metric_args,\
                             dim_reduction_args=dim_reduction_args)
        else:
            # Set the relevant parameters using the argument strings
            self._set_params(estimator_args, scaler_args, execution_args)
            self.model.dim_reduction = False 
        
        # 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, 'Model 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 setup ( self , advanced = False ) : # Interpret the request data based on the expected row and column structure row_template = [ 'strData' , 'strData' , 'strData' , 'strData' ] col_headers = [ 'model_name' , 'estimator_args' , 'scaler_args' , 'execution_args' ] if advanced : # If specified, get dimensionality reduction arguments row_template = [ 'strData' , 'strData' , 'strData' , 'strData' , 'strData' , 'strData' ] col_headers = [ 'model_name' , 'estimator_args' , 'scaler_args' , 'metric_args' , 'dim_reduction_args' , 'execution_args' ] # Create a Pandas Data Frame for the request data self . request_df = utils . request_df ( self . request , row_template , col_headers ) # Create a model that can be persisted to disk self . model = PersistentModel ( ) # Get the model name from the request dataframe self . model . name = self . request_df . loc [ 0 , 'model_name' ] # Get the argument strings from the request dataframe estimator_args = self . request_df . loc [ 0 , 'estimator_args' ] scaler_args = self . request_df . loc [ 0 , 'scaler_args' ] execution_args = self . request_df . loc [ 0 , 'execution_args' ] if advanced : metric_args = self . request_df . loc [ 0 , 'metric_args' ] dim_reduction_args = self . request_df . loc [ 0 , 'dim_reduction_args' ] if len ( dim_reduction_args ) > 0 : self . model . dim_reduction = True else : self . model . dim_reduction = False # Set the relevant parameters using the argument strings self . _set_params ( estimator_args , scaler_args , execution_args , metric_args = metric_args , dim_reduction_args = dim_reduction_args ) else : # Set the relevant parameters using the argument strings self . _set_params ( estimator_args , scaler_args , execution_args ) self . model . dim_reduction = False # 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 , 'Model 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