MlflowRunSelector¶
MlflowRunSelector
¶
Fetch MLflow experiment runs and present them as a pandas DataFrame.
Designed to work with marimo.ui.table(df, selection="multi") so
users can select runs via checkboxes, then pass the selected run IDs
to MlflowChart for visualization.
Examples:
import marimo as mo
from mlflow_widgets import MlflowRunSelector, MlflowChart
selector = MlflowRunSelector(
tracking_uri="http://localhost:5000",
experiment_id="1",
)
table = mo.ui.table(selector.to_dataframe(), selection="multi")
# In another cell:
selected_ids = MlflowRunSelector.get_run_ids(table.value)
chart = MlflowChart(runs=selected_ids, metric_key="loss")
Create a MlflowRunSelector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracking_uri
|
str | None
|
MLflow tracking server URI. Defaults to
|
None
|
experiment_id
|
str | None
|
MLflow experiment ID to fetch runs from. |
None
|
Source code in src/mlflow_widgets/selector.py
refresh
¶
Re-fetch runs from MLflow. Returns self for chaining.
Source code in src/mlflow_widgets/selector.py
to_dataframe
¶
Return runs as a pandas DataFrame.
Columns: run_id, run_name, status, start_time, duration_s,
plus param.<key> for each parameter and metric.<key>
for each final metric value.
Raises:
| Type | Description |
|---|---|
ImportError
|
If pandas is not installed. |
Source code in src/mlflow_widgets/selector.py
get_run_ids
staticmethod
¶
Extract run_id list from a DataFrame, list of dicts, or similar.
Works with mo.ui.table(...).value which returns a list of dicts
or a DataFrame depending on the input format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection
|
Any
|
The |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of run_id strings. |