.. _f-kmeansl1: module ``mlmodel.kmeans_l1`` ============================ .. inheritance-diagram:: mlinsights.mlmodel.kmeans_l1 Short summary +++++++++++++ module ``mlinsights.mlmodel.kmeans_l1`` Implements k-means with norms L1 and L2. :githublink:`%|py|6` Classes +++++++ +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------+ | class | truncated documentation | +===============================================================+===============================================================================================+ | :class:`KMeansL1L2 ` | K-Means clustering with either norm L1 or L2. See notebook :ref:`kmeansl1rst` for an example. | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------+ Functions +++++++++ +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | function | truncated documentation | +==================================================================================+====================================================================================================================+ | :func:`_centers_dense ` | M step of the K-means EM algorithm. Computation of cluster centers / means. | +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :func:`_init_centroids ` | Compute the initial centroids | +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :func:`_k_init ` | Init n_clusters seeds according to k-means++ | +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :func:`_kmeans_single_lloyd ` | A single run of k-means, assumes preparation completed prior. | +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :func:`_labels_inertia ` | E step of the K-means EM algorithm. Computes the labels and the inertia of the given samples and centers. This ... | +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :func:`_tolerance ` | Return a tolerance which is independent of the dataset | +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :func:`StrOptions ` | Dummy replacement for a class introduced in scikit-learn==1.1. | +----------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ Properties ++++++++++ +------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+ | property | truncated documentation | +==============================================================================+==================================================================================================================+ | :py:meth:`_repr_html_ ` | HTML representation of estimator. This is redundant with the logic of `_repr_mimebundle_`. The latter should ... | +------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+ Methods +++++++ +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | method | truncated documentation | +==================================================================================+=========================================================================================================================+ | :py:meth:`__init__ ` | | +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :py:meth:`_fit_l1 ` | Computes k-means clustering with norm `'L1'`. | +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :py:meth:`_predict_l1 ` | Returns the distance of each point in *X* to every fit clusters. | +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :py:meth:`_transform_l1 ` | Returns the distance of each point in *X* to every fit clusters. | +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :meth:`fit ` | Computes k-means clustering. | +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :meth:`predict ` | Predicts the closest cluster each sample in X belongs to. In the vector quantization literature, `cluster_centers_` ... | +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :meth:`transform ` | Transforms *X* to a cluster-distance space. In the new space, each dimension is the distance to the cluster ... | +----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+ Documentation +++++++++++++ .. automodule:: mlinsights.mlmodel.kmeans_l1 :members: :special-members: __init__ :show-inheritance: