Loading...

vastorbit.machine_learning.vast.cluster.DBSCAN.fit

DBSCAN.fit(input_relation: Annotated[str | VastFrame, ''], X: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, key_columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, index: str | None = None, return_report: bool = False) None

Trains the model.

Parameters:
  • input_relation (SQLRelation) – Training relation.

  • X (SQLColumns, optional) – list of the predictors. If empty, all the numerical :py:class:`~VastColumn are used.

  • key_columns (SQLColumns, optional) – Columns not used during the algorithm computation but which are used to create the final relation.

  • index (str, optional) – Index used to identify each row separately. It is highly recommanded to have one already in the main table to avoid creating temporary tables.

Examples

Let’s start by importing vastorbit:

import vastorbit as vo

For this example, we will create a small dataset.

data = vo.VastFrame({"col":[1.2, 1.1, 1.3, 1.5, 2, 2.2, 1.09, 0.9, 100, 102]})

Then we import the model:

from vastorbit.machine_learning.vast 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"])

Note

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