Model.contour

In [ ]:
Model.contour(nbins: int = 100, 
              pos_label: (int, float, str) = None, 
              ax=None, 
              **style_kwds,)

Draws the model's contour plot. Only available for regressors, binary classifiers, and for models of exactly two predictors.

Parameters

Name Type Optional Description
nbins
int
Number of bins used to discretize the two input numerical vcolumns.
pos_label
int / float / str
Label to consider as positive. All the other classes will be merged and considered as negative for multiclass classification.
ax
Matplotlib axes object
The axes to plot on.
**style_kwds
any
Any optional parameter to pass to the Matplotlib functions.

Returns

ax : Matplotlib axes object

Example

In [3]:
# XGBOOST
from verticapy.learn.ensemble import XGBoostClassifier
model = XGBoostClassifier("xgb_titanic",)
model.drop()
model.fit("public.titanic", 
          ["age", "fare",],
          "survived")
model.contour()
Out[3]:
<AxesSubplot:xlabel='"age"', ylabel='"fare"'>
In [5]:
# RandomForest
from verticapy.learn.ensemble import RandomForestClassifier
model = RandomForestClassifier("rf_titanic",)
model.drop()
model.fit("public.titanic", 
          ["age", "fare",],
          "survived")
model.contour()
Out[5]:
<AxesSubplot:xlabel='"age"', ylabel='"fare"'>
In [4]:
# NearestCentroid
from verticapy.learn.neighbors import NearestCentroid
model = NearestCentroid("neighbors_titanic",)
model.drop()
model.fit("public.titanic", 
          ["age", "fare",],
          "survived")
model.contour()
Out[4]:
<AxesSubplot:xlabel='"age"', ylabel='"fare"'>
In [5]:
# KNN
from verticapy.learn.neighbors import KNeighborsClassifier
model = KNeighborsClassifier("neighbors_titanic",)
model.drop()
model.fit("public.titanic", 
          ["age", "fare",],
          "survived")
model.contour()
Out[5]:
<AxesSubplot:xlabel='"age"', ylabel='"fare"'>
In [3]:
# NaiveBayes
from verticapy.learn.naive_bayes import NaiveBayes
model = NaiveBayes("nb_titanic",)
model.drop()
model.fit("public.titanic", 
          ["age", "fare",],
          "survived")
model.contour()
Out[3]:
<AxesSubplot:xlabel='"age"', ylabel='"fare"'>