(self)
return self.response_df
Get a string that can be evaluated in Qlik to get the features portion of the predict function
Get a string that can be evaluated in Qlik to get the features portion of the predict function
Get a string that can be evaluated in Qlik to get the features portion of the predict function
def get_features_expression(self):
        """
        Get a string that can be evaluated in Qlik to get the features portion of the predict function
        """
        
        # Interpret the request data based on the expected row and column structure
        row_template = ['strData']
        col_headers = ['model_name']
        
        # Interpret the request data based on the expected row and column structure
        self._initiate(row_template, col_headers)

        # Get meta data for the model
        self._get_model(load=False)

        # Prepare the expression as a string
        delimiter = " &'|'& "

        # Set features that are not expected in the features expression in Qlik
        exclude = ["excluded", "target", "identifier"]

        # Exclude columns that are not expected in the request data
        exclusions = self.features_df['variable_type'].isin(exclude)
        self.features_df = self.features_df.loc[~exclusions]

        # Get the feature names
        features = self.features_df["name"].tolist()
        
        # Prepare a string which can be evaluated to an expression in Qlik with features as field names
        self.response_df = pd.Series(delimiter.join(["[" + f + "]" for f in features]))

        # Send the reponse table description to Qlik
        self._send_table_description("expression")
        
        # Finally send the response
        return self.response_df
def get_features_expression ( self ) : # Interpret the request data based on the expected row and column structure row_template = [ 'strData' ] col_headers = [ 'model_name' ] # Interpret the request data based on the expected row and column structure self . _initiate ( row_template , col_headers ) # Get meta data for the model self . _get_model ( load = False ) # Prepare the expression as a string delimiter = " &'|'& " # Set features that are not expected in the features expression in Qlik exclude = [ "excluded" , "target" , "identifier" ] # Exclude columns that are not expected in the request data exclusions = self . features_df [ 'variable_type' ] . isin ( exclude ) self . features_df = self . features_df . loc [ ~ exclusions ] # Get the feature names features = self . features_df [ "name" ] . tolist ( ) # Prepare a string which can be evaluated to an expression in Qlik with features as field names self . response_df = pd . Series ( delimiter . join ( [ "[" + f + "]" for f in features ] ) ) # Send the reponse table description to Qlik self . _send_table_description ( "expression" ) # Finally send the response return self . response_df