dlpy.metrics.plot_precision_recall¶
-
dlpy.metrics.
plot_precision_recall
(y_true, y_score, pos_label, castable=None, cutstep=0.001, figsize=(8, 8), fontsize_spec=None, linewidth=1, id_vars=None)¶ Plot the precision recall(PR) curve for binary classification tasks.
Parameters: - y_true : string or CASColumn
The column of the ground truth labels. If it is a string, then y_score has to be a string and they both belongs to the same CASTable specified by the castable argument. If it is a CASColumn, then y_score has to be a CASColumn, and the castable argument is ignored. When both y_score and y_true are CASColumn, they can be in different CASTable.
- y_score : string or CASColumn
The column of estimated probability for the positive class. If it is a string, then y_true has to be a string and they both belongs to the same CASTable specified by the castable argument. If it is a CASColumn, then y_true has to be a CASColumn, and the castable argument is ignored. When both y_score and y_true are CASColumn, they can be in different CASTable.
- pos_label : string, int or float
The positive class label.
- castable : CASTable, optional
The CASTable object to use as the source if the y_score and y_true are strings. Default = None
- cutstep : float > 0 and < 1, optional
The stepsize of threshold cutoffs. Default=0.001.
- figsize : tuple, optional
The size of the generated figure. Default=(8, 8).
- fontsize_spec : dict, optional
It specifies the fontsize for ‘xlabel’, ‘ylabel’, ‘xtick’, ‘ytick’ and ‘title’. (e.g. {‘xlabel’:14, ‘ylabel’:14}). If None, it will take the default fontsize, which are {‘xlabel’:16, ‘ylabel’:16, ‘xtick’:14, ‘ytick’:14, ‘title’:20} Default=None.
- linewidth : float, optional
It specify the line width for the ROC curve. Default=1.
- id_vars : string or list of strings, optional
Column names that serve as unique id for y_true and y_score if they are from different CASTables. The column names need to appear in both CASTables, and they serve to match y_true and y_score appropriately, since observation orders can be shuffled in distributed computing environment. Default = None.
Returns: - matplotlib.axes.Axes
- The x-axis is the recall(sensitivity) and the y-axis is the precision.