verticapy.machine_learning.vertica.cluster.DBSCAN.predict#
- DBSCAN.predict() vDataFrame #
Creates a
vDataFrame
of the model.Returns#
- vDataFrame
the
vDataFrame
including the prediction.
Examples#
Let’s start by importing
verticapy
:import verticapy as vp
For this example, we will create a small dataset.
data = vp.vDataFrame( { "col": [1.2, 1.1, 1.3, 1.5, 2, 2.2, 1.09, 0.9, 100, 102], } )
Then we import the model:
from verticapy.machine_learning.vertica import DBSCAN
Then we can create the model:
model = DBSCAN( eps = 0.5, min_samples = 2, p = 2, )
Once the model is initialized we can fit the model:
model.fit(data, X = ["col"])
And lastly we can use the trained model to predict:
model.predict()
123colNumeric(22)123dbscan_clusterInteger1 0.9 0 2 1.09 0 3 1.1 0 4 1.2 0 5 1.3 0 6 1.5 0 7 2.0 1 8 2.2 1 9 100.0 -1 10 102.0 -1 Rows: 1-10 | Columns: 2Note
Refer to
DBSCAN
for more information about the different methods and usages.