Kernel K-means.
✓ Published0🌍 Public
OOrhanYaz
Last edited Nov 14, 2013
Created on Feb 15, 2019
This example demonstrates kernel k-means clustering, which extends standard k-means to nonlinear decision boundaries by computing distances in a kernel-induced feature space. The code, written by Mathieu Blondel, implements a custom `KernelKMeans` estimator using scikit-learn’s `BaseEstimator` and `ClusterMixin`, with distance calculations based on pairwise kernels from `sklearn.metrics.pairwise`. It generates synthetic blob data via `make_blobs` from `sklearn.datasets` and fits the model with a linear kernel by default, printing predicted labels for the first ten samples. The implementation iteratively reassigns clusters while monitoring convergence via a tolerance threshold.
AI-generated description