Loading...

vastorbit.machine_learning.memmodel.cluster.BisectingKMeans.predict

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

Predicts using the BisectingKMeans model.

Parameters:

X (ArrayLike) – The data on which to make the prediction.

Returns:

Predicted values.

Return type:

numpy.array

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)

Create a dataset.

data = [[2, 3]]

Compute the predictions.

model_bkm.predict(data)[0]

Note

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