r2_score¶
In [ ]:
r2_score(y_true: str,
y_score: str,
input_relation: (str, vDataFrame),
cursor = None,
k: int = 0)
Computes the R2 Score.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
y_true | str | ❌ | Response column. |
y_score | str | ❌ | Prediction. |
input_relation | str / vDataFrame | ❌ | Relation to use to do the scoring. The relation can be a view or a table or even a customized relation. For example, you could write: "(SELECT ... FROM ...) x" as long as an alias is given at the end of the relation. |
cursor | DBcursor | ✓ | Vertica DB cursor. |
k | int | ✓ | Number of predictors. Only used to compute the adjusted-R2. |
Returns¶
float : score
Example¶
In [3]:
from verticapy import vDataFrame
vDataFrame("regression_example")
Out[3]:
In [5]:
from verticapy.learn.metrics import r2_score
r2_score("y_true", "y_score", "regression_example")
Out[5]:
