{"id":27377,"library":"scikit-learn-extra","title":"scikit-learn-extra","description":"A set of additional estimators and tools for scikit-learn, including K-Medoids, EigenPro, and Fastfood. Current version: 0.3.0 (released Oct 2021). Releases are infrequent; the project is in maintenance mode.","status":"maintenance","version":"0.3.0","language":"python","source_language":"en","source_url":"https://github.com/scikit-learn-contrib/scikit-learn-extra","tags":["scikit-learn","extra","clustering","kernel","kmedoids"],"install":[{"cmd":"pip install scikit-learn-extra","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Required. The library extends scikit-learn and depends on it.","package":"scikit-learn","optional":false}],"imports":[{"note":"KMedoids is not in scikit-learn core; it was removed from sklearn_extra after version 0.2.0?","wrong":"from sklearn.cluster import KMedoids","symbol":"KMedoids","correct":"from sklearn_extra.cluster import KMedoids"},{"note":"","wrong":"","symbol":"EigenPro","correct":"from sklearn_extra.kernel_approximation import EigenPro"},{"note":"","wrong":"","symbol":"Fastfood","correct":"from sklearn_extra.kernel_approximation import Fastfood"}],"quickstart":{"code":"from sklearn_extra.cluster import KMedoids\nimport numpy as np\nX = np.array([[1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0]])\nkmedoids = KMedoids(n_clusters=2, random_state=0).fit(X)\nprint(kmedoids.labels_)","lang":"python","description":"Fit K-Medoids clustering on a small dataset and print cluster labels."},"warnings":[{"fix":"Use 'from sklearn_extra.cluster import KMedoids'.","message":"KMedoids was originally in sklearn_extra.cluster; ensure you import from sklearn_extra, not sklearn.","severity":"gotcha","affected_versions":"all"},{"fix":"Pin scikit-learn version to <=1.0.2 if issues arise, or consider alternatives like sklearn.cluster.KMeans.","message":"The library may not be actively maintained; check for compatibility with newer scikit-learn versions (>=1.0).","severity":"gotcha","affected_versions":"0.3.0"},{"fix":"Use scikit-learn's RBFSampler as a more stable alternative.","message":"Kernel approximation estimators (EigenPro, Fastfood) may behave differently or be removed in future versions.","severity":"deprecated","affected_versions":"0.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install scikit-learn-extra'.","cause":"The package scikit-learn-extra is not installed.","error":"ModuleNotFoundError: No module named 'sklearn_extra'"},{"fix":"Use 'from sklearn_extra.cluster import KMedoids'.","cause":"KMedoids is not part of scikit-learn core; it lives in sklearn_extra.","error":"ImportError: cannot import name 'KMedoids' from 'sklearn.cluster'"},{"fix":"Set n_clusters to a value less than the number of data points.","cause":"KMedoids requires n_clusters < n_samples.","error":"ValueError: The number of clusters must be less than the number of samples."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}