(self)
return self.response
Explain feature importances for the requested model
Explain feature importances for the requested model
Explain feature importances for the requested model
def explain_importances(self):
        """
        Explain feature importances for the requested model
        """

        # Get the model from cache or disk based on the model_name in request
        self._get_model_by_name()

        # Get the feature importances calculated in the calculate_metrics method
        try:
            self.response = self.model.importances
        except AttributeError:
            err = "Feature importances are not available. Check that the execution argument calculate_importances " +\
            "is set to True, and that test_size > 0 or the Calculate_Metrics function has been executed."
            raise Exception(err) 

        # Add the model name to the response and rearrange columns
        self.response.loc[:, "model_name"] = self.model.name
        self.response = self.response[["model_name", "feature_name", "importance"]]

        # Send the reponse table description to Qlik
        self._send_table_description("importances")
        
        # 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 explain_importances ( self ) : # Get the model from cache or disk based on the model_name in request self . _get_model_by_name ( ) # Get the feature importances calculated in the calculate_metrics method try : self . response = self . model . importances except AttributeError : err = "Feature importances are not available. Check that the execution argument calculate_importances " + "is set to True, and that test_size > 0 or the Calculate_Metrics function has been executed." raise Exception ( err ) # Add the model name to the response and rearrange columns self . response . loc [ : , "model_name" ] = self . model . name self . response = self . response [ [ "model_name" , "feature_name" , "importance" ] ] # Send the reponse table description to Qlik self . _send_table_description ( "importances" ) # 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