DBSCAN (Beta)

In [ ]:
DBSCAN(name: str,
       eps: float = 0.5,
       min_samples: int = 5,
       p: int = 2)

Creates a DBSCAN object by using the DBSCAN algorithm as defined by Martin Ester, Hans-Peter Kriegel, Jörg Sander, and Xiaowei Xu. This object uses pure SQL to compute all the distances and neighbors and uses Python to compute the cluster propagation (non-scalable phase).

⚠ Warning: This algorithm is computationally expensive; It uses a CROSS JOIN during the computation, the complexity of which is O(n * n), where n is the total number of elements. It will index all the elements of the table in order to be optimal (the CROSS JOIN will happen only with IDs which are integers). As DBSCAN is using the p-distance, it is highly sensitive to unnormalized data. However, DBSCAN is robust to outliers and can find non-linear clusters and is a very powerful algorithm for detecting outliers and clustering. A table will be created at the end of the learning phase.

Parameters

Name Type Optional Description
name
str
❌
Name of the the model. This name is used to build the final table.
eps
float
✓
The radius of a neighborhood with respect to some point.
min_samples
int
✓
The minimum number of points required to form a dense region.
p
int
✓
The p of the p-distance (distance metric used during model-computation).

Attributes

After the object is created, all parameters become attributes. Additional attributes will be created when fitting the model:

Name Type Description
n_cluster_
int
Number of clusters created during the process.
n_noise_
int
Number of points with no clusters.
input_relation
str
Training relation.
X
list
List of the predictors.
key_columns
list
Columns not used during algorithm computation but will be used to create the final relation.

Methods

Name Description
fit Trains the model.
plot Draws the model if the number of predictors is 2 or 3.
get_attr Returns the model attribute.
get_params Returns the model parameters.
predict Creates a vDataFrame of the model.
set_params Sets the parameters of the model.

Example

In [1]:
from verticapy.learn.cluster import DBSCAN
model = DBSCAN(name = "public.DBSCAN_heart")
display(model)
<DBSCAN>