Loading...

vastorbit.machine_learning.memmodel.cluster.KPrototypes.transform_sql

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

Transforms and returns the SQL distance to each cluster.

Parameters:

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

Returns:

SQL code.

Return type:

list

Examples

Import the required module.

from vastorbit.machine_learning.memmodel.cluster import KPrototypes

We will use the following attributes:

clusters = [
    [0.5, 'high'],
    [1, 'low'],
    [100, 'high'],
]
p = 2
gamma = 1.0
is_categorical = [0, 1]

Let’s create a model.

model_kp = KPrototypes(clusters, p, gamma, is_categorical)

Let’s use the following column names:

cnames = ['col1', 'col2']

Get the SQL code needed to deploy the model.

model_kp.transform_sql(cnames)

Note

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