woodpecker/sklearn/decisiontree/decision_tree_structure_regressor.py
def show_leaf_regression_criteria(self, figsize=(10, 5), display_type="plot"):
        """Visualize leaf regression criterias for each leaf.

        Main criterias for regression trees are MAE and MSE.
        Visualising them, it is easier to see each leaf performance. You can visualize the criterias in both plain text
        and plots.

        :param figsize: tuple of int, optional
            The plot size
        :param display_type: str, optional
            Display type can be text or plot. (default 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)
            plt.xlabel("leaf node ids", fontsize=20)
            plt.ylabel(f"leaf {self.tree.criterion.upper()}", fontsize=20)
            plt.grid()
            # plt.legend()
        elif display_type == "text":
            for leaf, impurity in leaf_impurity:
                print(leaf, impurity)
Visualize leaf regression criterias for each leaf.

        Main criterias for regression trees are MAE and MSE.
        Visualising them, it is easier to see each leaf performance. You can visualize the criterias in both plain text
        and plots.

        :param figsize: tuple of int, optional
            The plot size
        :param display_type: str, optional
            Display type can be text or plot. (default plot)
        
Visualize leaf regression criterias for each leaf.
Main criterias for regression trees are MAE and MSE.
Visualising them, it is easier to see each leaf performance. You can visualize the criterias in both plain text
and plots.
Visualize leaf regression criterias for each leaf . Main criterias for regression trees are MAE and MSE . Visualising them it is easier to see each leaf performance . You can visualize the criterias in both plain text and plots .
def show_leaf_regression_criteria(self, figsize=(10, 5), 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)
            plt.xlabel("leaf node ids", fontsize=20)
            plt.ylabel(f"leaf {self.tree.criterion.upper()}", fontsize=20)
            plt.grid()
        elif display_type == "text":
            for leaf, impurity in leaf_impurity:
                print(leaf, impurity)
def show_leaf_regression_criteria ( self , figsize = ( 10 , 5 ) , 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 ) plt . xlabel ( "leaf node ids" , fontsize = 20 ) plt . ylabel ( f"leaf {self.tree.criterion.upper()}" , fontsize = 20 ) plt . grid ( ) elif display_type == "text" : for leaf , impurity in leaf_impurity : print ( leaf , impurity )
Visualize leaf regression criterias for each leaf.
Visualize leaf regression criterias for each leaf .
"""Visualize leaf regression criterias for each leaf.

        Main criterias for regression trees are MAE and MSE.
        Visualising them, it is easier to see each leaf performance. You can visualize the criterias in both plain text
        and plots.

        :param figsize: tuple of int, optional
            The plot size
        :param display_type: str, optional
            Display type can be text or plot. (default plot)
        """ # plt.legend()
self
figsize
tuple of int, optional
The plot size
tuple of int optional The plot size
display_type
str, optional
Display type can be text or plot. (default plot)
str optional Display type can be text or plot . ( default plot )