Install & Compatibility
Where this runs
tested against v1.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
build_error
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 14.3s · import 3.665s · 357MB
372MB installed
● package 372MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
KElbowVisualizer
✓ from yellowbrick.cluster import KElbowVisualizer
✗ from yellowbrick.cluster.elbow import KElbowVisualizer
This example demonstrates how to use the `KElbowVisualizer` to determine the optimal number of clusters for a KMeans model using synthetic data. It fits the visualizer to the data and then displays the resulting elbow plot.
from yellowbrick.cluster import KElbowVisualizer
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
# Generate synthetic dataset
X, y = make_blobs(n_samples=1000, n_features=12, centers=8, random_state=42)
# Instantiate the clustering model and visualizer
model = KMeans(random_state=42, n_init=10) # n_init added for KMeans > sklearn 1.2
visualizer = KElbowVisualizer(model, k=(2,12))
visualizer.fit(X) # Fit the data to the visualizer
visualizer.show() # Finalize and render the figure
Debug
Known issues
breakingThe `poof()` method for rendering visualizers was deprecated in v1.0.1 and subsequently removed. It was replaced by `show()`.fixReplace all calls to `visualizer.poof()` with `visualizer.show()`.
affects: >=1.0.1
breakingYellowbrick dropped support for Python 2.x with the release of v1.0.fixEnsure your project uses Python 3.6 or higher (v1.5 requires >=3.4, <4).
affects: >=1.0
gotchaYellowbrick frequently updates to maintain compatibility with rapidly evolving upstream libraries like scikit-learn, NumPy, SciPy, and Matplotlib. Specific versions of these dependencies can be required.fixAlways check Yellowbrick's `requirements.txt` or `setup.py` on its GitHub for exact dependency versions if encountering compatibility issues. Using `pip install --upgrade yellowbrick` often helps fetch compatible versions automatically.
affects: All versions
breakingThe internal `set_params` and `get_params` API for `ModelVisualizers` changed to align with `scikit-learn` v1.0+.fixIf you have developed custom visualizers or integrations that directly interact with `ModelVisualizer`'s parameter handling, review the base class implementation in `yellowbrick.model_selection` to adapt to the new pattern.
affects: >=1.4
gotchaThe `nltk` library and its associated data are required for text-based visualizers (e.g., `FreqDistVisualizer`, `WordCorrelationPlot`) but are not installed by default with `pip install yellowbrick`.fixInstall with `pip install yellowbrick[text]` or separately via `pip install nltk`. You may also need to download `nltk` data, e.g., `import nltk; nltk.download('stopwords')`. affects: All versions using text visualizers
Upgrade
Version history
1.5latest on PyPI · released Aug 21, 2022
Audit
Dependencies
scikit-learnrequiredCore machine learning library, Yellowbrick extends its API.
numpyrequiredNumerical computing, fundamental dependency for ML.
scipyrequiredScientific computing, fundamental dependency for ML.
matplotlibrequiredPlotting and visualization, Yellowbrick's core output.
nltkoptionalNatural Language Toolkit, required for text-specific visualizers.