validation_curve

In [ ]:
validation_curve(estimator,
                 param_name: str,
                 param_range: list,
                 input_relation: (str, vDataFrame),
                 X: list,
                 y: str,
                 metric: str = "auto",
                 cv: int = 3,
                 pos_label: (int, float, str) = None,
                 cutoff: float = -1,
                 std_coeff: float = 1,
                 ax=None,
                 **style_kwds,)

Draws the validation curve.

Parameters

Name Type Optional Description
estimator
object
Vertica estimator having a fit method.
param_name
str
Parameter name.
param_range
list
Parameter Range.
input_relation
str / vDataFrame
Input Relation.
X
list
List of the predictor columns.
y
str
Response Column.
metric
str / list
Metric used to do the model evaluation. It can also be a list of metrics.
  • auto : logloss for classification & rmse for regression.

For Classification:
  • accuracy : Accuracy
  • auc : Area Under the Curve (ROC)
  • bm : Informedness = tpr + tnr - 1
  • csi : Critical Success Index = tp / (tp + fn + fp)
  • f1 : F1 Score
  • logloss : Log Loss
  • mcc : Matthews Correlation Coefficient
  • mk : Markedness = ppv + npv - 1
  • npv : Negative Predictive Value = tn / (tn + fn)
  • prc_auc : Area Under the Curve (PRC)
  • precision : Precision = tp / (tp + fp)
  • recall : Recall = tp / (tp + fn)
  • specificity : Specificity = tn / (tn + fp)

For Regression:
  • max : Max Error
  • mae : Mean Absolute Error
  • median : Median Absolute Error
  • mse : Mean Squared Error
  • msle : Mean Squared Log Error
  • r2 : R-squared coefficient
  • r2a : R2 adjusted
  • rmse : Root Mean Squared Error
  • var : Explained Variance
cv
int
Number of folds.
pos_label
int / float / str
The main class to be considered as positive (classification only).
cutoff
float
The model cutoff (classification only).
std_coeff
float
Value of the standard deviation coefficient used to compute the area plot around each score.
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 [5]:
from verticapy.learn.ensemble import RandomForestClassifier
model = RandomForestClassifier(name = "public.RF_titanic")

from verticapy.learn.model_selection import validation_curve
validation_curve(model,
                 "max_depth",
                 [1, 5, 8, 10, 20, 30, 40, 50, 60],
                 input_relation = "public.titanic_clean", 
                 X = ["age", "fare", "parch",],
                 y = "survived", 
                 cv = 3,
                 metric = "auc",)
Out[5]:
max_depth
training_score_lower
training_score
training_score_upper
test_score_lower
test_score
test_score_upper
110.6582637072298270.68180031621258570.70533692519534450.61081438530784260.64037097197109540.6699275586343482
250.76134705137058370.76930065528368430.77725425919678490.67720733860778340.69231135072029220.7074153628328009
380.82004366489259850.8245153581989330.82898705150526740.66614425147838090.67513308907223730.6841219266660938
4100.83473113332950330.84499177871019740.85525242409089140.6338770724644020.64718772134718750.660498370229973
5200.83947485902985990.84803231916349340.8565897792971270.66339391426951470.67936294227123880.695331970272963
6300.84337296983946410.84720432078715670.85103567173484930.63637745098739220.65606633670212030.6757552224168485
7400.8536525379307110.86311698222395960.87258142651720820.63859351392709610.66080571866758380.6830179234080714
8500.84192205957488790.84888154147601710.85584102337714640.65496379050751470.65954933176548720.6641348730234597
9600.85050643534189010.85534105431225570.86017567328262130.65334257285213990.65891270446032630.6644828360685128
Rows: 1-9 | Columns: 7