woodpecker/sklearn/decisiontree/decision_tree_structure.py
def show_leaf_samples(self, figsize=(10, 5), display_type="plot"):
        """Show number of training samples from each leaf.

        If display_type = 'plot' it will show leaves samples using a plot.
        If display_type = 'text' it will show leaves samples as text. This method is preferred if number
        of leaves is very large and we cannot determine clearly the leaves from the plot.

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

        self._calculate_leaf_nodes()
        leaf_samples = [(i, self.n_node_samples[i]) for i in range(0, self.node_count) if self.is_leaf[i]]
        x, y = zip(*leaf_samples)

        if display_type == "plot":
            if figsize:
                plt.figure(figsize=figsize)
            plt.xticks(range(0, len(x)), x)
            plt.bar(range(0, len(x)), y)
            plt.xlabel("leaf node ids", size=20)
            plt.ylabel("samples count", size=20)
            plt.grid()
        elif display_type == "text":
            for leaf, samples in leaf_samples:
                print(leaf, samples)
Show number of training samples from each leaf.

        If display_type = 'plot' it will show leaves samples using a plot.
        If display_type = 'text' it will show leaves samples as text. This method is preferred if number
        of leaves is very large and we cannot determine clearly the leaves from the plot.

        :param figsize: tuple of int
            The plot size
        :param display_type: str, optional
            'plot' or 'text'
        
Show number of training samples from each leaf.
If display_type = 'plot' it will show leaves samples using a plot.
If display_type = 'text' it will show leaves samples as text. This method is preferred if number
of leaves is very large and we cannot determine clearly the leaves from the plot.
Show number of training samples from each leaf . If display_type = ' plot ' it will show leaves samples using a plot . If display_type = ' text ' it will show leaves samples as text . This method is preferred if number of leaves is very large and we cannot determine clearly the leaves from the plot .
def show_leaf_samples(self, figsize=(10, 5), display_type="plot"):
        self._calculate_leaf_nodes()
        leaf_samples = [(i, self.n_node_samples[i]) for i in range(0, self.node_count) if self.is_leaf[i]]
        x, y = zip(*leaf_samples)
        if display_type == "plot":
            if figsize:
                plt.figure(figsize=figsize)
            plt.xticks(range(0, len(x)), x)
            plt.bar(range(0, len(x)), y)
            plt.xlabel("leaf node ids", size=20)
            plt.ylabel("samples count", size=20)
            plt.grid()
        elif display_type == "text":
            for leaf, samples in leaf_samples:
                print(leaf, samples)
def show_leaf_samples ( self , figsize = ( 10 , 5 ) , display_type = "plot" ) : self . _calculate_leaf_nodes ( ) leaf_samples = [ ( i , self . n_node_samples [ i ] ) for i in range ( 0 , self . node_count ) if self . is_leaf [ i ] ] x , y = zip ( * leaf_samples ) if display_type == "plot" : if figsize : plt . figure ( figsize = figsize ) plt . xticks ( range ( 0 , len ( x ) ) , x ) plt . bar ( range ( 0 , len ( x ) ) , y ) plt . xlabel ( "leaf node ids" , size = 20 ) plt . ylabel ( "samples count" , size = 20 ) plt . grid ( ) elif display_type == "text" : for leaf , samples in leaf_samples : print ( leaf , samples )
Show number of training samples from each leaf.
Show number of training samples from each leaf .
"""Show number of training samples from each leaf.

        If display_type = 'plot' it will show leaves samples using a plot.
        If display_type = 'text' it will show leaves samples as text. This method is preferred if number
        of leaves is very large and we cannot determine clearly the leaves from the plot.

        :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 '