Model.predict¶
In [ ]:
Model.predict(vdf: Union[str, vDataFrame],
X: list = [],
name: str = "",
inplace: bool = True,)
Makes a prediction using the input relation.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
vdf | str / vDataFrame | ❌ | Object to use to run the prediction. This can also be a customized relation, but you must use an alias. For example, "(SELECT 1) x" is correct whereas "(SELECT 1)" or "SELECT 1" are incorrect. |
X | list | ✓ | List of the columns used to deploy the models. If empty, the model predictors are used. |
name | str | ✓ | Name of the added vcolumn. If empty, a name is generated. |
inplace | bool | ✓ | If set to True, the prediction is added to the vDataFrame. |
In [5]:
from verticapy import vDataFrame
iris = vDataFrame("public.iris")
display(iris)
In [8]:
from verticapy.learn.neighbors import KNeighborsRegressor
model = KNeighborsRegressor(name = "public.KNN_iris")
model.fit("public.iris", ["PetalLengthCm", "PetalWidthCm"], "SepalLengthCm")
model.predict(iris,
X = ["PetalLengthCm", "PetalWidthCm"],
name = "iris_prediction")
Out[8]:
