Skip to content

MlflowParallelCoordinates

MlflowParallelCoordinates

MlflowParallelCoordinates(*, tracking_uri: str | None = None, experiment_id: str | None = None, param_keys: Sequence[str] | None = None, metric_keys: Sequence[str] | None = None, color_by: str = 'status', width: int = 900, height: int = 400, **kwargs: Any)

Bases: AnyWidget

Parallel coordinates chart for comparing runs across params/metrics.

Each vertical axis is a parameter or metric. Each polyline is a run, colored by status. Status filter checkboxes let you show/hide run groups.

Examples:

from mlflow_widgets import MlflowParallelCoordinates

chart = MlflowParallelCoordinates(
    tracking_uri="http://localhost:5000",
    experiment_id="1",
)
chart

Create a MlflowParallelCoordinates widget.

Parameters:

Name Type Description Default
tracking_uri str | None

MLflow tracking server URI.

None
experiment_id str | None

Experiment to fetch runs from.

None
param_keys Sequence[str] | None

Which parameters to show as axes (auto-discovers if None).

None
metric_keys Sequence[str] | None

Which metrics to show as axes (auto-discovers if None).

None
color_by str

Color lines by "status" or a metric name.

'status'
width int

Widget width in pixels.

900
height int

Widget height in pixels.

400
Source code in src/mlflow_widgets/parallel.py
def __init__(
    self,
    *,
    tracking_uri: str | None = None,
    experiment_id: str | None = None,
    param_keys: Sequence[str] | None = None,
    metric_keys: Sequence[str] | None = None,
    color_by: str = "status",
    width: int = 900,
    height: int = 400,
    **kwargs: Any,
) -> None:
    """Create a MlflowParallelCoordinates widget.

    Args:
        tracking_uri: MLflow tracking server URI.
        experiment_id: Experiment to fetch runs from.
        param_keys: Which parameters to show as axes (auto-discovers if None).
        metric_keys: Which metrics to show as axes (auto-discovers if None).
        color_by: Color lines by ``"status"`` or a metric name.
        width: Widget width in pixels.
        height: Widget height in pixels.
    """
    self._tracking_uri = tracking_uri or os.environ.get(
        "MLFLOW_TRACKING_URI", "http://localhost:5000"
    )
    self._experiment_id = experiment_id
    self._param_keys = param_keys
    self._metric_keys = metric_keys
    self._mlflow = _try_import_mlflow()
    self._client = None
    if self._mlflow is not None:
        self._client = self._mlflow.MlflowClient(self._tracking_uri)

    super().__init__(color_by=color_by, width=width, height=height, **kwargs)

    if experiment_id:
        self.refresh()

refresh

refresh() -> None

Fetch run data and rebuild axes/run data.

Source code in src/mlflow_widgets/parallel.py
def refresh(self) -> None:
    """Fetch run data and rebuild axes/run data."""
    if not self._experiment_id:
        self._status = "No experiment_id set"
        return

    try:
        if self._client is not None:
            rows = _search_runs_detailed_client(self._client, self._experiment_id)
        else:
            rows = _search_runs_detailed_rest(
                self._tracking_uri, self._experiment_id
            )

        axes, runs_data = _build_axes_and_runs(
            rows, self._param_keys, self._metric_keys
        )

        now = datetime.now().strftime("%H:%M:%S")
        self._axes_data = axes
        self._runs_data = runs_data
        self._status = f"{len(runs_data)} runs, {len(axes)} axes (updated {now})"
    except Exception as exc:
        self._status = f"Error: {exc}"

close

close() -> None
Source code in src/mlflow_widgets/parallel.py
def close(self) -> None:
    super().close()