Loading...

verticapy.machine_learning.memmodel.cluster.Clustering

class verticapy.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)

InMemoryModel implementation of clustering algorithms.

Note

This is base class for all in-memory implementations of clustering algorithms viz. KMeans, NearestCentroid , BisectingKMeans and KPrototypes

Parameters

clusters: ArrayLike

ArrayLike of the model’s cluster centers.

p: int, optional

The p corresponding to one of the p-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: 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])

get_attributes()

Returns the model attributes.

predict(X)

Predicts clusters using the input matrix.

predict_proba(X)

Predicts the probability of each input to belong to the model clusters.

predict_proba_sql(X)

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.

transform_sql(X)

Transforms and returns the SQL distance to each cluster.

Attributes

object_type

Must be overridden in child class