Model.score

In [ ]:
Model.score(method: str = "r2")

Scores the model.

Parameters

Name Type Optional Description
method
str
The method to use to score the model.
  • aic : Akaike’s Information Criterion
  • bic : Bayesian Information Criterion
  • 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-square Error
  • var : Explained variance

Returns

float : score

Example

In [34]:
from verticapy.learn.ensemble import RandomForestRegressor
model = RandomForestRegressor(name = "public.RF_winequality",
                              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.winequality", 
          ["alcohol", "fixed_acidity", "pH", "density"], 
          "quality")
# R2
model.score(method = "r2")
Out[34]:
0.216696276202655
In [35]:
# MSLE
model.score(method = "msle")
Out[35]:
0.00252843985480557
In [36]:
# Mean Absolute Error
model.score(method = "mae")
Out[36]:
0.626849198590535