classification/tree_manager.py
def plot_scores(self):
        """
        Plots the train accuracy, test accuracy, test precision and test recall, and saves them in
        the data folder.
        Also saves the scores in the data folder in 'scores.csv'
        """
        results_path = DATA_PATH.joinpath("results")
        if not results_path.is_dir():
            os.mkdir(results_path)

        scores = DataFrame(columns=["Import", "Months", "Train Accuracy", "Test Accuracy",
                                    "Precision", "Recall"])

        for importance, tree_list in self.trees.items():
            for i, tree in enumerate(tree_list):
                train_accuracy, test_accuracy, precision, recall = tree.get_scores()
                scores.loc[len(scores)] = [importance, i+1, train_accuracy, test_accuracy,
                                           precision, recall]

        for i, col in enumerate(scores.columns.values):
            if col == "Months" or col == "Import":
                continue

            pivot_scores = pandas.pivot_table(scores, values=col, index="Months", columns="Import")
            ax = pivot_scores.plot(kind='bar')
            ax.set_ylim([0, 1])
            plt.xticks(rotation=None)
            plt.title(col)
            plt.xlabel("Months of assessments")
            plt.ylabel(col)
            plt.legend(loc="lower right")

            path = str(results_path.joinpath(col + ".png"))
            plt.savefig(path)

        score_path = str(results_path.joinpath("scores.csv"))
        scores.to_csv(score_path)

        Plots the train accuracy, test accuracy, test precision and test recall, and saves them in
        the data folder.
        Also saves the scores in the data folder in 'scores.csv'
        
Plots the train accuracy, test accuracy, test precision and test recall, and saves them in
the data folder.
Also saves the scores in the data folder in 'scores.csv'
Plots the train accuracy test accuracy test precision and test recall and saves them in the data folder . Also saves the scores in the data folder in ' scores . csv '
def plot_scores(self):
        results_path = DATA_PATH.joinpath("results")
        if not results_path.is_dir():
            os.mkdir(results_path)
        scores = DataFrame(columns=["Import", "Months", "Train Accuracy", "Test Accuracy",
                                    "Precision", "Recall"])
        for importance, tree_list in self.trees.items():
            for i, tree in enumerate(tree_list):
                train_accuracy, test_accuracy, precision, recall = tree.get_scores()
                scores.loc[len(scores)] = [importance, i+1, train_accuracy, test_accuracy,
                                           precision, recall]
        for i, col in enumerate(scores.columns.values):
            if col == "Months" or col == "Import":
                continue
            pivot_scores = pandas.pivot_table(scores, values=col, index="Months", columns="Import")
            ax = pivot_scores.plot(kind='bar')
            ax.set_ylim([0, 1])
            plt.xticks(rotation=None)
            plt.title(col)
            plt.xlabel("Months of assessments")
            plt.ylabel(col)
            plt.legend(loc="lower right")
            path = str(results_path.joinpath(col + ".png"))
            plt.savefig(path)
        score_path = str(results_path.joinpath("scores.csv"))
        scores.to_csv(score_path)
def plot_scores ( self ) : results_path = DATA_PATH . joinpath ( "results" ) if not results_path . is_dir ( ) : os . mkdir ( results_path ) scores = DataFrame ( columns = [ "Import" , "Months" , "Train Accuracy" , "Test Accuracy" , "Precision" , "Recall" ] ) for importance , tree_list in self . trees . items ( ) : for i , tree in enumerate ( tree_list ) : train_accuracy , test_accuracy , precision , recall = tree . get_scores ( ) scores . loc [ len ( scores ) ] = [ importance , i + 1 , train_accuracy , test_accuracy , precision , recall ] for i , col in enumerate ( scores . columns . values ) : if col == "Months" or col == "Import" : continue pivot_scores = pandas . pivot_table ( scores , values = col , index = "Months" , columns = "Import" ) ax = pivot_scores . plot ( kind = 'bar' ) ax . set_ylim ( [ 0 , 1 ] ) plt . xticks ( rotation = None ) plt . title ( col ) plt . xlabel ( "Months of assessments" ) plt . ylabel ( col ) plt . legend ( loc = "lower right" ) path = str ( results_path . joinpath ( col + ".png" ) ) plt . savefig ( path ) score_path = str ( results_path . joinpath ( "scores.csv" ) ) scores . to_csv ( score_path )
Plots the train accuracy, test accuracy, test precision and test recall, and saves them in
the data folder.
Plots the train accuracy test accuracy test precision and test recall and saves them in the data folder .
"""
        Plots the train accuracy, test accuracy, test precision and test recall, and saves them in
        the data folder.
        Also saves the scores in the data folder in 'scores.csv'
        """
self