Loading...

vastorbit.machine_learning.memmodel.cluster.BisectingKMeans.predict_sql

BisectingKMeans.predict_sql(X: Annotated[list | ndarray, 'Array Like Structure']) str

Returns the SQL code needed to deploy the BisectingKMeans model using its attributes.

Parameters:

X (ArrayLike) – The names or values of the input predictors.

Returns:

SQL code.

Return type:

str

Examples

Import the required module.

from vastorbit.machine_learning.memmodel.cluster import BisectingKMeans

We will use the following attributes:

clusters = [
    [0.5, 0.6],
    [1, 2],
    [100, 200],
    [10, 700],
    [-100, -200],
]
children_left = [1, 3, None, None, None]
children_right = [2, 4, None, None, None]

Let’s create a model.

model_bkm = BisectingKMeans(clusters, children_left, children_right)

Let’s use the following column names:

cnames = ['col1', 'col2']

Get the SQL code needed to deploy the model.

model_bkm.predict_sql(cnames)

Note

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