roc_curve¶
In [ ]:
roc_curve(y_true: str,
y_score: str,
input_relation: (str, vDataFrame),
pos_label: (int, float, str) = 1,
nbins: int = 30,
auc_roc: bool = False,
best_threshold: bool = False,
cutoff_curve: bool = False,
ax=None,
**style_kwds,)
Draws the ROC Curve.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
y_true | str | ❌ | Response column. |
y_score | str | ❌ | Prediction Probability. |
input_relation | str / vDataFrame | ❌ | Relation to use to do the scoring. The relation can be a view or a table or even a customized relation. For example, you could write: "(SELECT ... FROM ...) x" as long as an alias is given at the end of the relation. |
pos_label | int / float / str | ✓ | To compute the ROC Curve, one of the response column class has to be the positive one. The parameter 'pos_label' represents this class. |
nbins | int | ✓ | Curve number of bins. |
auc_roc | bool | ✓ | If set to True, the function will return the ROC AUC without drawing the curve. |
best_threshold | bool | ✓ | If set to True, the function will return the best threshold without drawing the curve. The best threshold is the threshold of the point which is the farest from the random line. |
cutoff_curve | bool | ✓ | If set to True, the Cutoff curve will be drawn. |
ax | Matplotlib axes object | ✓ | The axes to plot on. |
**style_kwds | any | ✓ | Any optional parameter to pass to the Matplotlib functions. |
Returns¶
tablesample : An object containing the result. For more information, see utilities.tablesample.
Example¶
In [9]:
from verticapy import vDataFrame
vDataFrame("example_classification")
Out[9]:
In [11]:
from verticapy.learn.model_selection import roc_curve
roc_curve("y_true", "y_score", "example_classification")
Out[11]:
In [12]:
roc_curve("y_true",
"y_score",
"example_classification",
cutoff_curve = True)
Out[12]:
In [8]:
# Best Cutoff
roc_curve("y_true",
"y_score",
"example_classification",
best_threshold = True)
Out[8]:
