Implementation:DistrictDataLabs Yellowbrick RadViz Visualizer
| Knowledge Sources | |
|---|---|
| Domains | Machine_Learning, Feature_Analysis, Visualization |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Concrete tool for RadViz (radial visualization) of multivariate feature data provided by the Yellowbrick library.
Description
The RadialVisualizer (aliased as RadViz) plots each feature as an axis uniformly distributed around the circumference of a circle, then positions each data instance inside the circle at the equilibrium point of spring forces proportional to the instance's normalized feature values. Points are rendered as a scatter plot colored by their target class, and feature axis markers with labels are drawn on the circumference. The visualizer internally applies min-max normalization to ensure all features contribute proportionally.
Usage
Use RadViz when you want a compact two-dimensional scatter view that encodes every feature simultaneously. It is best suited for classification problems with a moderate number of features (3 to 12) and a discrete target. The resulting plot reveals which features pull certain classes toward their axes and whether classes are well-separated.
Code Reference
Source Location
- Repository: yellowbrick
- File: yellowbrick/features/radviz.py
- Lines: RadialVisualizer class at L34-299, quick method at L307-388
Signature
class RadialVisualizer(DataVisualizer):
def __init__(
self,
ax=None,
features=None,
classes=None,
colors=None,
colormap=None,
alpha=1.0,
**kwargs
):
Import
from yellowbrick.features import RadViz
# or equivalently:
from yellowbrick.features.radviz import RadialVisualizer
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| ax | matplotlib Axes | No | The axis to plot on. If None, current axes are used or generated. |
| features | list | No | Feature names. Inferred from DataFrame columns if not provided. |
| classes | list | No | Class names for the legend. Inferred from unique values in y if not provided. |
| colors | list or tuple | No | Colors for each class. |
| colormap | str or cmap | No | Matplotlib colormap for class colors. |
| alpha | float | No | Transparency of scatter points. Default 1.0 (fully opaque).
|
Outputs
| Name | Type | Description |
|---|---|---|
| features_ | ndarray, shape (n_features,) | Feature names discovered or provided during fit. |
| classes_ | ndarray, shape (n_classes,) | Class labels discovered from the target vector. |
| ax | matplotlib Axes | The axes object containing the rendered RadViz scatter plot with circumference and feature markers. |
Usage Examples
Basic Usage
from yellowbrick.features import RadViz
from sklearn.datasets import load_iris
X, y = load_iris(return_X_y=True)
visualizer = RadViz(
features=["sepal length", "sepal width", "petal length", "petal width"],
classes=["setosa", "versicolor", "virginica"],
alpha=0.75,
)
visualizer.fit(X, y)
visualizer.transform(X)
visualizer.show()
Quick Method
from yellowbrick.features import radviz
from sklearn.datasets import load_iris
X, y = load_iris(return_X_y=True)
radviz(X, y, classes=["setosa", "versicolor", "virginica"], alpha=0.75)