h2o-py/h2o/model/metrics_base.py
def plot(self, type="roc", server=False):
        """
        Produce the desired metric plot.

        :param type: the type of metric plot (currently, only ROC supported).
        :param server: if True, generate plot inline using matplotlib's "Agg" backend.
        :returns: None
        """
        # TODO: add more types (i.e. cutoffs)
        assert_is_type(type, "roc")
        # check for matplotlib. exit if absent.
        try:
            imp.find_module('matplotlib')
            import matplotlib
            if server: matplotlib.use('Agg', warn=False)
            import matplotlib.pyplot as plt
        except ImportError:
            print("matplotlib is required for this function!")
            return

        if type == "roc":
            plt.xlabel('False Positive Rate (FPR)')
            plt.ylabel('True Positive Rate (TPR)')
            plt.title('ROC Curve')
            plt.text(0.5, 0.5, r'AUC={0:.4f}'.format(self._metric_json["AUC"]))
            plt.plot(self.fprs, self.tprs, 'b--')
            plt.axis([0, 1, 0, 1])
            if not server: plt.show()
def plot(self, type="roc", server=False):
        # TODO: add more types (i.e. cutoffs)
        assert_is_type(type, "roc")
        # check for matplotlib. exit if absent.
        try:
            imp.find_module('matplotlib')
            import matplotlib
            if server: matplotlib.use('Agg', warn=False)
            import matplotlib.pyplot as plt
        except ImportError:
            print("matplotlib is required for this function!")
            return

        if type == "roc":
            plt.xlabel('False Positive Rate (FPR)')
            plt.ylabel('True Positive Rate (TPR)')
            plt.title('ROC Curve')
            plt.text(0.5, 0.5, r'AUC={0:.4f}'.format(self._metric_json["AUC"]))
            plt.plot(self.fprs, self.tprs, 'b--')
            plt.axis([0, 1, 0, 1])
            if not server: plt.show()
def plot ( self , type = "roc" , server = False ) : # TODO: add more types (i.e. cutoffs) assert_is_type ( type , "roc" ) # check for matplotlib. exit if absent. try : imp . find_module ( 'matplotlib' ) import matplotlib if server : matplotlib . use ( 'Agg' , warn = False ) import matplotlib . pyplot as plt except ImportError : print ( "matplotlib is required for this function!" ) return if type == "roc" : plt . xlabel ( 'False Positive Rate (FPR)' ) plt . ylabel ( 'True Positive Rate (TPR)' ) plt . title ( 'ROC Curve' ) plt . text ( 0.5 , 0.5 , r'AUC={0:.4f}' . format ( self . _metric_json [ "AUC" ] ) ) plt . plot ( self . fprs , self . tprs , 'b--' ) plt . axis ( [ 0 , 1 , 0 , 1 ] ) if not server : plt . show ( )
Produce the desired metric plot.

        :param type: the type of metric plot (currently, only ROC supported).
        :param server: if True, generate plot inline using matplotlib's "Agg" backend.
        :returns: None
Produce the desired metric plot .