Model.decision_function¶
In [ ]:
Model.decision_function(vdf: Union[str, vDataFrame],
X: list = [],
name: str = "",
inplace: bool = True)
Returns the anomaly score using the input relation.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
vdf | str / vDataFrame | ❌ | Object to use to run the prediction. It can also be a customized relation but you need to englobe it using 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 will be used. |
name | str | ✓ | Name of the added vcolumn. If empty, a name will be generated. |
inplace | bool | ✓ | If set to True, the prediction will be added to the vDataFrame. |
In [20]:
from verticapy import vDataFrame
iris = vDataFrame("public.iris")
display(iris)
In [21]:
from verticapy.learn.ensemble import IsolationForest
model = IsolationForest(name = "public.iforest_iris",)
model.fit("public.iris", ["PetalLengthCm", "PetalWidthCm"],)
model.decision_function(iris,
X = ["PetalLengthCm", "PetalWidthCm"],
name = "anomaly_score")
Out[21]:
