コード例 #1
0
ファイル: analysis.py プロジェクト: congyuandong/adagio
    def plot_average_rocs(self, filename, roc_pickles, boundary=0.1):
        """
        Average several ROC curves from different models and plot
        them together in the same figure.

        :filename: name of the file to save the plot
        :boundary: upper False Positive limit for the roc plot
        :roc_pickles: list of pz file names containing several rocs each
        :returns: None. It saves the roc plot in a png file with the
            specified filename
        """

        fps = np.linspace(0.0, 1.0, 10000)
        plt.figure(figsize=(18.5, 10.5))
        linestyles = ['k-', 'k--', 'k-.', 'k:', 'k.',
                      'k*', 'k^', 'ko', 'k+', 'kx']
        for f, style in zip(roc_pickles, linestyles[:len(roc_pickles)]):
            avg_roc, std_roc = eval.average_roc(pz.load(f), fps)
            plt.plot(avg_roc[1], avg_roc[0], style)
        plt.legend(roc_pickles, 'lower right', shadow=True)
        plt.xlabel('False Positive Rate')
        plt.xlim((0.0, boundary))
        plt.ylabel('True Positive Rate')
        plt.ylim((0.0, 1.0))
        plt.title("Average ROCs")
        plt.grid(True)
        plt.savefig(filename, format='png')
コード例 #2
0
ファイル: analysis.py プロジェクト: sherplus/adagio
    def plot_average_rocs(self, filename, roc_pickles, boundary=0.1):
        """
        Average several ROC curves from different models and plot
        them together in the same figure.

        :filename: name of the file to save the plot
        :boundary: upper False Positive limit for the roc plot
        :roc_pickles: list of pz file names containing several rocs each
        :returns: None. It saves the roc plot in a png file with the
            specified filename
        """

        fps = np.linspace(0.0, 1.0, 10000)
        plt.figure(figsize=(18.5, 10.5))
        linestyles = [
            'k-', 'k--', 'k-.', 'k:', 'k.', 'k*', 'k^', 'ko', 'k+', 'kx'
        ]
        for f, style in zip(roc_pickles, linestyles[:len(roc_pickles)]):
            avg_roc, std_roc = eval.average_roc(pz.load(f), fps)
            plt.plot(avg_roc[1], avg_roc[0], style)
        plt.legend(roc_pickles, 'lower right', shadow=True)
        plt.xlabel('False Positive Rate')
        plt.xlim((0.0, boundary))
        plt.ylabel('True Positive Rate')
        plt.ylim((0.0, 1.0))
        plt.title("Average ROCs")
        plt.grid(True)
        plt.savefig(filename, format='png')
コード例 #3
0
ファイル: analysis.py プロジェクト: congyuandong/adagio
    def plot_average_roc(self, filename, boundary=0.1):
        """
        Plot an average roc curve up to boundary using the rocs object
        of the the Analysis object. It can be called after
        run_linear_experiment. 

        :filename: name of the file to save the roc plot
        :boundary: upper False Positive limit for the roc plot
        :returns: None. It saves the roc plot in a png file with
            the specified filename
        """

        fps = np.linspace(0.0, 1.0, 10000)
        (avg_roc, std_roc) = eval.average_roc(self.rocs, fps)
        std0 = std_roc[1]
        std1 = avg_roc[0] + std_roc[0]
        std2 = avg_roc[0] - std_roc[0]
        plt.plot(avg_roc[1], avg_roc[0], 'k-',
                 std0, std1, 'k--', std0, std2, 'k--')
        plt.legend(('Average ROC', 'StdDev ROC'), 'lower right', shadow=True)
        plt.xlabel('False Positive Rate')
        plt.xlim((0.0, boundary))
        plt.ylabel('True Positive Rate')
        plt.ylim((0.0, 1.0))
        plt.title("Average ROC")
        plt.grid(True)
        plt.savefig(filename, format='png')
コード例 #4
0
ファイル: analysis.py プロジェクト: sherplus/adagio
    def plot_average_roc(self, filename, boundary=0.1):
        """
        Plot an average roc curve up to boundary using the rocs object
        of the the Analysis object. It can be called after
        run_linear_experiment. 

        :filename: name of the file to save the roc plot
        :boundary: upper False Positive limit for the roc plot
        :returns: None. It saves the roc plot in a png file with
            the specified filename
        """

        fps = np.linspace(0.0, 1.0, 10000)
        (avg_roc, std_roc) = eval.average_roc(self.rocs, fps)
        std0 = std_roc[1]
        std1 = avg_roc[0] + std_roc[0]
        std2 = avg_roc[0] - std_roc[0]
        plt.plot(avg_roc[1], avg_roc[0], 'k-', std0, std1, 'k--', std0, std2,
                 'k--')
        plt.legend(('Average ROC', 'StdDev ROC'), 'lower right', shadow=True)
        plt.xlabel('False Positive Rate')
        plt.xlim((0.0, boundary))
        plt.ylabel('True Positive Rate')
        plt.ylim((0.0, 1.0))
        plt.title("Average ROC")
        plt.grid(True)
        plt.savefig(filename, format='png')