Model.confusion_matrix

In [ ]:
Model.confusion_matrix(cutoff: float = 0.5)

Computes the model confusion matrix.

Parameters

Name Type Optional Description
cutoff
float
✓
Model Cutoff.

Returns

tablesample : An object containing the result. For more information, see utilities.tablesample.

Example

In [54]:
# Binary Classification
from verticapy.learn.ensemble import RandomForestClassifier
model = RandomForestClassifier(name = "public.RF_titanic",
                               n_estimators = 20,
                               max_features = "auto",
                               max_leaf_nodes = 32, 
                               sample = 0.7,
                               max_depth = 3,
                               min_samples_leaf = 5,
                               min_info_gain = 0.0,
                               nbins = 32)
model.fit("public.titanic", ["age", "fare", "gender"], "survived")
# Binary Classification: the cutoff is the probability
# to accept the class 1
model.confusion_matrix(cutoff = 0.5)
0
1
050897
1109282
Out[54]: