vastorbit.machine_learning.memmodel.cluster.KPrototypes.transform¶
- KPrototypes.transform(X: Annotated[list | ndarray, 'Array Like Structure']) ndarray¶
Transforms and returns the distance to each cluster.
- Parameters:
X (ArrayLike) – The data on which to make the transformation.
- Returns:
Transformed values.
- Return type:
numpy.array
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)
Create a dataset.
data = [[2, 'low']]
Transform the data.
model_kp.transform(data)
Note
Refer to
KPrototypesfor more information about the different methods and usages.