3D Visualization

Use plot_pair_3d to render a probability or regression surface for any pair of features, along with the original data points as a scatter plot.

Example

from sklearn.datasets import load_iris
from sheshe import ModalBoundaryClustering

X, y = load_iris(return_X_y=True)
mbc = ModalBoundaryClustering(random_state=0).fit(X, y)

# basic surface for the first two features
mbc.plot_pair_3d(X, pair=(0, 1), class_label=mbc.classes_[0])

Parameters

  • pair (tuple[int, int]): indices of the two features to visualise.
  • class_label (int or str, optional): class whose probability surface is drawn. Required for classification.
  • grid_res (int, default 50): resolution of the 3D grid.

Plotly example

fig = mbc.plot_pair_3d(
    X,
    pair=(0, 1),
    class_label=mbc.classes_[0],
    grid_res=75,
    engine="plotly",
)
fig.show()