woodpecker/sklearn/decisiontree/decision_tree_structure_classifier.py
def show_leaf_impurity(self, figsize=None, display_type="plot"):
        """Show impurity for each leaf.

        If display_type = 'plot' it will show leaves impurities using a plot.
        If display_type = 'text' it will show leaves impurities as text. This method is preferred if number
        of leaves is very large and the plot became very big and hard to interpret.

        :param figsize: tuple of int
            The plot size
        :param display_type: str, optional
            'plot' or 'text'
        """

        self._calculate_leaf_nodes()
        leaf_impurity = [(i, self.impurity[i]) for i in range(0, self.node_count) if self.is_leaf[i]]
        leaves, impurity = zip(*leaf_impurity)

        if display_type == "plot":
            if figsize:
                plt.figure(figsize=figsize)
            plt.xticks(range(0, len(leaves)), leaves)
            plt.bar(range(0, len(leaves)), impurity, label="leaf impurity")
            plt.xlabel("leaf node ids", fontsize=20)
            plt.ylabel("impurity", fontsize=20)
            plt.grid()
            plt.legend()
        elif display_type == "text":
            for leaf, impurity in leaf_impurity:
                print(leaf, impurity)
Show impurity for each leaf.

        If display_type = 'plot' it will show leaves impurities using a plot.
        If display_type = 'text' it will show leaves impurities as text. This method is preferred if number
        of leaves is very large and the plot became very big and hard to interpret.

        :param figsize: tuple of int
            The plot size
        :param display_type: str, optional
            'plot' or 'text'
        
Show impurity for each leaf.
If display_type = 'plot' it will show leaves impurities using a plot.
If display_type = 'text' it will show leaves impurities as text. This method is preferred if number
of leaves is very large and the plot became very big and hard to interpret.
Show impurity for each leaf . If display_type = ' plot ' it will show leaves impurities using a plot . If display_type = ' text ' it will show leaves impurities as text . This method is preferred if number of leaves is very large and the plot became very big and hard to interpret .
def show_leaf_impurity(self, figsize=None, display_type="plot"):
        self._calculate_leaf_nodes()
        leaf_impurity = [(i, self.impurity[i]) for i in range(0, self.node_count) if self.is_leaf[i]]
        leaves, impurity = zip(*leaf_impurity)
        if display_type == "plot":
            if figsize:
                plt.figure(figsize=figsize)
            plt.xticks(range(0, len(leaves)), leaves)
            plt.bar(range(0, len(leaves)), impurity, label="leaf impurity")
            plt.xlabel("leaf node ids", fontsize=20)
            plt.ylabel("impurity", fontsize=20)
            plt.grid()
            plt.legend()
        elif display_type == "text":
            for leaf, impurity in leaf_impurity:
                print(leaf, impurity)
def show_leaf_impurity ( self , figsize = None , display_type = "plot" ) : self . _calculate_leaf_nodes ( ) leaf_impurity = [ ( i , self . impurity [ i ] ) for i in range ( 0 , self . node_count ) if self . is_leaf [ i ] ] leaves , impurity = zip ( * leaf_impurity ) if display_type == "plot" : if figsize : plt . figure ( figsize = figsize ) plt . xticks ( range ( 0 , len ( leaves ) ) , leaves ) plt . bar ( range ( 0 , len ( leaves ) ) , impurity , label = "leaf impurity" ) plt . xlabel ( "leaf node ids" , fontsize = 20 ) plt . ylabel ( "impurity" , fontsize = 20 ) plt . grid ( ) plt . legend ( ) elif display_type == "text" : for leaf , impurity in leaf_impurity : print ( leaf , impurity )
Show impurity for each leaf.
Show impurity for each leaf .
"""Show impurity for each leaf.

        If display_type = 'plot' it will show leaves impurities using a plot.
        If display_type = 'text' it will show leaves impurities as text. This method is preferred if number
        of leaves is very large and the plot became very big and hard to interpret.

        :param figsize: tuple of int
            The plot size
        :param display_type: str, optional
            'plot' or 'text'
        """
self
figsize
tuple of int
The plot size
tuple of int The plot size
display_type
str, optional
'plot' or 'text'
str optional ' plot ' or ' text '