Loading...

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()
123
col
Numeric(22)
123
dbscan_cluster
Integer
10.90
21.090
31.10
41.20
51.30
61.50
72.01
82.21
9100.0-1
10102.0-1
Rows: 1-10 | Columns: 2

Note

Refer to DBSCAN for more information about the different methods and usages.