Model.score¶
In [ ]:
Model.score(method: str = "accuracy",
pos_label: Union[int, float, str] = None,
cutoff: float = -1,
nbins: int = 10000,)
Computes the model score.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
method | str | ✓ | The method to use to compute the score.
|
pos_label | int / float / str | ✓ | Label to consider as positive. All the other classes will be merged and considered as negative in case of multi classification. |
cutoff | float | ✓ | Cutoff for which the tested category will be accepted as prediction. If the parameter is not between 0 and 1, an automatic cutoff is computed. |
nbins | int | ✓ | [Only when method is set to auc|prc_auc|best_cutoff] An integer value that determines the number of decision boundaries. Decision boundaries are set at equally spaced intervals between 0 and 1, inclusive. Greater values for nbins give more precise estimations of the AUC, but can potentially decrease performance. The maximum value is 999,999. If negative, the maximum value is used. |
In [26]:
# Multiclass Classification
from verticapy.learn.ensemble import RandomForestClassifier
model = RandomForestClassifier(name = "public.RF_iris",
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.iris", ["PetalLengthCm", "PetalWidthCm"], "Species")
# Logloss
model.score(method = "log_loss", pos_label = "Iris-virginica")
Out[26]:
In [27]:
# Global accuracy
model.score(method = "accuracy")
Out[27]:
