stackboost/core.py
def __calculate_importance(self, importance: np.ndarray, tree: DecisionNode = None) -> np.ndarray:
        """
        Inner function used to calculated feature importances

        :param importance: array of importances
        :param tree: the current tree node
        :return: array of importances
        """
        # if tree is none, than we treat it as a root
        if tree is None:
            tree = self.root

        # if both tree branches are None than the node ia s leaf
        if tree.is_leaf():
            return importance

        importance[tree.feature_i] += tree.importance

        return self.__calculate_importance(importance, tree=tree.true_branch) + \
               self.__calculate_importance(importance, tree=tree.false_branch)

        Inner function used to calculated feature importances

        :param importance: array of importances
        :param tree: the current tree node
        :return: array of importances
        
Inner function used to calculated feature importances
Inner function used to calculated feature importances
def __calculate_importance(self, importance: np.ndarray, tree: DecisionNode = None) -> np.ndarray:
        if tree is None:
            tree = self.root
        if tree.is_leaf():
            return importance
        importance[tree.feature_i] += tree.importance
        return self.__calculate_importance(importance, tree=tree.true_branch) + \
               self.__calculate_importance(importance, tree=tree.false_branch)
def __calculate_importance ( self , importance : np . ndarray , tree : DecisionNode = None ) -> np . ndarray : if tree is None : tree = self . root if tree . is_leaf ( ) : return importance importance [ tree . feature_i ] += tree . importance return self . __calculate_importance ( importance , tree = tree . true_branch ) + self . __calculate_importance ( importance , tree = tree . false_branch )
Inner function used to calculated feature importances
Inner function used to calculated feature importances
"""
        Inner function used to calculated feature importances

        :param importance: array of importances
        :param tree: the current tree node
        :return: array of importances
        """ # if tree is none, than we treat it as a root # if both tree branches are None than the node ia s leaf
array of importances
array of importances
self
importance
np.ndarray
array of importances
array of importances
tree
DecisionNode
the current tree node
the current tree node