Residual Plot

In [98]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
titanic["y"] = "2 * age + 1 + 40 * RANDOM()"
titanic["x"] = "age + RANDOM()"

from verticapy.learn.linear_model import LinearRegression
model = LinearRegression("model_family")
model.drop()
model.fit(titanic, ["x"], "y")
model.predict(titanic, name = "y_score")
titanic["residual"] = "y - y_score"
titanic.scatter(["y", "residual"])
Out[98]:
<AxesSubplot:xlabel='"y"', ylabel='"residual"'>