verticapy.machine_learning.memmodel.cluster.Clustering#
- class verticapy.machine_learning.memmodel.cluster.Clustering(clusters: list | ndarray, p: int = 2, clusters_names: list | ndarray | None = None)#
InMemoryModel
implementation of clustering algorithms.Note
This is base class for all in-memory implementations of clustering algorithms viz.
KMeans
,NearestCentroid
,BisectingKMeans
andKPrototypes
Parameters#
- clusters: ArrayLike
ArrayLike of the model’s cluster centers.
- p: int, optional
The
p
corresponding to one of thep
-distances.- clusters_names: ArrayLike, optional
Names of the clusters.
Attributes#
Attributes are identical to the input parameters, followed by an underscore (‘_’).
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: list | ndarray, p: int = 2, clusters_names: list | ndarray | 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