vastorbit.machine_learning.memmodel.cluster.Clustering¶
- class vastorbit.machine_learning.memmodel.cluster.Clustering(clusters: Annotated[list | ndarray, 'Array Like Structure'], p: int = 2, clusters_names: Annotated[list | ndarray, 'Array Like Structure'] | None = None)¶
InMemoryModelimplementation of clustering algorithms.Note
This is base class for all in-memory implementations of clustering algorithms viz.
KMeans,NearestCentroid,BisectingKMeansandKPrototypes- Parameters:
clusters (ArrayLike) – ArrayLike of the model’s cluster centers.
p (int, optional) – The
pcorresponding to one of thep-distances.clusters_names (ArrayLike, optional) – Names of the clusters.
- Variables:
input (Attributes are identical to the)
underscore (parameters, followed by an)
('_').
Examples
This is a base class. To see a comprehensive example specific to your class of interest, please refer to that particular class.
- __init__(clusters: Annotated[list | ndarray, 'Array Like Structure'], p: int = 2, clusters_names: Annotated[list | ndarray, 'Array Like Structure'] | None = None) None¶
Methods
__init__(clusters[, p, clusters_names])Returns the model attributes.
predict(X)Predicts clusters using the input matrix.
Predicts the probability of each input to belong to the model clusters.
Returns the SQL code needed to deploy the model probabilities.
predict_sql(X)Returns the SQL code needed to deploy the model using its attributes.
set_attributes(**kwargs)Sets the model attributes.
transform(X)Transforms and returns the distance to each cluster.
Transforms and returns the SQL distance to each cluster.
Attributes
Must be overridden in child class