Skip to content

Commit

Permalink
make dashboard proxy configurable (#116)
Browse files Browse the repository at this point in the history
* enable kwarg passthru to dash app
* optionally serve app in iframe
* pass tests
* update docs
* restructure how the dash app is created (#117)
* fix imports
* remove jupyter-dash from install

Co-authored-by: Joe Wolfe <[email protected]>
  • Loading branch information
ryanSoley and joe-wolfe21 authored Aug 24, 2021
1 parent 28fd974 commit 005eeb8
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 264 deletions.
77 changes: 48 additions & 29 deletions docs/source/dashboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
Dashboard
*********

The dashboard is powered by `Plotly <https://plotly.com/>`_ and
`Dash <https://dash.plotly.com>`_ - specifically
`JupyterDash <https://medium.com/plotly/introducing-jupyterdash-811f1f57c02e>`_.
It provides a UI for exploring and visualizing projects stored locally
or in S3. The dashboard can be run in the browser (no Jupyter required!) or
within Jupyter lab or notebooks. With a little extra work, it could even be
The dashboard is powered by `Dash <https://dash.plotly.com>`_ and `Plotly
<https://plotly.com/>`_. It provides a UI for exploring and visualizing projects
stored locally or in S3. The dashboard can be run in the browser or within
Jupyter Notebook, JupyterLab or JupyterHub. With some extra work, it could be
deployed to a static URL.

Usage
=====

Install the necessary requirements with the UI extra as detailed in the
:ref:`installation section<install>`. Then, the dashboard can invoked via the
CLI:
First, install the UI extra as detailed in the :ref:`installation
section<install>`. Then decide how you'd like to run the dashboard.

CLI
~~~

Run the dashboard via the rubicon_ml CLI:

.. code-block:: shell
Expand All @@ -28,9 +30,12 @@ Use the ``--help`` flag for full usage details:
rubicon_ml ui --help
Programmatically
~~~~~~~~~~~~~~~~

The dashboard can also be launched directly from python code. If you're using
in-memory persistence, this is the only way to get the dashboard to
properly locate and load the in-memory projects and experiments.
in-memory persistence, this is the only way to get the dashboard to properly
locate and load the in-memory projects and experiments.

.. code-block:: python
Expand All @@ -40,34 +45,48 @@ properly locate and load the in-memory projects and experiments.
The above launches the dashboard on ``localhost:8050`` and will run from any
Python interpreter. If you're working in a Jupyter environment, you can launch
the dashboard inline in a notebook or in a new JupyterLab window by passing the
``mode`` keyword argument.
the dashboard inline in a notebook with `run_server_inline`:

.. code-block:: python
Dashboard(persistence="memory", root_dir="/rubicon-root", mode="inline").run_server()
Dashboard(persistence="memory", root_dir="/rubicon-root").run_server_inline()
If you need to configure the Dash proxy, that can also be done with a few extra params:

.. code-block:: python
Dashboard(persistence="memory", root_dir="/rubicon-root", mode="jupyterlab").run_server()
from rubicon_ml.ui import Dashboard
dash_options = {
"requests_pathname_prefix": "/proxy/8050"
}
Features
========
Dashboard(
persistence="memory",
dash_options=dash_options,
).run_server(proxy="http://127.0.0.1:8050::https://my-jupyterhub-server.com/")
Once a project is selected within the project selection view, you'll see
a high level grouping of its experiments. This works best if you've been
using the built in git integration. Select a grouping to view the experiments underneath
it and sort/filter the data directly within the experiment table. Optionally, compare
experiments by selecting them within the experiment table and viewing the comparison
plot below.
More info on configuring proxies and additional ``dash_options`` can be found in the
`Dash API Reference <https://dash.plotly.com/reference>`_.

The experiment comparison chart is a
`parallel coordinates plot <https://en.wikipedia.org/wiki/Parallel_coordinates>`_
with each parameter and metric plotted on a standardized axis. It's useful to draw
insights on how certain values of parameters affect key metrics.
Features
========

For example, in the image below, you can see that true values of the ``tfidf__use_idf``
and low values for ``clf__alpha`` correlate to high ``accuracy`` values.
Once a project is selected within the project selection view, you'll see a high
level grouping of its experiments. This works best if you've been using the
built in git integration. Select a grouping to view the experiments underneath
it and *sort/filter* the data directly within the experiment table. Optionally,
compare experiments by selecting them within the experiment table and viewing
the comparison plot below.

The experiment comparison chart is a `parallel coordinates plot
<https://en.wikipedia.org/wiki/Parallel_coordinates>`_ with each parameter and
metric plotted on a standardized axis. It's useful to draw insights on how
certain values of parameters affect key metrics.

For example, in the image below, you can see that true values of the
``tfidf__use_idf`` and low values for ``clf__alpha`` correlate to high
``accuracy`` values.

.. note::
The y-axes can be dragged and rearranged to reorder the plot. And you can highlight
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dependencies:
- beautifulsoup4>=4.8.2
- dash>=1.14.0
- dash-bootstrap-components>=0.10.6
- jupyter-dash
- percy>=2.0.2
- selenium>=3.141.0

Expand Down
6 changes: 3 additions & 3 deletions notebooks/integrations/integration-git.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"from rubicon_ml.ui import Dashboard\n",
"\n",
"\n",
"Dashboard(persistence=\"memory\").run_server()"
"Dashboard(persistence=\"memory\").run_server_inline()"
]
},
{
Expand All @@ -136,7 +136,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -150,7 +150,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions notebooks/integrations/integration-prefect-workflows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,13 @@
"from rubicon_ml.ui import Dashboard\n",
"\n",
"\n",
"Dashboard(persistence=\"filesystem\", root_dir=root_path).run_server()"
"Dashboard(persistence=\"filesystem\", root_dir=root_path).run_server_inline()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -670,7 +670,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions notebooks/integrations/integration-sklearn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@
"source": [
"from rubicon_ml.ui import Dashboard\n",
"\n",
"Dashboard(persistence=\"filesystem\", root_dir=root_path).run_server()"
"Dashboard(persistence=\"filesystem\", root_dir=root_path).run_server_inline()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -363,7 +363,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions notebooks/quick-look.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
"from rubicon_ml.ui import Dashboard\n",
"\n",
"\n",
"Dashboard(persistence=\"filesystem\", root_dir=root_path).run_server()"
"Dashboard(persistence=\"filesystem\", root_dir=root_path).run_server_inline()"
]
},
{
Expand Down Expand Up @@ -386,7 +386,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -400,7 +400,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
20 changes: 2 additions & 18 deletions rubicon_ml/ui/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
## Rubicon Dashboard

The Rubicon Dashboard (powered by [Dash](https://dash.plotly.com/introduction)) offers a way to visualize your logged data within a local or shareable UI. To view the Dashboard, follow these steps:
The Rubicon Dashboard (powered by [Dash](https://dash.plotly.com/introduction)) offers a way to visualize your logged data within a local or shareable UI.

* install the required dependencies:

```
pip install rubicon[ui]
```
* use the CLI to launch the dashboard:
```bash
# usage
rubicon_ml ui --help
# run
rubicon_ml ui --root-dir "/path/to/root" --project-name "Example"
```
* view the dashboard at `http://127.0.0.1:8050/`
To get started, visit the [dashboard docs](https://capitalone.github.io/rubicon-ml/dashboard.html)
2 changes: 1 addition & 1 deletion rubicon_ml/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def _check_for_ui_extras():

_check_for_ui_extras()

from rubicon_ml.ui.dashboard import Dashboard # noqa E402
from rubicon_ml.ui.dashboard import Dashboard # noqa F401

__all__ = ["Dashboard"]
3 changes: 0 additions & 3 deletions rubicon_ml/ui/app.py

This file was deleted.

4 changes: 4 additions & 0 deletions rubicon_ml/ui/callbacks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .project_explorer import set_project_explorer_callbacks
from .project_selection import set_project_selection_callbacks

__all__ = ["set_project_explorer_callbacks", "set_project_selection_callbacks"]
Loading

0 comments on commit 005eeb8

Please sign in to comment.